Files
StudyDiary-20251025/.obsidian/plugins/copilot/main.js
T

2500 lines
3.9 MiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
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 Xvr=Object.create;var YV=Object.defineProperty;var Qvr=Object.getOwnPropertyDescriptor;var ewr=Object.getOwnPropertyNames;var twr=Object.getPrototypeOf,rwr=Object.prototype.hasOwnProperty;var vGe=t=>{throw TypeError(t)};var nwr=(t,e,r)=>e in t?YV(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var b=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ns=(t,e)=>{for(var r in e)YV(t,r,{get:e[r],enumerable:!0})},wGe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ewr(e))!rwr.call(t,o)&&o!==r&&YV(t,o,{get:()=>e[o],enumerable:!(n=Qvr(e,o))||n.enumerable});return t};var j=(t,e,r)=>(r=t!=null?Xvr(twr(t)):{},wGe(e||!t||!t.__esModule?YV(r,"default",{value:t,enumerable:!0}):r,t)),Mc=t=>wGe(YV({},"__esModule",{value:!0}),t);var gd=(t,e,r)=>nwr(t,typeof e!="symbol"?e+"":e,r),owr=(t,e,r)=>e.has(t)||vGe("Cannot "+r);var ywe=(t,e,r)=>e.has(t)?vGe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var xGe=(t,e,r)=>(owr(t,e,"access private method"),r);function bwe(){if(!SX&&(SX=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!SX))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return SX(iwr)}var SX,iwr,SGe=b(()=>{iwr=new Uint8Array(16)});function CGe(t,e=0){return yd[t[e+0]]+yd[t[e+1]]+yd[t[e+2]]+yd[t[e+3]]+"-"+yd[t[e+4]]+yd[t[e+5]]+"-"+yd[t[e+6]]+yd[t[e+7]]+"-"+yd[t[e+8]]+yd[t[e+9]]+"-"+yd[t[e+10]]+yd[t[e+11]]+yd[t[e+12]]+yd[t[e+13]]+yd[t[e+14]]+yd[t[e+15]]}var yd,OGe=b(()=>{yd=[];for(let t=0;t<256;++t)yd.push((t+256).toString(16).slice(1))});var awr,_we,EGe=b(()=>{awr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),_we={randomUUID:awr}});function swr(t,e,r){if(_we.randomUUID&&!e&&!t)return _we.randomUUID();t=t||{};let n=t.random||(t.rng||bwe)();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 CGe(n)}var lm,PGe=b(()=>{EGe();SGe();OGe();lm=swr});var LN=b(()=>{PGe()});var Kn,vwe,yt,mv,XV=b(()=>{(function(t){t.assertEqual=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"&&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})(Kn||(Kn={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(vwe||(vwe={}));yt=Kn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mv=t=>{switch(typeof t){case"undefined":return yt.undefined;case"string":return yt.string;case"number":return Number.isNaN(t)?yt.nan:yt.number;case"boolean":return yt.boolean;case"function":return yt.function;case"bigint":return yt.bigint;case"symbol":return yt.symbol;case"object":return Array.isArray(t)?yt.array:t===null?yt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?yt.promise:typeof Map<"u"&&t instanceof Map?yt.map:typeof Set<"u"&&t instanceof Set?yt.set:typeof Date<"u"&&t instanceof Date?yt.date:yt.object;default:return yt.unknown}}});var Ue,uwr,cm,CX=b(()=>{XV();Ue=Kn.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"]),uwr=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),cm=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,Kn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};cm.create=t=>new cm(t)});var lwr,oE,wwe=b(()=>{CX();XV();lwr=(t,e)=>{let r;switch(t.code){case Ue.invalid_type:t.received===yt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Ue.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Kn.jsonStringifyReplacer)}`;break;case Ue.unrecognized_keys:r=`Unrecognized key(s) in object: ${Kn.joinValues(t.keys,", ")}`;break;case Ue.invalid_union:r="Invalid input";break;case Ue.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Kn.joinValues(t.options)}`;break;case Ue.invalid_enum_value:r=`Invalid enum value. Expected ${Kn.joinValues(t.options)}, received '${t.received}'`;break;case Ue.invalid_arguments:r="Invalid function arguments";break;case Ue.invalid_return_type:r="Invalid function return type";break;case Ue.invalid_date:r="Invalid date";break;case Ue.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}"`:Kn.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Ue.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==="bigint"?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 Ue.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 Ue.custom:r="Invalid input";break;case Ue.invalid_intersection_types:r="Intersection results could not be merged";break;case Ue.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Ue.not_finite:r="Number must be finite";break;default:r=e.defaultError,Kn.assertNever(t)}return{message:r}},oE=lwr});function cwr(t){TGe=t}function iB(){return TGe}var TGe,OX=b(()=>{wwe();TGe=oE});function lt(t,e){let r=iB(),n=QV({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===oE?void 0:oE].filter(o=>!!o)});t.common.issues.push(n)}var QV,dwr,bd,wr,FN,wf,EX,PX,EA,aB,xwe=b(()=>{OX();wwe();QV=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}},dwr=[];bd=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 wr;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 wr;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}}},wr=Object.freeze({status:"aborted"}),FN=t=>({status:"dirty",value:t}),wf=t=>({status:"valid",value:t}),EX=t=>t.status==="aborted",PX=t=>t.status==="dirty",EA=t=>t.status==="valid",aB=t=>typeof Promise<"u"&&t instanceof Promise});var AGe=b(()=>{});var Wt,IGe=b(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Wt||(Wt={}))});function ln(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)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}function jGe(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Twr(t){return new RegExp(`^${jGe(t)}$`)}function DGe(t){let e=`${NGe}T${jGe(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 Awr(t,e){return!!((e==="v4"||!e)&&wwr.test(t)||(e==="v6"||!e)&&Swr.test(t))}function Iwr(t,e){if(!ywr.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let 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||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Mwr(t,e){return!!((e==="v4"||!e)&&xwr.test(t)||(e==="v6"||!e)&&Cwr.test(t))}function Rwr(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}function sB(t){if(t instanceof fm){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=dm.create(sB(n))}return new fm({...t._def,shape:()=>e})}else return t instanceof sE?new sE({...t._def,type:sB(t.element)}):t instanceof dm?dm.create(sB(t.unwrap())):t instanceof gv?gv.create(sB(t.unwrap())):t instanceof hv?hv.create(t.items.map(e=>sB(e))):t}function Cwe(t,e){let r=mv(t),n=mv(e);if(t===e)return{valid:!0,data:t};if(r===yt.object&&n===yt.object){let o=Kn.objectKeys(e),i=Kn.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=Cwe(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===yt.array&&n===yt.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=Cwe(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===yt.date&&n===yt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function LGe(t,e){return new GN({values:t,typeName:re.ZodEnum,...ln(e)})}function RGe(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function FGe(t,e={},r){return t?TA.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=RGe(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=RGe(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):TA.create()}var Ig,MGe,Tn,fwr,pwr,mwr,hwr,gwr,ywr,bwr,_wr,vwr,Swe,wwr,xwr,Swr,Cwr,Owr,Ewr,NGe,Pwr,PA,kN,$N,BN,zN,uB,UN,qN,TA,aE,Cb,lB,sE,fm,HN,iE,TX,VN,hv,AX,cB,dB,IX,WN,KN,GN,JN,AA,Mg,dm,gv,ZN,YN,fB,Nwr,e6,t6,XN,jwr,re,Dwr,kGe,$Ge,Lwr,Fwr,BGe,kwr,$wr,Bwr,zwr,Uwr,qwr,Hwr,Vwr,Wwr,Kwr,Gwr,Jwr,Zwr,Ywr,Xwr,Qwr,e0r,t0r,r0r,n0r,o0r,i0r,a0r,s0r,u0r,l0r,c0r,d0r,f0r,p0r,m0r,h0r,g0r,y0r,zGe=b(()=>{CX();OX();IGe();xwe();XV();Ig=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||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},MGe=(t,e)=>{if(EA(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 cm(t.common.issues);return this._error=r,this._error}}};Tn=class{get description(){return this._def.description}_getType(e){return mv(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:mv(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new bd,ctx:{common:e.parent.common,data:e.data,parsedType:mv(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(aB(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){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mv(e)},o=this._parseSync({data:e,path:n.path,parent:n});return MGe(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mv(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return EA(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>EA(n)?{value:n.value}:{issues:r.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:mv(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(aB(o)?o:Promise.resolve(o));return MGe(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:Ue.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 Mg({schema:this,typeName:re.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 dm.create(this,this._def)}nullable(){return gv.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sE.create(this)}promise(){return AA.create(this,this._def)}or(e){return HN.create([this,e],this._def)}and(e){return VN.create(this,e,this._def)}transform(e){return new Mg({...ln(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ZN({...ln(this._def),innerType:this,defaultValue:r,typeName:re.ZodDefault})}brand(){return new e6({typeName:re.ZodBranded,type:this,...ln(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new YN({...ln(this._def),innerType:this,catchValue:r,typeName:re.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return t6.create(this,e)}readonly(){return XN.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},fwr=/^c[^\s-]{8,}$/i,pwr=/^[0-9a-z]+$/,mwr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,hwr=/^[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,gwr=/^[a-z0-9_-]{21}$/i,ywr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,bwr=/^[-+]?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)?)??$/,_wr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,vwr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",wwr=/^(?:(?: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])$/,xwr=/^(?:(?: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])$/,Swr=/^(([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]))$/,Cwr=/^(([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])$/,Owr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ewr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,NGe="((\\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])))",Pwr=new RegExp(`^${NGe}$`);PA=class t extends Tn{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==yt.string){let i=this._getOrReturnCtx(e);return lt(i,{code:Ue.invalid_type,expected:yt.string,received:i.parsedType}),wr}let n=new bd,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),lt(o,{code:Ue.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),lt(o,{code:Ue.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?lt(o,{code:Ue.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&lt(o,{code:Ue.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")_wr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"email",code:Ue.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Swe||(Swe=new RegExp(vwr,"u")),Swe.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"emoji",code:Ue.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")hwr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"uuid",code:Ue.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")gwr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"nanoid",code:Ue.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")fwr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"cuid",code:Ue.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")pwr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"cuid2",code:Ue.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")mwr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"ulid",code:Ue.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),lt(o,{validation:"url",code:Ue.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),lt(o,{validation:"regex",code:Ue.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),lt(o,{code:Ue.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),lt(o,{code:Ue.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),lt(o,{code:Ue.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?DGe(i).test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{code:Ue.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Pwr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{code:Ue.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Twr(i).test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{code:Ue.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?bwr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"duration",code:Ue.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Awr(e.data,i.version)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"ip",code:Ue.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Iwr(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"jwt",code:Ue.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Mwr(e.data,i.version)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"cidr",code:Ue.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Owr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"base64",code:Ue.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Ewr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"base64url",code:Ue.invalid_string,message:i.message}),n.dirty()):Kn.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:Ue.invalid_string,...Wt.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Wt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Wt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Wt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Wt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Wt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Wt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Wt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Wt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Wt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Wt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Wt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Wt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Wt.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Wt.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,...Wt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Wt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Wt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Wt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Wt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Wt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Wt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Wt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Wt.errToObj(r)})}nonempty(e){return this.min(1,Wt.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}};PA.create=t=>new PA({checks:[],typeName:re.ZodString,coerce:t?.coerce??!1,...ln(t)});kN=class t extends Tn{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)!==yt.number){let i=this._getOrReturnCtx(e);return lt(i,{code:Ue.invalid_type,expected:yt.number,received:i.parsedType}),wr}let n,o=new bd;for(let i of this._def.checks)i.kind==="int"?Kn.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),lt(n,{code:Ue.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),lt(n,{code:Ue.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),lt(n,{code:Ue.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Rwr(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),lt(n,{code:Ue.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),lt(n,{code:Ue.not_finite,message:i.message}),o.dirty()):Kn.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Wt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Wt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Wt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Wt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Wt.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Wt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Wt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Wt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Wt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Wt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Wt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Wt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Wt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Wt.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"&&Kn.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)}};kN.create=t=>new kN({checks:[],typeName:re.ZodNumber,coerce:t?.coerce||!1,...ln(t)});$N=class t extends Tn{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)!==yt.bigint)return this._getInvalidInput(e);let n,o=new bd;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),lt(n,{code:Ue.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),lt(n,{code:Ue.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),lt(n,{code:Ue.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Kn.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return lt(r,{code:Ue.invalid_type,expected:yt.bigint,received:r.parsedType}),wr}gte(e,r){return this.setLimit("min",e,!0,Wt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Wt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Wt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Wt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Wt.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:Wt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Wt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Wt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Wt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Wt.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}};$N.create=t=>new $N({checks:[],typeName:re.ZodBigInt,coerce:t?.coerce??!1,...ln(t)});BN=class extends Tn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==yt.boolean){let n=this._getOrReturnCtx(e);return lt(n,{code:Ue.invalid_type,expected:yt.boolean,received:n.parsedType}),wr}return wf(e.data)}};BN.create=t=>new BN({typeName:re.ZodBoolean,coerce:t?.coerce||!1,...ln(t)});zN=class t extends Tn{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==yt.date){let i=this._getOrReturnCtx(e);return lt(i,{code:Ue.invalid_type,expected:yt.date,received:i.parsedType}),wr}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return lt(i,{code:Ue.invalid_date}),wr}let n=new bd,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),lt(o,{code:Ue.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),lt(o,{code:Ue.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Kn.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:Wt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Wt.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}};zN.create=t=>new zN({checks:[],coerce:t?.coerce||!1,typeName:re.ZodDate,...ln(t)});uB=class extends Tn{_parse(e){if(this._getType(e)!==yt.symbol){let n=this._getOrReturnCtx(e);return lt(n,{code:Ue.invalid_type,expected:yt.symbol,received:n.parsedType}),wr}return wf(e.data)}};uB.create=t=>new uB({typeName:re.ZodSymbol,...ln(t)});UN=class extends Tn{_parse(e){if(this._getType(e)!==yt.undefined){let n=this._getOrReturnCtx(e);return lt(n,{code:Ue.invalid_type,expected:yt.undefined,received:n.parsedType}),wr}return wf(e.data)}};UN.create=t=>new UN({typeName:re.ZodUndefined,...ln(t)});qN=class extends Tn{_parse(e){if(this._getType(e)!==yt.null){let n=this._getOrReturnCtx(e);return lt(n,{code:Ue.invalid_type,expected:yt.null,received:n.parsedType}),wr}return wf(e.data)}};qN.create=t=>new qN({typeName:re.ZodNull,...ln(t)});TA=class extends Tn{constructor(){super(...arguments),this._any=!0}_parse(e){return wf(e.data)}};TA.create=t=>new TA({typeName:re.ZodAny,...ln(t)});aE=class extends Tn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return wf(e.data)}};aE.create=t=>new aE({typeName:re.ZodUnknown,...ln(t)});Cb=class extends Tn{_parse(e){let r=this._getOrReturnCtx(e);return lt(r,{code:Ue.invalid_type,expected:yt.never,received:r.parsedType}),wr}};Cb.create=t=>new Cb({typeName:re.ZodNever,...ln(t)});lB=class extends Tn{_parse(e){if(this._getType(e)!==yt.undefined){let n=this._getOrReturnCtx(e);return lt(n,{code:Ue.invalid_type,expected:yt.void,received:n.parsedType}),wr}return wf(e.data)}};lB.create=t=>new lB({typeName:re.ZodVoid,...ln(t)});sE=class t extends Tn{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==yt.array)return lt(r,{code:Ue.invalid_type,expected:yt.array,received:r.parsedType}),wr;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(lt(r,{code:a?Ue.too_big:Ue.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&&(lt(r,{code:Ue.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&&(lt(r,{code:Ue.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 Ig(r,a,r.path,s)))).then(a=>bd.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Ig(r,a,r.path,s)));return bd.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Wt.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Wt.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Wt.toString(r)}})}nonempty(e){return this.min(1,e)}};sE.create=(t,e)=>new sE({type:t,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...ln(e)});fm=class t extends Tn{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=Kn.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==yt.object){let l=this._getOrReturnCtx(e);return lt(l,{code:Ue.invalid_type,expected:yt.object,received:l.parsedType}),wr}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Cb&&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 Ig(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Cb){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&&(lt(o,{code:Ue.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 Ig(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=>bd.mergeObjectSync(n,l)):bd.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Wt.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Wt.errToObj(e).message??o}:{message:o}}}:{}})}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:re.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Kn.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Kn.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return sB(this)}partial(e){let r={};for(let n of Kn.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Kn.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof dm;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return LGe(Kn.objectKeys(this.shape))}};fm.create=(t,e)=>new fm({shape:()=>t,unknownKeys:"strip",catchall:Cb.create(),typeName:re.ZodObject,...ln(e)});fm.strictCreate=(t,e)=>new fm({shape:()=>t,unknownKeys:"strict",catchall:Cb.create(),typeName:re.ZodObject,...ln(e)});fm.lazycreate=(t,e)=>new fm({shape:t,unknownKeys:"strip",catchall:Cb.create(),typeName:re.ZodObject,...ln(e)});HN=class extends Tn{_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 cm(s.ctx.common.issues));return lt(r,{code:Ue.invalid_union,unionErrors:a}),wr}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 cm(u));return lt(r,{code:Ue.invalid_union,unionErrors:s}),wr}}get options(){return this._def.options}};HN.create=(t,e)=>new HN({options:t,typeName:re.ZodUnion,...ln(e)});iE=t=>t instanceof WN?iE(t.schema):t instanceof Mg?iE(t.innerType()):t instanceof KN?[t.value]:t instanceof GN?t.options:t instanceof JN?Kn.objectValues(t.enum):t instanceof ZN?iE(t._def.innerType):t instanceof UN?[void 0]:t instanceof qN?[null]:t instanceof dm?[void 0,...iE(t.unwrap())]:t instanceof gv?[null,...iE(t.unwrap())]:t instanceof e6||t instanceof XN?iE(t.unwrap()):t instanceof YN?iE(t._def.innerType):[],TX=class t extends Tn{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==yt.object)return lt(r,{code:Ue.invalid_type,expected:yt.object,received:r.parsedType}),wr;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}):(lt(r,{code:Ue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),wr)}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=iE(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:re.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...ln(n)})}};VN=class extends Tn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(EX(i)||EX(a))return wr;let s=Cwe(i.value,a.value);return s.valid?((PX(i)||PX(a))&&r.dirty(),{status:r.value,value:s.data}):(lt(n,{code:Ue.invalid_intersection_types}),wr)};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}))}};VN.create=(t,e,r)=>new VN({left:t,right:e,typeName:re.ZodIntersection,...ln(r)});hv=class t extends Tn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==yt.array)return lt(n,{code:Ue.invalid_type,expected:yt.array,received:n.parsedType}),wr;if(n.data.length<this._def.items.length)return lt(n,{code:Ue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),wr;!this._def.rest&&n.data.length>this._def.items.length&&(lt(n,{code:Ue.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 Ig(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>bd.mergeArray(r,a)):bd.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};hv.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new hv({items:t,typeName:re.ZodTuple,rest:null,...ln(e)})};AX=class t extends Tn{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!==yt.object)return lt(n,{code:Ue.invalid_type,expected:yt.object,received:n.parsedType}),wr;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Ig(n,s,n.path,s)),value:a._parse(new Ig(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?bd.mergeObjectAsync(r,o):bd.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Tn?new t({keyType:e,valueType:r,typeName:re.ZodRecord,...ln(n)}):new t({keyType:PA.create(),valueType:e,typeName:re.ZodRecord,...ln(r)})}},cB=class extends Tn{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!==yt.map)return lt(n,{code:Ue.invalid_type,expected:yt.map,received:n.parsedType}),wr;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new Ig(n,s,n.path,[l,"key"])),value:i._parse(new Ig(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 wr;(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 wr;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};cB.create=(t,e,r)=>new cB({valueType:e,keyType:t,typeName:re.ZodMap,...ln(r)});dB=class t extends Tn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==yt.set)return lt(n,{code:Ue.invalid_type,expected:yt.set,received:n.parsedType}),wr;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(lt(n,{code:Ue.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&&(lt(n,{code:Ue.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 wr;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 Ig(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:Wt.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Wt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};dB.create=(t,e)=>new dB({valueType:t,minSize:null,maxSize:null,typeName:re.ZodSet,...ln(e)});IX=class t extends Tn{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==yt.function)return lt(r,{code:Ue.invalid_type,expected:yt.function,received:r.parsedType}),wr;function n(s,u){return QV({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,iB(),oE].filter(l=>!!l),issueData:{code:Ue.invalid_arguments,argumentsError:u}})}function o(s,u){return QV({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,iB(),oE].filter(l=>!!l),issueData:{code:Ue.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof AA){let s=this;return wf(async function(...u){let l=new cm([]),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 wf(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new cm([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new cm([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:hv.create(e).rest(aE.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||hv.create([]).rest(aE.create()),returns:r||aE.create(),typeName:re.ZodFunction,...ln(n)})}},WN=class extends Tn{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})}};WN.create=(t,e)=>new WN({getter:t,typeName:re.ZodLazy,...ln(e)});KN=class extends Tn{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return lt(r,{received:r.data,code:Ue.invalid_literal,expected:this._def.value}),wr}return{status:"valid",value:e.data}}get value(){return this._def.value}};KN.create=(t,e)=>new KN({value:t,typeName:re.ZodLiteral,...ln(e)});GN=class t extends Tn{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return lt(r,{expected:Kn.joinValues(n),received:r.parsedType,code:Ue.invalid_type}),wr}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return lt(r,{received:r.data,code:Ue.invalid_enum_value,options:n}),wr}return wf(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})}};GN.create=LGe;JN=class extends Tn{_parse(e){let r=Kn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==yt.string&&n.parsedType!==yt.number){let o=Kn.objectValues(r);return lt(n,{expected:Kn.joinValues(o),received:n.parsedType,code:Ue.invalid_type}),wr}if(this._cache||(this._cache=new Set(Kn.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=Kn.objectValues(r);return lt(n,{received:n.data,code:Ue.invalid_enum_value,options:o}),wr}return wf(e.data)}get enum(){return this._def.values}};JN.create=(t,e)=>new JN({values:t,typeName:re.ZodNativeEnum,...ln(e)});AA=class extends Tn{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==yt.promise&&r.common.async===!1)return lt(r,{code:Ue.invalid_type,expected:yt.promise,received:r.parsedType}),wr;let n=r.parsedType===yt.promise?r.data:Promise.resolve(r.data);return wf(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};AA.create=(t,e)=>new AA({type:t,typeName:re.ZodPromise,...ln(e)});Mg=class extends Tn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===re.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=>{lt(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 wr;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?wr:u.status==="dirty"?FN(u.value):r.value==="dirty"?FN(u.value):u});{if(r.value==="aborted")return wr;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?wr:s.status==="dirty"?FN(s.value):r.value==="dirty"?FN(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"?wr:(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"?wr:(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(!EA(a))return wr;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=>EA(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):wr);Kn.assertNever(o)}};Mg.create=(t,e,r)=>new Mg({schema:t,typeName:re.ZodEffects,effect:e,...ln(r)});Mg.createWithPreprocess=(t,e,r)=>new Mg({schema:e,effect:{type:"preprocess",transform:t},typeName:re.ZodEffects,...ln(r)});dm=class extends Tn{_parse(e){return this._getType(e)===yt.undefined?wf(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};dm.create=(t,e)=>new dm({innerType:t,typeName:re.ZodOptional,...ln(e)});gv=class extends Tn{_parse(e){return this._getType(e)===yt.null?wf(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gv.create=(t,e)=>new gv({innerType:t,typeName:re.ZodNullable,...ln(e)});ZN=class extends Tn{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===yt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ZN.create=(t,e)=>new ZN({innerType:t,typeName:re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ln(e)});YN=class extends Tn{_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 aB(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new cm(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new cm(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};YN.create=(t,e)=>new YN({innerType:t,typeName:re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ln(e)});fB=class extends Tn{_parse(e){if(this._getType(e)!==yt.nan){let n=this._getOrReturnCtx(e);return lt(n,{code:Ue.invalid_type,expected:yt.nan,received:n.parsedType}),wr}return{status:"valid",value:e.data}}};fB.create=t=>new fB({typeName:re.ZodNaN,...ln(t)});Nwr=Symbol("zod_brand"),e6=class extends Tn{_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}},t6=class t extends Tn{_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"?wr:i.status==="dirty"?(r.dirty(),FN(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"?wr: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:re.ZodPipeline})}},XN=class extends Tn{_parse(e){let r=this._def.innerType._parse(e),n=o=>(EA(o)&&(o.value=Object.freeze(o.value)),o);return aB(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};XN.create=(t,e)=>new XN({innerType:t,typeName:re.ZodReadonly,...ln(e)});jwr={object:fm.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"})(re||(re={}));Dwr=(t,e={message:`Input not instance of ${t.name}`})=>FGe(r=>r instanceof t,e),kGe=PA.create,$Ge=kN.create,Lwr=fB.create,Fwr=$N.create,BGe=BN.create,kwr=zN.create,$wr=uB.create,Bwr=UN.create,zwr=qN.create,Uwr=TA.create,qwr=aE.create,Hwr=Cb.create,Vwr=lB.create,Wwr=sE.create,Kwr=fm.create,Gwr=fm.strictCreate,Jwr=HN.create,Zwr=TX.create,Ywr=VN.create,Xwr=hv.create,Qwr=AX.create,e0r=cB.create,t0r=dB.create,r0r=IX.create,n0r=WN.create,o0r=KN.create,i0r=GN.create,a0r=JN.create,s0r=AA.create,u0r=Mg.create,l0r=dm.create,c0r=gv.create,d0r=Mg.createWithPreprocess,f0r=t6.create,p0r=()=>kGe().optional(),m0r=()=>$Ge().optional(),h0r=()=>BGe().optional(),g0r={string:t=>PA.create({...t,coerce:!0}),number:t=>kN.create({...t,coerce:!0}),boolean:t=>BN.create({...t,coerce:!0}),bigint:t=>$N.create({...t,coerce:!0}),date:t=>zN.create({...t,coerce:!0})},y0r=wr});var ht={};ns(ht,{BRAND:()=>Nwr,DIRTY:()=>FN,EMPTY_PATH:()=>dwr,INVALID:()=>wr,NEVER:()=>y0r,OK:()=>wf,ParseStatus:()=>bd,Schema:()=>Tn,ZodAny:()=>TA,ZodArray:()=>sE,ZodBigInt:()=>$N,ZodBoolean:()=>BN,ZodBranded:()=>e6,ZodCatch:()=>YN,ZodDate:()=>zN,ZodDefault:()=>ZN,ZodDiscriminatedUnion:()=>TX,ZodEffects:()=>Mg,ZodEnum:()=>GN,ZodError:()=>cm,ZodFirstPartyTypeKind:()=>re,ZodFunction:()=>IX,ZodIntersection:()=>VN,ZodIssueCode:()=>Ue,ZodLazy:()=>WN,ZodLiteral:()=>KN,ZodMap:()=>cB,ZodNaN:()=>fB,ZodNativeEnum:()=>JN,ZodNever:()=>Cb,ZodNull:()=>qN,ZodNullable:()=>gv,ZodNumber:()=>kN,ZodObject:()=>fm,ZodOptional:()=>dm,ZodParsedType:()=>yt,ZodPipeline:()=>t6,ZodPromise:()=>AA,ZodReadonly:()=>XN,ZodRecord:()=>AX,ZodSchema:()=>Tn,ZodSet:()=>dB,ZodString:()=>PA,ZodSymbol:()=>uB,ZodTransformer:()=>Mg,ZodTuple:()=>hv,ZodType:()=>Tn,ZodUndefined:()=>UN,ZodUnion:()=>HN,ZodUnknown:()=>aE,ZodVoid:()=>lB,addIssueToContext:()=>lt,any:()=>Uwr,array:()=>Wwr,bigint:()=>Fwr,boolean:()=>BGe,coerce:()=>g0r,custom:()=>FGe,date:()=>kwr,datetimeRegex:()=>DGe,defaultErrorMap:()=>oE,discriminatedUnion:()=>Zwr,effect:()=>u0r,enum:()=>i0r,function:()=>r0r,getErrorMap:()=>iB,getParsedType:()=>mv,instanceof:()=>Dwr,intersection:()=>Ywr,isAborted:()=>EX,isAsync:()=>aB,isDirty:()=>PX,isValid:()=>EA,late:()=>jwr,lazy:()=>n0r,literal:()=>o0r,makeIssue:()=>QV,map:()=>e0r,nan:()=>Lwr,nativeEnum:()=>a0r,never:()=>Hwr,null:()=>zwr,nullable:()=>c0r,number:()=>$Ge,object:()=>Kwr,objectUtil:()=>vwe,oboolean:()=>h0r,onumber:()=>m0r,optional:()=>l0r,ostring:()=>p0r,pipeline:()=>f0r,preprocess:()=>d0r,promise:()=>s0r,quotelessJson:()=>uwr,record:()=>Qwr,set:()=>t0r,setErrorMap:()=>cwr,strictObject:()=>Gwr,string:()=>kGe,symbol:()=>$wr,transformer:()=>u0r,tuple:()=>Xwr,undefined:()=>Bwr,union:()=>Jwr,unknown:()=>qwr,util:()=>Kn,void:()=>Vwr});var r6=b(()=>{OX();xwe();AGe();XV();zGe();CX()});var MX=b(()=>{r6();r6()});var qGe=x((_Jn,UGe)=>{function Rg(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))}UGe.exports=Rg;Rg.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Rg.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Rg.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};Rg.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)};Rg.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Rg.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Rg.prototype.start=Rg.prototype.try;Rg.prototype.errors=function(){return this._errors};Rg.prototype.attempts=function(){return this._attempts};Rg.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 HGe=x(QN=>{var b0r=qGe();QN.operation=function(t){var e=QN.timeouts(t);return new b0r(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};QN.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};QN.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};QN.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=QN.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 WGe=x((wJn,VGe)=>{VGe.exports=HGe()});var jX=x((xJn,NX)=>{"use strict";var _0r=WGe(),v0r=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],RX=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}},w0r=(t,e,r)=>{let n=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=n,t},x0r=t=>v0r.includes(t),KGe=(t,e)=>new Promise((r,n)=>{e={onFailedAttempt:()=>{},retries:10,...e};let o=_0r.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 RX)o.stop(),n(a.originalError);else if(a instanceof TypeError&&!x0r(a.message))o.stop(),n(a);else{w0r(a,i,e);try{await e.onFailedAttempt(a)}catch(s){n(s);return}o.retry(a)||n(o.mainError())}}})});NX.exports=KGe;NX.exports.default=KGe;NX.exports.AbortError=RX});var GGe,JGe=b(()=>{GGe=/^(?:[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 S0r(t){return typeof t=="string"&&GGe.test(t)}var IA,Owe=b(()=>{JGe();IA=S0r});function C0r(t){if(!IA(t))throw TypeError("Invalid UUID");var e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var ZGe,YGe=b(()=>{Owe();ZGe=C0r});function LX(t,e=0){return(_d[t[e+0]]+_d[t[e+1]]+_d[t[e+2]]+_d[t[e+3]]+"-"+_d[t[e+4]]+_d[t[e+5]]+"-"+_d[t[e+6]]+_d[t[e+7]]+"-"+_d[t[e+8]]+_d[t[e+9]]+"-"+_d[t[e+10]]+_d[t[e+11]]+_d[t[e+12]]+_d[t[e+13]]+_d[t[e+14]]+_d[t[e+15]]).toLowerCase()}var _d,DX,Ewe=b(()=>{_d=[];for(DX=0;DX<256;++DX)_d.push((DX+256).toString(16).slice(1))});function Pwe(){if(!FX&&(FX=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!FX))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return FX(O0r)}var FX,O0r,XGe=b(()=>{O0r=new Uint8Array(16)});function E0r(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}function Twe(t,e,r){function n(o,i,a,s){var u;if(typeof o=="string"&&(o=E0r(o)),typeof i=="string"&&(i=ZGe(i)),((u=i)===null||u===void 0?void 0:u.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var l=new Uint8Array(16+o.length);if(l.set(i),l.set(o,i.length),l=r(l),l[6]=l[6]&15|e,l[8]=l[8]&63|128,a){s=s||0;for(var c=0;c<16;++c)a[s+c]=l[c];return a}return LX(l)}try{n.name=t}catch{}return n.DNS=P0r,n.URL=T0r,n}var P0r,T0r,QGe=b(()=>{Ewe();YGe();P0r="6ba7b810-9dad-11d1-80b4-00c04fd430c8",T0r="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var A0r,Awe,eJe=b(()=>{A0r=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Awe={randomUUID:A0r}});function I0r(t,e,r){if(Awe.randomUUID&&!e&&!t)return Awe.randomUUID();t=t||{};var n=t.random||(t.rng||Pwe)();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 LX(n)}var As,tJe=b(()=>{eJe();XGe();Ewe();As=I0r});function M0r(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function Iwe(t,e){return t<<e|t>>>32-e}function R0r(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var n=unescape(encodeURIComponent(t));t=[];for(var o=0;o<n.length;++o)t.push(n.charCodeAt(o))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var i=t.length/4+2,a=Math.ceil(i/16),s=new Array(a),u=0;u<a;++u){for(var l=new Uint32Array(16),c=0;c<16;++c)l[c]=t[u*64+c*4]<<24|t[u*64+c*4+1]<<16|t[u*64+c*4+2]<<8|t[u*64+c*4+3];s[u]=l}s[a-1][14]=(t.length-1)*8/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=(t.length-1)*8&4294967295;for(var d=0;d<a;++d){for(var f=new Uint32Array(80),p=0;p<16;++p)f[p]=s[d][p];for(var h=16;h<80;++h)f[h]=Iwe(f[h-3]^f[h-8]^f[h-14]^f[h-16],1);for(var m=r[0],g=r[1],y=r[2],_=r[3],w=r[4],S=0;S<80;++S){var C=Math.floor(S/20),E=Iwe(m,5)+M0r(C,g,y,_)+w+e[C]+f[S]>>>0;w=_,_=y,y=Iwe(g,30)>>>0,g=m,m=E}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+_>>>0,r[4]=r[4]+w>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var rJe,nJe=b(()=>{rJe=R0r});var N0r,kX,oJe=b(()=>{QGe();nJe();N0r=Twe("v5",80,rJe),kX=N0r});var ej=b(()=>{tJe();oJe();Owe()});function iJe(t=!1){let e=D0r.getInstance().getStore();if(!t&&e===void 0)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.`);return e}function $X(t){return typeof t=="function"&&"langsmith:traceable"in t}var Nwe,Rwe,j0r,jwe,D0r,VJn,aJe=b(()=>{Nwe=class{getStore(){}run(e,r){return r()}},Rwe=Symbol.for("ls:tracing_async_local_storage"),j0r=new Nwe,jwe=class{getInstance(){return globalThis[Rwe]??j0r}initializeGlobalInstance(e){globalThis[Rwe]===void 0&&(globalThis[Rwe]=e)}},D0r=new jwe;VJn=Symbol.for("langsmith:traceable:root")});var Dwe=b(()=>{aJe()});function zX(t,e){return L0r.call(t,e)}function UX(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)zX(t,r)&&e.push(r);return e}function xf(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function qX(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 yv(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function n6(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function BX(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(BX(t[r]))return!0}else if(typeof t=="object"){let r=UX(t),n=r.length;for(var e=0;e<n;e++)if(BX(t[r[e]]))return!0}}return!1}function sJe(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 L0r,tj,o6=b(()=>{L0r=Object.prototype.hasOwnProperty;tj=class extends Error{constructor(e,r,n,o,i){super(sJe(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=sJe(e,{name:r,index:n,operation:o,tree:i})}}});var Lwe={};ns(Lwe,{JsonPatchError:()=>Is,_areEquals:()=>i6,applyOperation:()=>rj,applyPatch:()=>MA,applyReducer:()=>$0r,deepClone:()=>F0r,getValueByPointer:()=>HX,validate:()=>uJe,validator:()=>VX});function HX(t,e){if(e=="")return t;var r={op:"_get",path:e};return rj(t,r),r.value}function rj(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):VX(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=HX(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=i6(t,e.value),a.test===!1)throw new Is("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 Is("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=xf(t));let s=(e.path||"").split("/"),u=t,l=1,c=s.length,d,f,p;for(typeof r=="function"?p=r:p=VX;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=n6(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&&!qX(f))throw new Is("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);qX(f)&&(f=~~f)}if(l>=c){if(r&&e.op==="add"&&f>u.length)throw new Is("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let h=k0r[e.op].call(e,u,f,t);if(h.test===!1)throw new Is("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return h}}else if(l>=c){let h=pB[e.op].call(e,u,f,t);if(h.test===!1)throw new Is("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return h}if(u=u[f],r&&l<c&&(!u||typeof u!="object"))throw new Is("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,t)}}}function MA(t,e,r,n=!0,o=!0){if(r&&!Array.isArray(e))throw new Is("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=xf(t));let i=new Array(e.length);for(let a=0,s=e.length;a<s;a++)i[a]=rj(t,e[a],r,!0,o,a),t=i[a].newDocument;return i.newDocument=t,i}function $0r(t,e,r){let n=rj(t,e);if(n.test===!1)throw new Is("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function VX(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new Is("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(pB[t.op]){if(typeof t.path!="string")throw new Is("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new Is('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 Is("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 Is("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")&&BX(t.value))throw new Is("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 Is("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 Is("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=uJe([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Is("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new Is("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function uJe(t,e,r){try{if(!Array.isArray(t))throw new Is("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)MA(xf(e),xf(t),r||!0);else{r=r||VX;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(o){if(o instanceof Is)return o;throw o}}function i6(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(!i6(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],!i6(t[a],e[a]))return!1;return!0}return t!==t&&e!==e}var Is,F0r,pB,k0r,WX=b(()=>{o6();Is=tj,F0r=xf,pB={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=HX(r,this.path);n&&(n=xf(n));let o=rj(r,{op:"remove",path:this.from}).removed;return rj(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=HX(r,this.from);return rj(r,{op:"add",path:this.path,value:xf(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:i6(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},k0r={add:function(t,e,r){return qX(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:pB.move,copy:pB.copy,test:pB.test,_get:pB._get}});function lJe(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=UX(e),a=UX(t),s=!1,u=!1,l=a.length-1;l>=0;l--){var c=a[l],d=t[c];if(zX(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)?lJe(d,f,r,n+"/"+yv(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+yv(c),value:xf(d)}),r.push({op:"replace",path:n+"/"+yv(c),value:xf(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+yv(c),value:xf(d)}),r.push({op:"remove",path:n+"/"+yv(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];!zX(t,c)&&e[c]!==void 0&&r.push({op:"add",path:n+"/"+yv(c),value:xf(e[c])})}}}function KX(t,e,r=!1){var n=[];return lJe(t,e,n,"",r),n}var cJe=b(()=>{o6();WX();});var t7n,Fwe=b(()=>{WX();cJe();o6();WX();o6();t7n={...Lwe,JsonPatchError:tj,deepClone:xf,escapePathComponent:yv,unescapePathComponent:n6}});var dJe,fJe,kwe,pJe,$we,Bwe,zwe,mJe,hJe,gJe,yJe,bJe,_Je,vJe,wJe,xJe,SJe,CJe,OJe,EJe,PJe,TJe,AJe,IJe,MJe,RJe,NJe,jJe,DJe,LJe,Uwe,FJe,kJe,$Je=b(()=>{dJe="gen_ai.operation.name",fJe="gen_ai.system",kwe="gen_ai.request.model",pJe="gen_ai.response.model",$we="gen_ai.usage.input_tokens",Bwe="gen_ai.usage.output_tokens",zwe="gen_ai.usage.total_tokens",mJe="gen_ai.request.max_tokens",hJe="gen_ai.request.temperature",gJe="gen_ai.request.top_p",yJe="gen_ai.request.frequency_penalty",bJe="gen_ai.request.presence_penalty",_Je="gen_ai.response.finish_reasons",vJe="gen_ai.prompt",wJe="gen_ai.completion",xJe="gen_ai.request.extra_query",SJe="gen_ai.request.extra_body",CJe="gen_ai.serialized.name",OJe="gen_ai.serialized.signature",EJe="gen_ai.serialized.doc",PJe="gen_ai.response.id",TJe="gen_ai.response.service_tier",AJe="gen_ai.response.system_fingerprint",IJe="gen_ai.usage.input_token_details",MJe="gen_ai.usage.output_token_details",RJe="langsmith.trace.session_id",NJe="langsmith.trace.session_name",jJe="langsmith.span.kind",DJe="langsmith.trace.name",LJe="langsmith.metadata",Uwe="langsmith.span.tags",FJe="langsmith.request.streaming",kJe="langsmith.request.headers"});var z0r,BJe,zJe,Gt,GX=b(()=>{uE();z0r=(...t)=>fetch(...t),BJe=Symbol.for("ls:fetch_implementation"),zJe=()=>{let t=globalThis[BJe];return t?typeof t=="function"&&"Headers"in t&&"Request"in t&&"Response"in t:!1},Gt=t=>async(...e)=>{if(t||ec("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[BJe]??z0r)(...e);return(t||ec("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r}});var a6,qwe=b(()=>{uE();a6=()=>ec("PROJECT")??Sh("LANGCHAIN_SESSION")??"default"});var JX,ZX=b(()=>{Hwe();Vwe();GX();qwe();JX="0.3.54"});function YX(){if(Wwe===void 0){let t=W0r(),e=G0r();Wwe={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:JX,...e}}return Wwe}function qJe(){let t=K0r()||{},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 K0r(){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 Sh(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function ec(t){return Sh(`LANGSMITH_${t}`)||Sh(`LANGCHAIN_${t}`)}function G0r(){if(Kwe!==void 0)return Kwe;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=Sh(r);n!==void 0&&(e[r]=n)}return Kwe=e,e}function XX(){return Sh("OTEL_ENABLED")==="true"||ec("OTEL_ENABLED")==="true"}var lE,U0r,q0r,H0r,UJe,V0r,W0r,Wwe,Kwe,uE=b(()=>{ZX();U0r=()=>typeof window<"u"&&typeof window.document<"u",q0r=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",H0r=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),UJe=()=>typeof Deno<"u",V0r=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!UJe(),W0r=()=>lE||(U0r()?lE="browser":V0r()?lE="node":q0r()?lE="webworker":H0r()?lE="jsdom":UJe()?lE="deno":lE="other",lE)});function QX(){return e0e.getTraceInstance()}function VJe(){return e0e.getContextInstance()}function WJe(){return e0e.getDefaultOTLPTracerComponents()}var Zwe,Ywe,Xwe,Gwe,Jwe,HJe,J0r,Z0r,Qwe,e0e,t0e=b(()=>{uE();Zwe=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&XX()&&(console.warn('You have enabled OTEL export via the `OTEL_ENABLED` or `LANGSMITH_OTEL_ENABLED` environment variable, but have not initialized the required OTEL instances. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0);let n;if(r.length===1&&typeof r[0]=="function"?n=r[0]:r.length===2&&typeof r[1]=="function"?n=r[1]:r.length===3&&typeof r[2]=="function"&&(n=r[2]),typeof n=="function")return n()}},Ywe=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new Zwe})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},Xwe=class{active(){return{}}with(e,r){return r()}},Gwe=Symbol.for("ls:otel_trace"),Jwe=Symbol.for("ls:otel_context"),HJe=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),J0r=new Ywe,Z0r=new Xwe,Qwe=class{getTraceInstance(){return globalThis[Gwe]??J0r}getContextInstance(){return globalThis[Jwe]??Z0r}initializeGlobalInstances(e){globalThis[Gwe]===void 0&&(globalThis[Gwe]=e.trace),globalThis[Jwe]===void 0&&(globalThis[Jwe]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[HJe]=e}getDefaultOTLPTracerComponents(){return globalThis[HJe]??void 0}},e0e=new Qwe});function X0r(t){return Y0r[t]||t}var Y0r,eQ,KJe=b(()=>{$Je();t0e();Y0r={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};eQ=class{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(e,r){for(let n of e)try{if(!n.run)continue;if(n.operation==="post"){let o=this.createSpanForRun(n,n.run,r.get(n.id));o&&!n.run.end_time&&this.spans.set(n.id,o)}else this.updateSpanForRun(n,n.run)}catch(o){console.error(`Error processing operation ${n.id}:`,o)}}createSpanForRun(e,r,n){let o=n&&QX().getSpan(n);if(o)try{return this.finishSpanSetup(o,r,e)}catch(i){console.error(`Failed to create span for run ${e.id}:`,i);return}}finishSpanSetup(e,r,n){return this.setSpanAttributes(e,r,n),r.error?(e.setStatus({code:2}),e.recordException(new Error(r.error))):e.setStatus({code:1}),r.end_time&&e.end(new Date(r.end_time)),e}updateSpanForRun(e,r){try{let n=this.spans.get(e.id);if(!n){console.debug(`No span found for run ${e.id} during update`);return}this.setSpanAttributes(n,r,e),r.error?(n.setStatus({code:2}),n.recordException(new Error(r.error))):n.setStatus({code:1});let o=r.end_time;o&&(n.end(new Date(o)),this.spans.delete(e.id))}catch(n){console.error(`Failed to update span for run ${e.id}:`,n)}}extractModelName(e){if(e.extra?.metadata){let r=e.extra.metadata;if(r.ls_model_name)return r.ls_model_name;if(r.invocation_params){let n=r.invocation_params;if(n.model)return n.model;if(n.model_name)return n.model_name}}}setSpanAttributes(e,r,n){if("run_type"in r&&r.run_type){e.setAttribute(jJe,r.run_type);let s=X0r(r.run_type||"chain");e.setAttribute(dJe,s)}"name"in r&&r.name&&e.setAttribute(DJe,r.name),"session_id"in r&&r.session_id&&e.setAttribute(RJe,r.session_id),"session_name"in r&&r.session_name&&e.setAttribute(NJe,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute(kwe,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute($we,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(Bwe,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(zwe,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[s,u]of Object.entries(i))u!=null&&e.setAttribute(`${LJe}.${s}`,String(u));let a=r.tags;if(a&&Array.isArray(a)?e.setAttribute(Uwe,a.join(", ")):a&&e.setAttribute(Uwe,String(a)),"serialized"in r&&typeof r.serialized=="object"){let s=r.serialized;s.name&&e.setAttribute(CJe,String(s.name)),s.signature&&e.setAttribute(OJe,String(s.signature)),s.doc&&e.setAttribute(EJe,String(s.doc))}this.setIOAttributes(e,n)}setGenAiSystem(e,r){let n="langchain",o=this.extractModelName(r);if(o){let i=o.toLowerCase();i.includes("anthropic")||i.startsWith("claude")?n="anthropic":i.includes("bedrock")?n="aws.bedrock":i.includes("azure")&&i.includes("openai")?n="az.ai.openai":i.includes("azure")&&i.includes("inference")?n="az.ai.inference":i.includes("cohere")?n="cohere":i.includes("deepseek")?n="deepseek":i.includes("gemini")?n="gemini":i.includes("groq")?n="groq":i.includes("watson")||i.includes("ibm")?n="ibm.watsonx.ai":i.includes("mistral")?n="mistral_ai":i.includes("gpt")||i.includes("openai")?n="openai":i.includes("perplexity")||i.includes("sonar")?n="perplexity":i.includes("vertex")?n="vertex_ai":(i.includes("xai")||i.includes("grok"))&&(n="xai")}e.setAttribute(fJe,n)}setInvocationParameters(e,r){if(!r.extra?.metadata?.invocation_params)return;let n=r.extra.metadata.invocation_params;n.max_tokens!==void 0&&e.setAttribute(mJe,n.max_tokens),n.temperature!==void 0&&e.setAttribute(hJe,n.temperature),n.top_p!==void 0&&e.setAttribute(gJe,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(yJe,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute(bJe,n.presence_penalty)}setIOAttributes(e,r){if(r.run.inputs)try{let n=r.run.inputs;typeof n=="object"&&n!==null&&(n.model&&Array.isArray(n.messages)&&e.setAttribute(kwe,n.model),n.stream!==void 0&&e.setAttribute(FJe,n.stream),n.extra_headers&&e.setAttribute(kJe,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute(xJe,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(SJe,JSON.stringify(n.extra_body))),e.setAttribute(vJe,JSON.stringify(n))}catch(n){console.debug(`Failed to process inputs for run ${r.id}`,n)}if(r.run.outputs)try{let n=r.run.outputs,o=this.getUnifiedRunTokens(n);if(o&&(e.setAttribute($we,o[0]),e.setAttribute(Bwe,o[1]),e.setAttribute(zwe,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(pJe,String(n.model)),n.id&&e.setAttribute(PJe,n.id),n.choices&&Array.isArray(n.choices)){let i=n.choices.map(a=>a.finish_reason).filter(a=>a).map(String);i.length>0&&e.setAttribute(_Je,i.join(", "))}if(n.service_tier&&e.setAttribute(TJe,n.service_tier),n.system_fingerprint&&e.setAttribute(AJe,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let i=n.usage_metadata;i.input_token_details&&e.setAttribute(IJe,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(MJe,JSON.stringify(i.output_token_details))}}e.setAttribute(wJe,JSON.stringify(n))}catch(n){console.debug(`Failed to process outputs for run ${r.id}`,n)}}getUnifiedRunTokens(e){if(!e)return null;let r=this.extractUnifiedRunTokens(e.usage_metadata);if(r)return r;let n=Object.keys(e);for(let a of n){let s=e[a];if(!(!s||typeof s!="object")&&(r=this.extractUnifiedRunTokens(s.usage_metadata),r||s.lc===1&&s.kwargs&&typeof s.kwargs=="object"&&(r=this.extractUnifiedRunTokens(s.kwargs.usage_metadata),r)))return r}let o=e.generations||[];if(!Array.isArray(o))return null;let i=Array.isArray(o[0])?o.flat():o;for(let a of i)if(typeof a=="object"&&a.message&&typeof a.message=="object"&&a.message.kwargs&&typeof a.message.kwargs=="object"&&(r=this.extractUnifiedRunTokens(a.message.kwargs.usage_metadata),r))return r;return null}extractUnifiedRunTokens(e){return!e||typeof e!="object"||typeof e.input_tokens!="number"||typeof e.output_tokens!="number"?null:[e.input_tokens,e.output_tokens]}}});var JJe=x((x7n,r0e)=>{"use strict";var Q0r=Object.prototype.hasOwnProperty,yp="~";function s6(){}Object.create&&(s6.prototype=Object.create(null),new s6().__proto__||(yp=!1));function exr(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function GJe(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new exr(r,n||t,o),a=yp?yp+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 tQ(t,e){--t._eventsCount===0?t._events=new s6:delete t._events[e]}function Sf(){this._events=new s6,this._eventsCount=0}Sf.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)Q0r.call(r,n)&&e.push(yp?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Sf.prototype.listeners=function(e){var r=yp?yp+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};Sf.prototype.listenerCount=function(e){var r=yp?yp+e:e,n=this._events[r];return n?n.fn?1:n.length:0};Sf.prototype.emit=function(e,r,n,o,i,a){var s=yp?yp+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};Sf.prototype.on=function(e,r,n){return GJe(this,e,r,n,!1)};Sf.prototype.once=function(e,r,n){return GJe(this,e,r,n,!0)};Sf.prototype.removeListener=function(e,r,n,o){var i=yp?yp+e:e;if(!this._events[i])return this;if(!r)return tQ(this,i),this;var a=this._events[i];if(a.fn)a.fn===r&&(!o||a.once)&&(!n||a.context===n)&&tQ(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:tQ(this,i)}return this};Sf.prototype.removeAllListeners=function(e){var r;return e?(r=yp?yp+e:e,this._events[r]&&tQ(this,r)):(this._events=new s6,this._eventsCount=0),this};Sf.prototype.off=Sf.prototype.removeListener;Sf.prototype.addListener=Sf.prototype.on;Sf.prefixed=yp;Sf.EventEmitter=Sf;typeof r0e<"u"&&(r0e.exports=Sf)});var YJe=x((S7n,ZJe)=>{"use strict";ZJe.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 QJe=x((C7n,nQ)=>{"use strict";var txr=YJe(),rQ=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},XJe=(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 rQ(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);txr(t.then(n,o),()=>{clearTimeout(i)})});nQ.exports=XJe;nQ.exports.default=XJe;nQ.exports.TimeoutError=rQ});var e7e=x(n0e=>{"use strict";Object.defineProperty(n0e,"__esModule",{value:!0});function rxr(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}n0e.default=rxr});var t7e=x(i0e=>{"use strict";Object.defineProperty(i0e,"__esModule",{value:!0});var nxr=e7e(),o0e=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=nxr.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}};i0e.default=o0e});var iQ=x(s0e=>{"use strict";Object.defineProperty(s0e,"__esModule",{value:!0});var oxr=JJe(),r7e=QJe(),ixr=t7e(),oQ=()=>{},axr=new r7e.TimeoutError,a0e=class extends oxr{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=oQ,this._resolveIdle=oQ,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:ixr.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=oQ,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=oQ,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():r7e.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(axr)});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}};s0e.default=a0e});var n7e,aQ,sxr,uxr,u6,o7e=b(()=>{n7e=j(jX(),1),aQ=j(iQ(),1);GX();sxr=[400,401,403,404,405,406,407,408],uxr=[409],u6=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 aQ.default?this.queue=new aQ.default.default({concurrency:this.maxConcurrency}):this.queue=new aQ.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){let n=this.onFailedResponseHook;return this.queue.add(()=>(0,n7e.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(sxr.includes(+a))throw o;if(uxr.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(()=>Gt(this.debug)(...e).then(r=>r.ok?r:Promise.reject(r)))}}});function u0e(t){return typeof t?._getType=="function"}function l0e(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 i7e=b(()=>{});function on(t,e){if(!lxr.test(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}var lxr,a7e=b(()=>{lxr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});function sQ(t){s7e[t]||(console.warn(t),s7e[t]=!0)}var s7e,c0e=b(()=>{s7e={}});var l6=x((N7n,u7e)=>{var cxr="2.0.0",dxr=Number.MAX_SAFE_INTEGER||9007199254740991,fxr=16,pxr=250,mxr=["major","premajor","minor","preminor","patch","prepatch","prerelease"];u7e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:fxr,MAX_SAFE_BUILD_LENGTH:pxr,MAX_SAFE_INTEGER:dxr,RELEASE_TYPES:mxr,SEMVER_SPEC_VERSION:cxr,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var c6=x((j7n,l7e)=>{var hxr=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};l7e.exports=hxr});var mB=x((cE,c7e)=>{var{MAX_SAFE_COMPONENT_LENGTH:d0e,MAX_SAFE_BUILD_LENGTH:gxr,MAX_LENGTH:yxr}=l6(),bxr=c6();cE=c7e.exports={};var _xr=cE.re=[],vxr=cE.safeRe=[],Pt=cE.src=[],Tt=cE.t={},wxr=0,f0e="[a-zA-Z0-9-]",xxr=[["\\s",1],["\\d",yxr],[f0e,gxr]],Sxr=t=>{for(let[e,r]of xxr)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},an=(t,e,r)=>{let n=Sxr(e),o=wxr++;bxr(t,o,e),Tt[t]=o,Pt[o]=e,_xr[o]=new RegExp(e,r?"g":void 0),vxr[o]=new RegExp(n,r?"g":void 0)};an("NUMERICIDENTIFIER","0|[1-9]\\d*");an("NUMERICIDENTIFIERLOOSE","\\d+");an("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f0e}*`);an("MAINVERSION",`(${Pt[Tt.NUMERICIDENTIFIER]})\\.(${Pt[Tt.NUMERICIDENTIFIER]})\\.(${Pt[Tt.NUMERICIDENTIFIER]})`);an("MAINVERSIONLOOSE",`(${Pt[Tt.NUMERICIDENTIFIERLOOSE]})\\.(${Pt[Tt.NUMERICIDENTIFIERLOOSE]})\\.(${Pt[Tt.NUMERICIDENTIFIERLOOSE]})`);an("PRERELEASEIDENTIFIER",`(?:${Pt[Tt.NUMERICIDENTIFIER]}|${Pt[Tt.NONNUMERICIDENTIFIER]})`);an("PRERELEASEIDENTIFIERLOOSE",`(?:${Pt[Tt.NUMERICIDENTIFIERLOOSE]}|${Pt[Tt.NONNUMERICIDENTIFIER]})`);an("PRERELEASE",`(?:-(${Pt[Tt.PRERELEASEIDENTIFIER]}(?:\\.${Pt[Tt.PRERELEASEIDENTIFIER]})*))`);an("PRERELEASELOOSE",`(?:-?(${Pt[Tt.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Pt[Tt.PRERELEASEIDENTIFIERLOOSE]})*))`);an("BUILDIDENTIFIER",`${f0e}+`);an("BUILD",`(?:\\+(${Pt[Tt.BUILDIDENTIFIER]}(?:\\.${Pt[Tt.BUILDIDENTIFIER]})*))`);an("FULLPLAIN",`v?${Pt[Tt.MAINVERSION]}${Pt[Tt.PRERELEASE]}?${Pt[Tt.BUILD]}?`);an("FULL",`^${Pt[Tt.FULLPLAIN]}$`);an("LOOSEPLAIN",`[v=\\s]*${Pt[Tt.MAINVERSIONLOOSE]}${Pt[Tt.PRERELEASELOOSE]}?${Pt[Tt.BUILD]}?`);an("LOOSE",`^${Pt[Tt.LOOSEPLAIN]}$`);an("GTLT","((?:<|>)?=?)");an("XRANGEIDENTIFIERLOOSE",`${Pt[Tt.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);an("XRANGEIDENTIFIER",`${Pt[Tt.NUMERICIDENTIFIER]}|x|X|\\*`);an("XRANGEPLAIN",`[v=\\s]*(${Pt[Tt.XRANGEIDENTIFIER]})(?:\\.(${Pt[Tt.XRANGEIDENTIFIER]})(?:\\.(${Pt[Tt.XRANGEIDENTIFIER]})(?:${Pt[Tt.PRERELEASE]})?${Pt[Tt.BUILD]}?)?)?`);an("XRANGEPLAINLOOSE",`[v=\\s]*(${Pt[Tt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Pt[Tt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Pt[Tt.XRANGEIDENTIFIERLOOSE]})(?:${Pt[Tt.PRERELEASELOOSE]})?${Pt[Tt.BUILD]}?)?)?`);an("XRANGE",`^${Pt[Tt.GTLT]}\\s*${Pt[Tt.XRANGEPLAIN]}$`);an("XRANGELOOSE",`^${Pt[Tt.GTLT]}\\s*${Pt[Tt.XRANGEPLAINLOOSE]}$`);an("COERCEPLAIN",`(^|[^\\d])(\\d{1,${d0e}})(?:\\.(\\d{1,${d0e}}))?(?:\\.(\\d{1,${d0e}}))?`);an("COERCE",`${Pt[Tt.COERCEPLAIN]}(?:$|[^\\d])`);an("COERCEFULL",Pt[Tt.COERCEPLAIN]+`(?:${Pt[Tt.PRERELEASE]})?(?:${Pt[Tt.BUILD]})?(?:$|[^\\d])`);an("COERCERTL",Pt[Tt.COERCE],!0);an("COERCERTLFULL",Pt[Tt.COERCEFULL],!0);an("LONETILDE","(?:~>?)");an("TILDETRIM",`(\\s*)${Pt[Tt.LONETILDE]}\\s+`,!0);cE.tildeTrimReplace="$1~";an("TILDE",`^${Pt[Tt.LONETILDE]}${Pt[Tt.XRANGEPLAIN]}$`);an("TILDELOOSE",`^${Pt[Tt.LONETILDE]}${Pt[Tt.XRANGEPLAINLOOSE]}$`);an("LONECARET","(?:\\^)");an("CARETTRIM",`(\\s*)${Pt[Tt.LONECARET]}\\s+`,!0);cE.caretTrimReplace="$1^";an("CARET",`^${Pt[Tt.LONECARET]}${Pt[Tt.XRANGEPLAIN]}$`);an("CARETLOOSE",`^${Pt[Tt.LONECARET]}${Pt[Tt.XRANGEPLAINLOOSE]}$`);an("COMPARATORLOOSE",`^${Pt[Tt.GTLT]}\\s*(${Pt[Tt.LOOSEPLAIN]})$|^$`);an("COMPARATOR",`^${Pt[Tt.GTLT]}\\s*(${Pt[Tt.FULLPLAIN]})$|^$`);an("COMPARATORTRIM",`(\\s*)${Pt[Tt.GTLT]}\\s*(${Pt[Tt.LOOSEPLAIN]}|${Pt[Tt.XRANGEPLAIN]})`,!0);cE.comparatorTrimReplace="$1$2$3";an("HYPHENRANGE",`^\\s*(${Pt[Tt.XRANGEPLAIN]})\\s+-\\s+(${Pt[Tt.XRANGEPLAIN]})\\s*$`);an("HYPHENRANGELOOSE",`^\\s*(${Pt[Tt.XRANGEPLAINLOOSE]})\\s+-\\s+(${Pt[Tt.XRANGEPLAINLOOSE]})\\s*$`);an("STAR","(<|>)?=?\\s*\\*");an("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");an("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var uQ=x((D7n,d7e)=>{var Cxr=Object.freeze({loose:!0}),Oxr=Object.freeze({}),Exr=t=>t?typeof t!="object"?Cxr:t:Oxr;d7e.exports=Exr});var p0e=x((L7n,m7e)=>{var f7e=/^[0-9]+$/,p7e=(t,e)=>{let r=f7e.test(t),n=f7e.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Pxr=(t,e)=>p7e(e,t);m7e.exports={compareIdentifiers:p7e,rcompareIdentifiers:Pxr}});var Cf=x((F7n,b7e)=>{var lQ=c6(),{MAX_LENGTH:h7e,MAX_SAFE_INTEGER:cQ}=l6(),{safeRe:g7e,t:y7e}=mB(),Txr=uQ(),{compareIdentifiers:hB}=p0e(),m0e=class t{constructor(e,r){if(r=Txr(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>h7e)throw new TypeError(`version is longer than ${h7e} characters`);lQ("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?g7e[y7e.LOOSE]:g7e[y7e.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>cQ||this.major<0)throw new TypeError("Invalid major version");if(this.minor>cQ||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>cQ||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<cQ)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(lQ("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)),hB(this.major,e.major)||hB(this.minor,e.minor)||hB(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(lQ("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 hB(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(lQ("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 hB(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]),hB(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}};b7e.exports=m0e});var oj=x((k7n,v7e)=>{var _7e=Cf(),Axr=(t,e,r=!1)=>{if(t instanceof _7e)return t;try{return new _7e(t,e)}catch(n){if(!r)return null;throw n}};v7e.exports=Axr});var x7e=x(($7n,w7e)=>{var Ixr=oj(),Mxr=(t,e)=>{let r=Ixr(t,e);return r?r.version:null};w7e.exports=Mxr});var C7e=x((B7n,S7e)=>{var Rxr=oj(),Nxr=(t,e)=>{let r=Rxr(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};S7e.exports=Nxr});var P7e=x((z7n,E7e)=>{var O7e=Cf(),jxr=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new O7e(t instanceof O7e?t.version:t,r).inc(e,n,o).version}catch{return null}};E7e.exports=jxr});var I7e=x((U7n,A7e)=>{var T7e=oj(),Dxr=(t,e)=>{let r=T7e(t,null,!0),n=T7e(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"};A7e.exports=Dxr});var R7e=x((q7n,M7e)=>{var Lxr=Cf(),Fxr=(t,e)=>new Lxr(t,e).major;M7e.exports=Fxr});var j7e=x((H7n,N7e)=>{var kxr=Cf(),$xr=(t,e)=>new kxr(t,e).minor;N7e.exports=$xr});var L7e=x((V7n,D7e)=>{var Bxr=Cf(),zxr=(t,e)=>new Bxr(t,e).patch;D7e.exports=zxr});var k7e=x((W7n,F7e)=>{var Uxr=oj(),qxr=(t,e)=>{let r=Uxr(t,e);return r&&r.prerelease.length?r.prerelease:null};F7e.exports=qxr});var Ng=x((K7n,B7e)=>{var $7e=Cf(),Hxr=(t,e,r)=>new $7e(t,r).compare(new $7e(e,r));B7e.exports=Hxr});var U7e=x((G7n,z7e)=>{var Vxr=Ng(),Wxr=(t,e,r)=>Vxr(e,t,r);z7e.exports=Wxr});var H7e=x((J7n,q7e)=>{var Kxr=Ng(),Gxr=(t,e)=>Kxr(t,e,!0);q7e.exports=Gxr});var dQ=x((Z7n,W7e)=>{var V7e=Cf(),Jxr=(t,e,r)=>{let n=new V7e(t,r),o=new V7e(e,r);return n.compare(o)||n.compareBuild(o)};W7e.exports=Jxr});var G7e=x((Y7n,K7e)=>{var Zxr=dQ(),Yxr=(t,e)=>t.sort((r,n)=>Zxr(r,n,e));K7e.exports=Yxr});var Z7e=x((X7n,J7e)=>{var Xxr=dQ(),Qxr=(t,e)=>t.sort((r,n)=>Xxr(n,r,e));J7e.exports=Qxr});var d6=x((Q7n,Y7e)=>{var eSr=Ng(),tSr=(t,e,r)=>eSr(t,e,r)>0;Y7e.exports=tSr});var fQ=x((eZn,X7e)=>{var rSr=Ng(),nSr=(t,e,r)=>rSr(t,e,r)<0;X7e.exports=nSr});var h0e=x((tZn,Q7e)=>{var oSr=Ng(),iSr=(t,e,r)=>oSr(t,e,r)===0;Q7e.exports=iSr});var g0e=x((rZn,eZe)=>{var aSr=Ng(),sSr=(t,e,r)=>aSr(t,e,r)!==0;eZe.exports=sSr});var pQ=x((nZn,tZe)=>{var uSr=Ng(),lSr=(t,e,r)=>uSr(t,e,r)>=0;tZe.exports=lSr});var mQ=x((oZn,rZe)=>{var cSr=Ng(),dSr=(t,e,r)=>cSr(t,e,r)<=0;rZe.exports=dSr});var y0e=x((iZn,nZe)=>{var fSr=h0e(),pSr=g0e(),mSr=d6(),hSr=pQ(),gSr=fQ(),ySr=mQ(),bSr=(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 fSr(t,r,n);case"!=":return pSr(t,r,n);case">":return mSr(t,r,n);case">=":return hSr(t,r,n);case"<":return gSr(t,r,n);case"<=":return ySr(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};nZe.exports=bSr});var iZe=x((aZn,oZe)=>{var _Sr=Cf(),vSr=oj(),{safeRe:hQ,t:gQ}=mB(),wSr=(t,e)=>{if(t instanceof _Sr)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?hQ[gQ.COERCEFULL]:hQ[gQ.COERCE]);else{let u=e.includePrerelease?hQ[gQ.COERCERTLFULL]:hQ[gQ.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 vSr(`${n}.${o}.${i}${a}${s}`,e)};oZe.exports=wSr});var sZe=x((sZn,aZe)=>{var b0e=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}};aZe.exports=b0e});var jg=x((uZn,dZe)=>{var xSr=/\s+/g,_0e=class t{constructor(e,r){if(r=CSr(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof v0e)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(xSr," "),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=>!lZe(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&&MSr(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&&ASr)|(this.options.loose&&ISr))+":"+e,o=uZe.get(n);if(o)return o;let i=this.options.loose,a=i?pm[bp.HYPHENRANGELOOSE]:pm[bp.HYPHENRANGE];e=e.replace(a,zSr(this.options.includePrerelease)),ba("hyphen replace",e),e=e.replace(pm[bp.COMPARATORTRIM],ESr),ba("comparator trim",e),e=e.replace(pm[bp.TILDETRIM],PSr),ba("tilde trim",e),e=e.replace(pm[bp.CARETTRIM],TSr),ba("caret trim",e);let s=e.split(" ").map(d=>RSr(d,this.options)).join(" ").split(/\s+/).map(d=>BSr(d,this.options));i&&(s=s.filter(d=>(ba("loose invalid filter",d,this.options),!!d.match(pm[bp.COMPARATORLOOSE])))),ba("range list",s);let u=new Map,l=s.map(d=>new v0e(d,this.options));for(let d of l){if(lZe(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return uZe.set(n,c),c}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>cZe(n,r)&&e.set.some(o=>cZe(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 OSr(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(USr(this.set[r],e,this.options))return!0;return!1}};dZe.exports=_0e;var SSr=sZe(),uZe=new SSr,CSr=uQ(),v0e=f6(),ba=c6(),OSr=Cf(),{safeRe:pm,t:bp,comparatorTrimReplace:ESr,tildeTrimReplace:PSr,caretTrimReplace:TSr}=mB(),{FLAG_INCLUDE_PRERELEASE:ASr,FLAG_LOOSE:ISr}=l6(),lZe=t=>t.value==="<0.0.0-0",MSr=t=>t.value==="",cZe=(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},RSr=(t,e)=>(ba("comp",t,e),t=DSr(t,e),ba("caret",t),t=NSr(t,e),ba("tildes",t),t=FSr(t,e),ba("xrange",t),t=$Sr(t,e),ba("stars",t),t),_p=t=>!t||t.toLowerCase()==="x"||t==="*",NSr=(t,e)=>t.trim().split(/\s+/).map(r=>jSr(r,e)).join(" "),jSr=(t,e)=>{let r=e.loose?pm[bp.TILDELOOSE]:pm[bp.TILDE];return t.replace(r,(n,o,i,a,s)=>{ba("tilde",t,n,o,i,a,s);let u;return _p(o)?u="":_p(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:_p(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(ba("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,ba("tilde return",u),u})},DSr=(t,e)=>t.trim().split(/\s+/).map(r=>LSr(r,e)).join(" "),LSr=(t,e)=>{ba("caret",t,e);let r=e.loose?pm[bp.CARETLOOSE]:pm[bp.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{ba("caret",t,o,i,a,s,u);let l;return _p(i)?l="":_p(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:_p(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(ba("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`):(ba("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`),ba("caret return",l),l})},FSr=(t,e)=>(ba("replaceXRanges",t,e),t.split(/\s+/).map(r=>kSr(r,e)).join(" ")),kSr=(t,e)=>{t=t.trim();let r=e.loose?pm[bp.XRANGELOOSE]:pm[bp.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{ba("xRange",t,n,o,i,a,s,u);let l=_p(i),c=l||_p(a),d=c||_p(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`),ba("xRange return",n),n})},$Sr=(t,e)=>(ba("replaceStars",t,e),t.trim().replace(pm[bp.STAR],"")),BSr=(t,e)=>(ba("replaceGTE0",t,e),t.trim().replace(pm[e.includePrerelease?bp.GTE0PRE:bp.GTE0],"")),zSr=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(_p(n)?r="":_p(o)?r=`>=${n}.0.0${t?"-0":""}`:_p(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,_p(l)?u="":_p(c)?u=`<${+l+1}.0.0-0`:_p(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()),USr=(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(ba(t[n].semver),t[n].semver!==v0e.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 f6=x((lZn,yZe)=>{var p6=Symbol("SemVer ANY"),S0e=class t{static get ANY(){return p6}constructor(e,r){if(r=fZe(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),x0e("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===p6?this.value="":this.value=this.operator+this.semver.version,x0e("comp",this)}parse(e){let r=this.options.loose?pZe[mZe.COMPARATORLOOSE]:pZe[mZe.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 hZe(n[2],this.options.loose):this.semver=p6}toString(){return this.value}test(e){if(x0e("Comparator.test",e,this.options.loose),this.semver===p6||e===p6)return!0;if(typeof e=="string")try{e=new hZe(e,this.options)}catch{return!1}return w0e(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 gZe(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new gZe(this.value,r).test(e.semver):(r=fZe(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("=")||w0e(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||w0e(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};yZe.exports=S0e;var fZe=uQ(),{safeRe:pZe,t:mZe}=mB(),w0e=y0e(),x0e=c6(),hZe=Cf(),gZe=jg()});var m6=x((cZn,bZe)=>{var qSr=jg(),HSr=(t,e,r)=>{try{e=new qSr(e,r)}catch{return!1}return e.test(t)};bZe.exports=HSr});var vZe=x((dZn,_Ze)=>{var VSr=jg(),WSr=(t,e)=>new VSr(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));_Ze.exports=WSr});var xZe=x((fZn,wZe)=>{var KSr=Cf(),GSr=jg(),JSr=(t,e,r)=>{let n=null,o=null,i=null;try{i=new GSr(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new KSr(n,r))}),n};wZe.exports=JSr});var CZe=x((pZn,SZe)=>{var ZSr=Cf(),YSr=jg(),XSr=(t,e,r)=>{let n=null,o=null,i=null;try{i=new YSr(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new ZSr(n,r))}),n};SZe.exports=XSr});var PZe=x((mZn,EZe)=>{var C0e=Cf(),QSr=jg(),OZe=d6(),eCr=(t,e)=>{t=new QSr(t,e);let r=new C0e("0.0.0");if(t.test(r)||(r=new C0e("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 C0e(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||OZe(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||OZe(r,i))&&(r=i)}return r&&t.test(r)?r:null};EZe.exports=eCr});var AZe=x((hZn,TZe)=>{var tCr=jg(),rCr=(t,e)=>{try{return new tCr(t,e).range||"*"}catch{return null}};TZe.exports=rCr});var yQ=x((gZn,NZe)=>{var nCr=Cf(),RZe=f6(),{ANY:oCr}=RZe,iCr=jg(),aCr=m6(),IZe=d6(),MZe=fQ(),sCr=mQ(),uCr=pQ(),lCr=(t,e,r,n)=>{t=new nCr(t,n),e=new iCr(e,n);let o,i,a,s,u;switch(r){case">":o=IZe,i=sCr,a=MZe,s=">",u=">=";break;case"<":o=MZe,i=uCr,a=IZe,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(aCr(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===oCr&&(p=new RZe(">=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};NZe.exports=lCr});var DZe=x((yZn,jZe)=>{var cCr=yQ(),dCr=(t,e,r)=>cCr(t,e,">",r);jZe.exports=dCr});var FZe=x((bZn,LZe)=>{var fCr=yQ(),pCr=(t,e,r)=>fCr(t,e,"<",r);LZe.exports=pCr});var BZe=x((_Zn,$Ze)=>{var kZe=jg(),mCr=(t,e,r)=>(t=new kZe(t,r),e=new kZe(e,r),t.intersects(e,r));$Ze.exports=mCr});var UZe=x((vZn,zZe)=>{var hCr=m6(),gCr=Ng();zZe.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>gCr(c,d,r));for(let c of a)hCr(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 GZe=x((wZn,KZe)=>{var qZe=jg(),E0e=f6(),{ANY:O0e}=E0e,h6=m6(),P0e=Ng(),yCr=(t,e,r={})=>{if(t===e)return!0;t=new qZe(t,r),e=new qZe(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=_Cr(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},bCr=[new E0e(">=0.0.0-0")],HZe=[new E0e(">=0.0.0")],_Cr=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===O0e){if(e.length===1&&e[0].semver===O0e)return!0;r.includePrerelease?t=bCr:t=HZe}if(e.length===1&&e[0].semver===O0e){if(r.includePrerelease)return!0;e=HZe}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=VZe(o,p,r):p.operator==="<"||p.operator==="<="?i=WZe(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=P0e(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&&!h6(p,String(o),r)||i&&!h6(p,String(i),r))return null;for(let h of e)if(!h6(p,String(h),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=VZe(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!h6(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=WZe(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!h6(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)},VZe=(t,e,r)=>{if(!t)return e;let n=P0e(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},WZe=(t,e,r)=>{if(!t)return e;let n=P0e(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};KZe.exports=yCr});var XZe=x((xZn,YZe)=>{var T0e=mB(),JZe=l6(),vCr=Cf(),ZZe=p0e(),wCr=oj(),xCr=x7e(),SCr=C7e(),CCr=P7e(),OCr=I7e(),ECr=R7e(),PCr=j7e(),TCr=L7e(),ACr=k7e(),ICr=Ng(),MCr=U7e(),RCr=H7e(),NCr=dQ(),jCr=G7e(),DCr=Z7e(),LCr=d6(),FCr=fQ(),kCr=h0e(),$Cr=g0e(),BCr=pQ(),zCr=mQ(),UCr=y0e(),qCr=iZe(),HCr=f6(),VCr=jg(),WCr=m6(),KCr=vZe(),GCr=xZe(),JCr=CZe(),ZCr=PZe(),YCr=AZe(),XCr=yQ(),QCr=DZe(),eOr=FZe(),tOr=BZe(),rOr=UZe(),nOr=GZe();YZe.exports={parse:wCr,valid:xCr,clean:SCr,inc:CCr,diff:OCr,major:ECr,minor:PCr,patch:TCr,prerelease:ACr,compare:ICr,rcompare:MCr,compareLoose:RCr,compareBuild:NCr,sort:jCr,rsort:DCr,gt:LCr,lt:FCr,eq:kCr,neq:$Cr,gte:BCr,lte:zCr,cmp:UCr,coerce:qCr,Comparator:HCr,Range:VCr,satisfies:WCr,toComparators:KCr,maxSatisfying:GCr,minSatisfying:JCr,minVersion:ZCr,validRange:YCr,outside:XCr,gtr:QCr,ltr:eOr,intersects:tOr,simplifyRange:rOr,subset:nOr,SemVer:vCr,re:T0e.re,src:T0e.src,tokens:T0e.t,SEMVER_SPEC_VERSION:JZe.SEMVER_SPEC_VERSION,RELEASE_TYPES:JZe.RELEASE_TYPES,compareIdentifiers:ZZe.compareIdentifiers,rcompareIdentifiers:ZZe.rcompareIdentifiers}});function dE(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 oOr,QZe=b(()=>{oOr=j(XZe(),1)});async function cn(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}`;if(t.status===409)throw new A0e(o);let i=new Error(o);throw i.status=t.status,i}function tYe(t){return typeof t=="object"&&t!==null&&t.code===eYe}var A0e,eYe,bQ,I0e=b(()=>{A0e=class extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}};eYe="ERR_CONFLICTING_ENDPOINTS",bQ=class extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:eYe}),this.name="ConflictingEndpointsError"}}});function sOr(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function _Q(t){return aOr.encode(t)}function nYe(t){if(t&&typeof t=="object"&&t!==null){if(t instanceof Map)return Object.fromEntries(t);if(t instanceof Set)return Array.from(t);if(t instanceof Date)return t.toISOString();if(t instanceof RegExp)return t.toString();if(t instanceof Error)return{name:t.name,message:t.message}}else if(typeof t=="bigint")return t.toString();return t}function uOr(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return nYe(r)}}function mm(t,e,r,n,o){try{let i=JSON.stringify(t,uOr(r),n);return _Q(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?`
Context: ${e}`:""}`),_Q("[Unserializable]");ec("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?`
Context: ${e}`:""}`),typeof o>"u"&&(o=sOr()),R0e(t,"",0,[],void 0,0,o);let a;try{gB.length===0?a=JSON.stringify(t,r,n):a=JSON.stringify(t,lOr(r),n)}catch{return _Q("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;vQ.length!==0;){let s=vQ.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return _Q(a)}}function M0e(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),vQ.push([n,r,e,o])):gB.push([e,r,t]):(n[r]=t,vQ.push([n,r,e]))}function R0e(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){M0e(iOr,t,e,o);return}if(typeof a.depthLimit<"u"&&i>a.depthLimit){M0e(rYe,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){M0e(rYe,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s<t.length;s++)R0e(t[s],s,s,n,t,i,a);else{t=nYe(t);var u=Object.keys(t);for(s=0;s<u.length;s++){var l=u[s];R0e(t[l],l,s,n,t,i,a)}}n.pop()}}function lOr(t){return t=typeof t<"u"?t:function(e,r){return r},function(e,r){if(gB.length>0)for(var n=0;n<gB.length;n++){var o=gB[n];if(o[1]===e&&o[0]===r){r=o[2],gB.splice(n,1);break}}return t.call(this,e,r)}}var rYe,iOr,vQ,gB,aOr,oYe=b(()=>{uE();rYe="[...]",iOr={result:"[Circular]"},vQ=[],gB=[],aOr=new TextEncoder});function iYe(t){let e=YX(),r=qJe(),n=t.extra??{},o=n.metadata;return t.extra={...n,runtime:{...e,...n?.runtime},metadata:{...r,...r.revision_id||"revision_id"in t&&t.revision_id?{revision_id:("revision_id"in t?t.revision_id:void 0)??r.revision_id}:{},...o}},t}async function fOr(t){let e=[];for await(let r of t)e.push(r);return e}function N0e(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function aYe(t){return typeof t=="number"?Number(t.toFixed(4)):t}function uYe(t){return"dataset_id"in t||"dataset_name"in t}var cOr,dOr,pOr,j0e,mOr,hOr,sYe,nj,Hwe=b(()=>{ej();KJe();t0e();o7e();i7e();uE();ZX();a7e();c0e();QZe();I0e();GX();oYe();cOr=t=>{let e=t?.toString()??ec("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},dOr=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};pOr=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};j0e=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=mm(e.item,`Serializing run with id: ${e.item.id}`).length;return this.items.push({action:e.action,payload:e.item,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,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,otelContext:o.otelContext,apiKey:o.apiKey,apiUrl:o.apiUrl})),()=>r.forEach(o=>o.itemPromiseResolve())]}},mOr=20971520,hOr=2500,sYe="https://api.smith.langchain.com",nj=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 j0e}),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:Sh("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,"langSmithToOTELTranslator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Sh("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=cOr(e.tracingSamplingRate),this.apiUrl=N0e(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=N0e(e.apiKey??r.apiKey),this.webUrl=N0e(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.timeout_ms=e.timeout_ms??9e4,this.caller=new u6({...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 u6({maxRetries:2,maxConcurrency:this.traceBatchConcurrency,...e.callerOptions??{},onFailedResponseHook:pOr,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,XX()&&(this.langSmithToOTELTranslator=new eQ)}static getDefaultClientConfig(){let e=ec("API_KEY"),r=ec("ENDPOINT")??sYe,n=ec("HIDE_INPUTS")==="true",o=ec("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:dOr(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/${JX}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),e}_getPlatformEndpointPath(e){return this.apiUrl.slice(-3)!=="/v1"&&this.apiUrl.slice(-4)!=="/v1/"?`/v1/platform/${e}`:`/platform/${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(Gt(this.debug),o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(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(Gt(this.debug),a,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(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(Gt(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.trace_id)?o.id===o.trace_id&&this.filteredPostUuids.delete(o.trace_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??mOr}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=n.reduce((u,l)=>{let c=l.apiUrl??this.apiUrl,d=l.apiKey??this.apiKey,p=l.apiKey===this.apiKey&&l.apiUrl===this.apiUrl?"default":`${c}|${d}`;return u[p]||(u[p]=[]),u[p].push(l),u},{}),a=[];for(let[u,l]of Object.entries(i)){let c=this._processBatch(l,{apiUrl:u==="default"?void 0:u.split("|")[0],apiKey:u==="default"?void 0:u.split("|")[1]});a.push(c)}let s=Promise.all(a).finally(o);r.push(s)}return Promise.all(r)}async _processBatch(e,r){if(e.length)try{if(this.langSmithToOTELTranslator!==void 0)this._sendBatchToOTELTranslator(e);else{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,r):await this.batchIngestRuns(n,r)}}catch(n){console.error("Error exporting batch:",n)}}_sendBatchToOTELTranslator(e){if(this.langSmithToOTELTranslator!==void 0){let r=new Map,n=[];for(let o of e)o.item.id&&o.otelContext&&(r.set(o.item.id,o.otelContext),o.action==="create"?n.push({operation:"post",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}):n.push({operation:"patch",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}));this.langSmithToOTELTranslator.exportBatch(n,r)}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.item=iYe(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 this.caller.call(Gt(this.debug),`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(hOr),...this.fetchOptions});await cn(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(e){console.warn(`[WARNING]: LangSmith failed to fetch info on supported operations with status code ${e.status}. 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)}_cloneCurrentOTELContext(){let e=QX(),r=VJe();if(this.langSmithToOTELTranslator!==void 0){let n=e.getActiveSpan();if(n)return e.setSpan(r.active(),n)}}async createRun(e,r){if(!this._filterForSampling([e]).length)return;let n={...this.headers,"Content-Type":"application/json"},o=e.project_name;delete e.project_name;let i=await this.prepareRunCreateOrUpdateInputs({session_name:o,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&i.trace_id!==void 0&&i.dotted_order!==void 0){let u=this._cloneCurrentOTELContext();this.processRunOperation({action:"create",item:i,otelContext:u,apiKey:r?.apiKey,apiUrl:r?.apiUrl}).catch(console.error);return}let a=iYe(i);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey);let s=await this.caller.call(Gt(this.debug),`${r?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,body:mm(a,`Creating run with id: ${a.id}`),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(s,"create run",!0)}async batchIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o=await Promise.all(e?.map(u=>this.prepareRunCreateOrUpdateInputs(u))??[]),i=await Promise.all(r?.map(u=>this.prepareRunCreateOrUpdateInputs(u))??[]);if(o.length>0&&i.length>0){let u=o.reduce((c,d)=>(d.id&&(c[d.id]=d),c),{}),l=[];for(let c of i)c.id!==void 0&&u[c.id]?u[c.id]={...u[c.id],...c}:l.push(c);o=Object.values(u),i=l}let a={post:o,patch:i};if(!a.post.length&&!a.patch.length)return;let s={post:[],patch:[]};for(let u of["post","patch"]){let l=u,c=a[l].reverse(),d=c.pop();for(;d!==void 0;)s[l].push(d),d=c.pop()}if(s.post.length>0||s.patch.length>0){let u=s.post.map(l=>l.id).concat(s.patch.map(l=>l.id)).join(",");await this._postBatchIngestRuns(mm(s,`Ingesting runs with ids: ${u}`),n)}}async _postBatchIngestRuns(e,r){let n={...this.headers,"Content-Type":"application/json",Accept:"application/json"};r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey);let o=await this.batchIngestCaller.call(Gt(this.debug),`${r?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,body:e,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(o,"batch create run",!0)}async multipartIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o={},i=[];for(let d of e??[]){let f=await this.prepareRunCreateOrUpdateInputs(d);f.id!==void 0&&f.attachments!==void 0&&(o[f.id]=f.attachments),delete f.attachments,i.push(f)}let a=[];for(let d of r??[])a.push(await this.prepareRunCreateOrUpdateInputs(d));if(i.find(d=>d.trace_id===void 0||d.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(a.find(d=>d.trace_id===void 0||d.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(i.length>0&&a.length>0){let d=i.reduce((p,h)=>(h.id&&(p[h.id]=h),p),{}),f=[];for(let p of a)p.id!==void 0&&d[p.id]?d[p.id]={...d[p.id],...p}:f.push(p);i=Object.values(d),a=f}if(i.length===0&&a.length===0)return;let l=[],c=[];for(let[d,f]of[["post",i],["patch",a]])for(let p of f){let{inputs:h,outputs:m,events:g,attachments:y,..._}=p,w={inputs:h,outputs:m,events:g},S=mm(_,`Serializing for multipart ingestion of run with id: ${_.id}`);c.push({name:`${d}.${_.id}`,payload:new Blob([S],{type:`application/json; length=${S.length}`})});for(let[C,E]of Object.entries(w)){if(E===void 0)continue;let P=mm(E,`Serializing ${C} for multipart ingestion of run with id: ${_.id}`);c.push({name:`${d}.${_.id}.${C}`,payload:new Blob([P],{type:`application/json; length=${P.length}`})})}if(_.id!==void 0){let C=o[_.id];if(C){delete o[_.id];for(let[E,P]of Object.entries(C)){let T,I;if(Array.isArray(P)?[T,I]=P:(T=P.mimeType,I=P.data),E.includes(".")){console.warn(`Skipping attachment '${E}' for run ${_.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}c.push({name:`attachment.${_.id}.${E}`,payload:new Blob([I],{type:`${T}; length=${I.byteLength}`})})}}}l.push(`trace=${_.trace_id},id=${_.id}`)}await this._sendMultipartRequest(c,l.join("; "),n)}async _createNodeFetchBody(e,r){let n=[];for(let a of e)n.push(new Blob([`--${r}\r
`])),n.push(new Blob([`Content-Disposition: form-data; name="${a.name}"\r
`,`Content-Type: ${a.payload.type}\r
\r
`])),n.push(a.payload),n.push(new Blob([`\r
`]));return n.push(new Blob([`--${r}--\r
`])),await new Blob(n).arrayBuffer()}async _createMultipartStream(e,r){let n=new TextEncoder;return new ReadableStream({async start(i){let a=async s=>{typeof s=="string"?i.enqueue(n.encode(s)):i.enqueue(s)};for(let s of e){await a(`--${r}\r
`),await a(`Content-Disposition: form-data; name="${s.name}"\r
`),await a(`Content-Type: ${s.payload.type}\r
\r
`);let l=s.payload.stream().getReader();try{let c;for(;!(c=await l.read()).done;)i.enqueue(c.value)}finally{l.releaseLock()}await a(`\r
`)}await a(`--${r}--\r
`),i.close()}})}async _sendMultipartRequest(e,r,n){let o="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),i=zJe(),a=()=>this._createNodeFetchBody(e,o),s=()=>this._createMultipartStream(e,o),u=async l=>{let c={...this.headers,"Content-Type":`multipart/form-data; boundary=${o}`};return n?.apiKey!==void 0&&(c["x-api-key"]=n.apiKey),this.batchIngestCaller.call(Gt(this.debug),`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:c,body:l,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})};try{let l,c=!1;!i&&!this.multipartStreamingDisabled?(c=!0,l=await u(await s())):l=await u(await a()),(!this.multipartStreamingDisabled||c)&&l.status===422&&(n?.apiUrl??this.apiUrl)!==sYe&&(console.warn(`Streaming multipart upload to ${n?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${r}".`),this.multipartStreamingDisabled=!0,l=await u(await a())),await cn(l,"ingest multipart runs",!0)}catch(l){console.warn(`${l.message.trim()}
Context: ${r}`)}}async updateRun(e,r,n){on(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let o={...r,id:e};if(!this._filterForSampling([o],!0).length)return;if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){let s=this._cloneCurrentOTELContext();if(r.end_time!==void 0&&o.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:o,otelContext:s,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}else this.processRunOperation({action:"update",item:o,otelContext:s,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}let i={...this.headers,"Content-Type":"application/json"};n?.apiKey!==void 0&&(i["x-api-key"]=n.apiKey);let a=await this.caller.call(Gt(this.debug),`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,body:mm(r,`Serializing payload to update run with id: ${e}`),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(a,"update run",!0)}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){on(e);let n=await this._get(`/runs/${e}`);return r&&(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:ec("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 fOr(this.listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),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.dotted_order?.startsWith(e.dotted_order??"")&&i.id!==e.id&&(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:h,traceFilter:m,treeFilter:g,limit:y,select:_,order:w}=e,S=[];if(r&&(S=Array.isArray(r)?r:[r]),n){let T=Array.isArray(n)?n:[n],I=await Promise.all(T.map(N=>this.readProject({projectName:N}).then(M=>M.id)));S.push(...I)}let C=["app_path","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"],E={session:S.length?S:null,run_type:c,reference_example:a,query:p,filter:h,trace_filter:m,tree_filter:g,execution_order:u,parent_run:o,start_time:s?s.toISOString():null,error:d,id:f,limit:y,trace:i,select:_||C,is_root:l,order:w},P=0;for await(let T of this._getCursorPaginatedList("/runs/query",E))if(y){if(P>=y)break;if(T.length+P>y){yield*T.slice(0,y-P);break}P+=T.length,yield*T}else yield*T}async*listGroupRuns(e){let{projectId:r,projectName:n,groupBy:o,filter:i,startTime:a,endTime:s,limit:u,offset:l}=e,d={session_id:r||(await this.readProject({projectName:n})).id,group_by:o,filter:i,start_time:a?a.toISOString():null,end_time:s?s.toISOString():null,limit:Number(u)||100},f=Number(l)||0,p="/runs/group",h=`${this.apiUrl}${p}`;for(;;){let m={...d,offset:f},g=Object.fromEntries(Object.entries(m).filter(([C,E])=>E!==void 0)),y=await this.caller.call(Gt(),h,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(g),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(y,`Failed to fetch ${p}`);let _=await y.json(),{groups:w,total:S}=_;if(w.length===0)break;for(let C of w)yield C;if(f+=w.length,f>=S)break}}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:h,isRoot:m,dataSourceType:g}){let y=a||[];i&&(y=[...a||[],...await Promise.all(i.map(E=>this.readProject({projectName:E}).then(P=>P.id)))]);let w=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:y,reference_example:s,start_time:u,end_time:l,error:c,query:d,filter:f,trace_filter:p,tree_filter:h,is_root:m,data_source_type:g}).filter(([E,P])=>P!==void 0));return await(await this.caller.call(Gt(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||As()};on(e);let i=await(await this.caller.call(Gt(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){on(e);let r=await this.caller.call(Gt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(r,"unshare run",!0)}async readRunSharedLink(e){on(e);let n=await(await this.caller.call(Gt(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 on(e),await(await this.caller.call(Gt(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),on(e);let o=await(await this.caller.call(Gt(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};on(e);let i=await(await this.caller.call(Gt(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){on(e);let r=await this.caller.call(Gt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(r,"unshare dataset",!0)}async readSharedDataset(e){return on(e),await(await this.caller.call(Gt(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(Gt(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: ${Array.isArray(a.detail)?a.detail.join(`
`):"Unspecified error"}`):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(Gt(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 cn(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(Gt(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 cn(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)on(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(Gt(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)on(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,on(n);let o=await this.caller.call(Gt(this.debug),`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(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(Gt(this.debug),u,{method:"POST",headers:this.headers,body:l,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(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(Gt(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 cn(u,"create dataset"),await u.json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e&&r)throw new Error("Must provide either datasetName or datasetId, not both");if(e)on(e),n+=`/${e}`;else if(r)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;on(i);let a=await this.caller.call(Gt(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 cn(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;on(a);let s=await this.caller.call(Gt(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 cn(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)on(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");let i=await this.caller.call(Gt(this.debug),this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(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),on(o);let i={tag:n},a=await this.caller.call(Gt(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 cn(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),on(r);let a=await this.caller.call(Gt(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 cn(a,"fetch similar examples"),(await a.json()).examples}async createExample(e,r,n){if(uYe(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;uYe(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]??As())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let _=e,w=_[0].dataset_id,S=_[0].dataset_name;if(w===void 0&&S===void 0)throw new Error("Must provide either datasetName or datasetId");if(w!==void 0&&S!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");w===void 0&&(w=(await this.readDataset({datasetName:S})).id);let C=await this._uploadExamplesMultipart(w,_);return await Promise.all(C.example_ids.map(P=>this.readExample(P)))}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,h=f;if(p===void 0&&h===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&h!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:h})).id);let m=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]})),g=await this._uploadExamplesMultipart(p,m);return await Promise.all(g.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=>u0e(a)?l0e(a):a),i=u0e(r)?l0e(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){on(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}),h=o?typeof o=="string"?o:o?.toISOString():void 0;h&&p.append("as_of",h);let m=a??!0;if(p.append("inline_s3_urls",m.toString()),n!==void 0)for(let y of n)p.append("id",y);if(i!==void 0)for(let y of i)p.append("splits",y);if(s!==void 0){let y=JSON.stringify(s);p.append("metadata",y)}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(y=>p.append("select",y));let g=0;for await(let y of this._getPaginated("/examples",p)){for(let _ of y){let{attachment_urls:w,...S}=_,C=S;w&&(C.attachments=Object.entries(w).reduce((E,[P,T])=>(E[P.slice(11)]={presigned_url:T.presigned_url,mime_type:T.mime_type||void 0},E),{})),yield C,g++}if(u!==void 0&&g>=u)break}}async deleteExample(e){on(e);let r=`/examples/${e}`,n=await this.caller.call(Gt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(n,`delete ${r}`),await n.json()}async updateExample(e,r){let n;r?n=e:n=e.id,on(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,on(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(Gt(this.debug),`${this.apiUrl}/datasets/${i}/version?${a.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(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,on(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,on(a);let s={split_name:n,examples:o.map(l=>(on(l),l)),remove:i},u=await this.caller.call(Gt(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 cn(u,"update dataset splits",!0)}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){sQ("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 h={type:u??"api",metadata:s??{}};l!==void 0&&h?.metadata!==void 0&&!h.metadata.__run&&(h.metadata.__run={run_id:l}),h?.metadata!==void 0&&h.metadata.__run?.run_id!==void 0&&on(h.metadata.__run.run_id);let m={id:c??As(),run_id:e,key:r,score:aYe(n),value:o,correction:i,comment:a,feedback_source:h,comparative_experiment_id:p,feedbackConfig:d,session_id:f},g=`${this.apiUrl}/feedback`,y=await this.caller.call(Gt(this.debug),g,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(m),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(y,"create feedback",!0),m}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let a={};r!=null&&(a.score=aYe(r)),n!=null&&(a.value=n),o!=null&&(a.correction=o),i!=null&&(a.comment=i),on(e);let s=await this.caller.call(Gt(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 cn(s,"update feedback",!0)}async readFeedback(e){on(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){on(e);let r=`/feedback/${e}`,n=await this.caller.call(Gt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(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(Gt(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(Gt(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){on(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)=>{on(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,rubricInstructions:i}=e,a={name:r,description:n,id:o||As(),rubric_instructions:i},s=await this.caller.call(Gt(this.debug),`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(Object.fromEntries(Object.entries(a).filter(([l,c])=>c!==void 0))),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(s,"create annotation queue"),await s.json()}async readAnnotationQueue(e){let r=await this.caller.call(Gt(this.debug),`${this.apiUrl}/annotation-queues/${on(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(r,"read annotation queue"),await r.json()}async updateAnnotationQueue(e,r){let{name:n,description:o,rubricInstructions:i}=r,a=await this.caller.call(Gt(this.debug),`${this.apiUrl}/annotation-queues/${on(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify({name:n,description:o,rubric_instructions:i}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(a,"update annotation queue")}async deleteAnnotationQueue(e){let r=await this.caller.call(Gt(this.debug),`${this.apiUrl}/annotation-queues/${on(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(r,"delete annotation queue")}async addRunsToAnnotationQueue(e,r){let n=await this.caller.call(Gt(this.debug),`${this.apiUrl}/annotation-queues/${on(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(r.map((o,i)=>on(o,`runIds[${i}]`).toString())),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(n,"add runs to annotation queue")}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${on(e,"queueId")}/run`,o=await this.caller.call(Gt(this.debug),`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(o,"get run from annotation queue"),await o.json()}async deleteRunFromAnnotationQueue(e,r){let n=await this.caller.call(Gt(this.debug),`${this.apiUrl}/annotation-queues/${on(e,"queueId")}/runs/${on(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await cn(n,"delete run from annotation queue")}async getSizeFromAnnotationQueue(e){let r=await this.caller.call(Gt(this.debug),`${this.apiUrl}/annotation-queues/${on(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await cn(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(Gt(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]=dE(e),a=await this.caller.call(Gt(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 cn(a,`${r?"like":"unlike"} prompt`),await a.json()}async _getPromptUrl(e){let[r,n,o]=dE(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]=dE(e),i=await this.caller.call(Gt(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 cn(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]=dE(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(Gt(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 cn(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]=dE(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(Gt(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 cn(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=mm(l,`Serializing body for example with id: ${u}`),d=new Blob([c],{type:"application/json"});if(n.append(u,d),s.inputs){let f=mm(s.inputs,`Serializing inputs for example with id: ${u}`),p=new Blob([f],{type:"application/json"});n.append(`${u}.inputs`,p)}if(s.outputs){let f=mm(s.outputs,`Serializing outputs whle updating example with id: ${u}`),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 h,m;Array.isArray(p)?[h,m]=p:(h=p.mimeType,m=p.data);let g=new Blob([m],{type:`${h}; length=${m.byteLength}`});n.append(`${u}.attachment.${f}`,g)}if(s.attachments_operations){let f=mm(s.attachments_operations,`Serializing attachments while updating example with id: ${u}`),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(Gt(this.debug),`${this.apiUrl}${this._getPlatformEndpointPath(`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??As()).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=mm(u,`Serializing body for uploaded example with id: ${s}`),c=new Blob([l],{type:"application/json"});if(n.append(s,c),a.inputs){let d=mm(a.inputs,`Serializing inputs for uploaded example with id: ${s}`),f=new Blob([d],{type:"application/json"});n.append(`${s}.inputs`,f)}if(a.outputs){let d=mm(a.outputs,`Serializing outputs for uploaded example with id: ${s}`),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,h;Array.isArray(f)?[p,h]=f:(p=f.mimeType,h=f.data);let m=new Blob([h],{type:`${p}; length=${h.byteLength}`});n.append(`${s}.attachment.${d}`,m)}}let o=await this.caller.call(Gt(this.debug),`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this.headers,body:n});return await cn(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]=dE(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(Gt(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 cn(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]=dE(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return await(await this.caller.call(Gt(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]=dE(e),a=await this.caller.call(Gt(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 cn(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 on(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}`)}}async awaitPendingTraceBatches(){if(this.manualFlushMode)return console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve();await Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()]),this.langSmithToOTELTranslator!==void 0&&await WJe()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}}});var lYe,cYe=b(()=>{uE();lYe=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>ec(r)==="true")});var wQ,dYe=b(()=>{wQ=Symbol.for("lc:context_variables")});function gOr(t){return t.replace(/[-:.]/g,"")}function D0e(t,e,r=1){let n=r.toFixed(0).slice(0,3).padStart(3,"0"),o=`${new Date(t).toISOString().slice(0,-1)}${n}Z`;return{dottedOrder:gOr(o)+e,microsecondPrecisionDatestring:o}}function pYe(t){return t!==void 0&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function mYe(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function fYe(t){return Array.isArray(t)&&t.some(e=>mYe(e))}function yOr(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function bOr(t){return t!==void 0&&typeof t.callbacks=="object"&&(fYe(t.callbacks?.handlers)||fYe(t.callbacks))}function _Or(t){return t.split(".").map(r=>{let n=r.slice(0,-36),o=r.slice(-36),i=parseInt(n.slice(0,4)),a=parseInt(n.slice(4,6))-1,s=parseInt(n.slice(6,8)),u=parseInt(n.slice(9,11)),l=parseInt(n.slice(11,13)),c=parseInt(n.slice(13,15)),d=parseInt(n.slice(15,21));return[new Date(i,a,s,u,l,c,d/1e3),o]})}function vOr(){let t=Sh("LANGSMITH_RUNS_ENDPOINTS");if(!t)return[];try{let e=JSON.parse(t);if(Array.isArray(e)){let r=[];for(let n of e){if(typeof n!="object"||n===null){console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got ${typeof n}`);continue}if(typeof n.api_url!="string"){console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_url}`);continue}if(typeof n.api_key!="string"){console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_key}`);continue}r.push({apiUrl:n.api_url.replace(/\/$/,""),apiKey:n.api_key})}return r}else if(typeof e=="object"&&e!==null){xOr(e);let r=[];for(let[n,o]of Object.entries(e)){let i=n.replace(/\/$/,"");if(typeof o=="string")r.push({apiUrl:i,apiKey:o});else{console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${n}: expected string, got ${typeof o}`);continue}}return r}else return console.warn(`Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey, got ${typeof e}`),[]}catch(e){if(tYe(e))throw e;return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey"),[]}}function wOr(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):vOr()}function xOr(t){if(Object.keys(t).length>0&&ec("ENDPOINT"))throw new bQ}var xQ,Ob,Vwe=b(()=>{ej();Hwe();cYe();I0e();dYe();uE();qwe();uE();c0e();xQ=class t{constructor(e,r,n,o){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}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n,this.replicas=o}static fromHeader(e){let r=e.split(","),n={},o=[],i,a;for(let s of r){let[u,l]=s.split("="),c=decodeURIComponent(l);u==="langsmith-metadata"?n=JSON.parse(c):u==="langsmith-tags"?o=c.split(","):u==="langsmith-project"?i=c:u==="langsmith-replicas"&&(a=JSON.parse(c))}return new t(n,o,i,a)}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(",")}},Ob=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,"parent_run_id",{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}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),pYe(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.replicas=wOr(this.replicas),this.execution_order??(this.execution_order=1),this.child_execution_order??(this.child_execution_order=1),!this.dotted_order){let{dottedOrder:s,microsecondPrecisionDatestring:u}=D0e(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+s:this.dotted_order=s,this._serialized_start_time=u}}set metadata(e){this.extra={...this.extra,metadata:{...this.extra?.metadata,...e}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){return{id:As(),run_type:"chain",project_name:a6(),child_runs:[],api_url:Sh("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Sh("LANGCHAIN_API_KEY"),caller_options:{},start_time:Date.now(),serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new nj),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=new t({...e,parent_run:this,project_name:this.project_name,replicas:this.replicas,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});wQ in this&&(n[wQ]=this[wQ]);let o=Symbol.for("lc:child_config"),i=e.extra?.[o]??this.extra[o];if(bOr(i)){let u={...i},l=yOr(u.callbacks)?u.callbacks.copy?.():void 0;l&&(Object.assign(l,{_parentRunId:n.id}),l.handlers?.find(mYe)?.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?.library===void 0&&(o.runtime||(o.runtime={}),r))for(let[s,u]of Object.entries(r))o.runtime[s]||(o.runtime[s]=u);let i,a;return n?(a=e.parent_run?.id??e.parent_run_id,i=[]):(i=e.child_runs.map(s=>this._convertToCreate(s,r,n)),a=void 0),{id:e.id,name:e.name,start_time:e._serialized_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,events:e.events}}_remapForProject(e,r,n=!0){let o=this._convertToCreate(this,r,n);if(e===this.project_name)return o;let i=d=>kX(`${d}:${e}`,kX.DNS),a=i(o.id),s=o.trace_id?i(o.trace_id):void 0,u=o.parent_run_id?i(o.parent_run_id):void 0,l;if(o.dotted_order){let d=_Or(o.dotted_order),f=[];for(let h=0;h<d.length-1;h++){let[m,g]=d[h],y=i(g);f.push(m.toISOString().replace(/[-:]/g,"").replace(".","")+y)}let[p]=d[d.length-1];f.push(p.toISOString().replace(/[-:]/g,"").replace(".","")+a),l=f.join(".")}else l=void 0;return{...o,id:a,trace_id:s,parent_run_id:u,dotted_order:l,session_name:e}}async postRun(e=!0){try{let r=YX();if(this.replicas&&this.replicas.length>0)for(let{projectName:n,apiKey:o,apiUrl:i}of this.replicas){let a=this._remapForProject(n??this.project_name,r,!0);await this.client.createRun(a,{apiKey:o,apiUrl:i})}else{let n=this._convertToCreate(this,r,e);await this.client.createRun(n)}if(!e){sQ("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let n of this.child_runs)await n.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(){if(this.replicas&&this.replicas.length>0)for(let{projectName:e,apiKey:r,apiUrl:n,updates:o}of this.replicas){let i=this._remapForProject(e??this.project_name);await this.client.updateRun(i.id,{inputs:i.inputs,outputs:i.outputs,error:i.error,parent_run_id:i.parent_run_id,session_name:i.session_name,reference_example_id:i.reference_example_id,end_time:i.end_time,dotted_order:i.dotted_order,trace_id:i.trace_id,events:i.events,tags:i.tags,extra:i.extra,attachments:this.attachments,...o},{apiKey:r,apiUrl:n})}else try{let e={end_time:this.end_time,error:this.error,inputs:this.inputs,outputs:this.outputs,parent_run_id:this.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=lYe();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=xQ.fromHeader(n.baggage);u.metadata=l.metadata,u.tags=l.tags,u.project_name=l.project_name,u.replicas=l.replicas}return new t(u)}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new xQ(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(Ob,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});var SQ=b(()=>{Vwe()});var gYe=x((eYn,hYe)=>{"use strict";hYe.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 SYe=x((tYn,L0e)=>{"use strict";var SOr=/[\p{Lu}]/u,COr=/[\p{Ll}]/u,yYe=/^[\p{Lu}](?![\p{Lu}])/gu,vYe=/([\p{Alpha}\p{N}_]|$)/u,wYe=/[_.\- ]+/,OOr=new RegExp("^"+wYe.source),bYe=new RegExp(wYe.source+vYe.source,"gu"),_Ye=new RegExp("\\d+"+vYe.source,"gu"),EOr=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a<t.length;a++){let s=t[a];n&&SOr.test(s)?(t=t.slice(0,a)+"-"+t.slice(a),n=!1,i=o,o=!0,a++):o&&i&&COr.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},POr=(t,e)=>(yYe.lastIndex=0,t.replace(yYe,r=>e(r))),TOr=(t,e)=>(bYe.lastIndex=0,_Ye.lastIndex=0,t.replace(bYe,(r,n)=>e(n)).replace(_Ye,r=>e(r))),xYe=(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=EOr(t,r,n)),t=t.replace(OOr,""),e.preserveConsecutiveUppercase?t=POr(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),TOr(t,n))};L0e.exports=xYe;L0e.exports.default=xYe});function OYe(t,e){return e?.[t]||(0,CYe.default)(t)}function EYe(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var CYe,AOr,PYe=b(()=>{CYe=j(gYe(),1),AOr=j(SYe(),1)});function TYe(t){return Array.isArray(t)?[...t]:{...t}}function IOr(t,e){let r=TYe(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]=TYe(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function F0e(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 hm,ij=b(()=>{PYe();hm=class t{static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,F0e(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:EYe(Object.keys(r).length?IOr(n,r):n,OYe,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});function AYe(){return k0e===void 0&&(k0e={library:"langchain-js",runtime:CQ()}),k0e}function ct(t){try{return typeof process<"u"?process.env?.[t]:$0e()?Deno?.env.get(t):void 0}catch{return}}var MOr,ROr,NOr,$0e,jOr,CQ,k0e,aj=b(()=>{MOr=()=>typeof window<"u"&&typeof window.document<"u",ROr=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",NOr=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),$0e=()=>typeof Deno<"u",jOr=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!$0e(),CQ=()=>{let t;return MOr()?t="browser":jOr()?t="node":ROr()?t="webworker":NOr()?t="jsdom":$0e()?t="deno":t="other",t}});function z0e(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var B0e,sj,IYe,g6=b(()=>{ej();ij();aj();B0e=class{};sj=class t extends B0e{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,F0e(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:ct("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 hm.prototype.toJSON.call(this)}toJSONNotImplemented(){return hm.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class r extends t{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:As()}),Object.assign(this,e)}}return new r}},IYe=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});function q0e(t,e){if(t)return new Ob({...t,start_time:t._serialized_start_time??t.start_time,parent_run:q0e(e),child_runs:t.child_runs.map(r=>q0e(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:AYe()},tracingEnabled:!1})}function U0e(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function yB(t){return typeof t._addRunToRunMap=="function"}var DOr,Dg,uj=b(()=>{SQ();g6();aj();DOr=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};Dg=class extends sj{constructor(e){super(...arguments),Object.defineProperty(this,"runMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"runTreeMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"usesRunTreeMap",{enumerable:!0,configurable:!0,writable:!0,value:!1})}copy(){return this}getRunById(e){if(e!==void 0)return this.usesRunTreeMap?DOr(this.runTreeMap.get(e)):this.runMap.get(e)}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{dottedOrder:r,microsecondPrecisionDatestring:n}=D0e(new Date(e.start_time).getTime(),e.id,e.execution_order),o={...e},i=this.getRunById(o.parent_run_id);if(o.parent_run_id!==void 0?i&&(this._addChildRun(i,o),i.child_execution_order=Math.max(i.child_execution_order,o.child_execution_order),o.trace_id=i.trace_id,i.dotted_order!==void 0&&(o.dotted_order=[i.dotted_order,r].join("."),o._serialized_start_time=n)):(o.trace_id=o.id,o.dotted_order=r,o._serialized_start_time=n),this.usesRunTreeMap){let a=q0e(o,i);a!==void 0&&this.runTreeMap.set(o.id,a)}else this.runMap.set(o.id,o);return o}async _endTrace(e){let r=e.parent_run_id!==void 0&&this.getRunById(e.parent_run_id);r?r.child_execution_order=Math.max(r.child_execution_order,e.child_execution_order):await this.persistRun(e),await this.onRunUpdate?.(e),this.usesRunTreeMap?this.runTreeMap.delete(e.id):this.runMap.delete(e.id)}_getExecutionOrder(e){let r=e!==void 0&&this.getRunById(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.getRunById(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.getRunById(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.getRunById(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.getRunById(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.getRunById(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.getRunById(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.outputs=U0e(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=U0e(i.inputs,"input")),await this.onChainEnd?.(a),await this._endTrace(a),a}async handleChainError(e,r,n,o,i){let a=this.getRunById(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=U0e(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.getRunById(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.getRunById(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.getRunById(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.getRunById(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.getRunById(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.getRunById(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.getRunById(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.getRunById(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.getRunById(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.getRunById(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 jYe=x((pYn,NYe)=>{"use strict";var MYe=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,RYe=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function LOr(){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=MYe(),e.color.ansi16m=RYe(),e.bgColor.ansi256=MYe(10),e.bgColor.ansi16m=RYe(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(NYe,"exports",{enumerable:!0,get:LOr})});function vp(t,e){return`${t.open}${e}${t.close}`}function Lg(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function DYe(t){return typeof t=="string"?t.trim():t==null?t:Lg(t,t.toString())}function RA(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 H0e,gm,y6,LYe=b(()=>{H0e=j(jYe(),1);uj();({color:gm}=H0e.default),y6=class extends Dg{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?vp(H0e.default.bold,s):s}).join(" > ");return vp(gm.grey,n)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${vp(gm.green,"[chain/start]")} [${r}] Entering Chain run with input: ${Lg(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${vp(gm.cyan,"[chain/end]")} [${r}] [${RA(e)}] Exiting Chain run with output: ${Lg(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${vp(gm.red,"[chain/error]")} [${r}] [${RA(e)}] Chain run errored with error: ${Lg(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(`${vp(gm.green,"[llm/start]")} [${r}] Entering LLM run with input: ${Lg(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${vp(gm.cyan,"[llm/end]")} [${r}] [${RA(e)}] Exiting LLM run with output: ${Lg(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${vp(gm.red,"[llm/error]")} [${r}] [${RA(e)}] LLM run errored with error: ${Lg(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${vp(gm.green,"[tool/start]")} [${r}] Entering Tool run with input: "${DYe(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${vp(gm.cyan,"[tool/end]")} [${r}] [${RA(e)}] Exiting Tool run with output: "${DYe(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${vp(gm.red,"[tool/error]")} [${r}] [${RA(e)}] Tool run errored with error: ${Lg(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${vp(gm.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${Lg(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${vp(gm.cyan,"[retriever/end]")} [${r}] [${RA(e)}] Exiting Retriever run with output: ${Lg(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${vp(gm.red,"[retriever/error]")} [${r}] [${RA(e)}] Retriever run errored with error: ${Lg(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${vp(gm.blue,"[agent/action]")} [${n}] Agent selected action: ${Lg(r.actions[r.actions.length-1],"[action]")}`)}}});function NA(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var b6=b(()=>{});function jA(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function FYe(t){return!!(t&&typeof t=="object"&&"toolCall"in t&&t.toolCall!=null&&typeof t.toolCall=="object"&&"id"in t.toolCall&&typeof t.toolCall.id=="string")}var lj,OQ=b(()=>{lj=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 V0e(t,e=bB){t=t.trim();let r=t.indexOf("```");if(r===-1)return e(t);let n=t.substring(r+3);n.startsWith(`json
`)?n=n.substring(5):n.startsWith("json")?n=n.substring(4):n.startsWith(`
`)&&(n=n.substring(1));let o=n.indexOf("```"),i=n;return o!==-1&&(i=n.substring(0,o)),e(i.trim())}function bB(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 W0e=b(()=>{});function Eb(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function kYe(t){return Eb(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function $Ye(t){return Eb(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function BYe(t){if(Eb(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function K0e(t){let e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);let r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);let o={};for(let i of t.split(";").slice(1)){let a=i.split("=");if(a.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);let s=a[0].trim(),u=a[1].trim();if(s==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);o[s]=u}return{type:r,subtype:n,parameters:o}}function _B({dataUrl:t,asTypedArray:e=!1}){let r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let o=e?Uint8Array.from(atob(r[2]),i=>i.charCodeAt(0)):r[2];return{mime_type:n,data:o}}}function _6(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}var G0e=b(()=>{});function Fg(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.some(r=>Eb(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?v6(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>Eb(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function zYe(t,e){return t==="error"||e==="error"?"error":"success"}function FOr(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 Gs(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]=Gs(r[n],o);else if(Array.isArray(r[n]))r[n]=v6(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 v6(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]=Gs(r[o],n):r.push(n)}else{if(typeof n=="object"&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function UYe(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 v6(t,e);if(typeof t=="object"&&typeof e=="object")return Gs(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types.
Left ${t}
Right ${e}`)}function qYe(t){return typeof t.role=="string"}function kg(t){return typeof t?._getType=="function"}function J0e(t){return kg(t)&&typeof t.concat=="function"}var tc,ym,$g=b(()=>{ij();G0e();tc=class extends hm{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=FOr(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}};ym=class extends tc{}});function HYe(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function VYe(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 fE,Bg,vB=b(()=>{$g();fE=class extends tc{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,"metadata",{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,this.metadata=e.metadata}_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}}},Bg=class t extends ym{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:Fg(this.content,e.content),additional_kwargs:Gs(this.additional_kwargs,e.additional_kwargs),response_metadata:Gs(this.response_metadata,e.response_metadata),artifact:UYe(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:zYe(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function Vi(t){return t._getType()==="ai"}function Z0e(t){return t._getType()==="ai"}var Fn,xr,cj=b(()=>{W0e();$g();vB();Fn=class extends tc{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]=VYe(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}}};xr=class t extends ym{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=e.tool_call_chunks.reduce((a,s)=>{let u=s.id||`fallback-${s.index||0}`;return a[u]=a[u]??[],a[u].push(s),a},{}),o=[],i=[];for(let[a,s]of Object.entries(n)){let u={},l=s[0]?.name??"",c=s.map(p=>p.args||"").join(""),d=c.length?c:"{}",f=s[0]?.id||a;try{if(u=bB(d),u===null||typeof u!="object"||Array.isArray(u))throw new Error("Malformed tool call chunk args.");o.push({name:l,args:u,id:f,type:"tool_call"})}catch{i.push({name:l,args:d,id:f,error:"Malformed args.",type:"invalid_tool_call"})}}r={...e,tool_calls:o,invalid_tool_calls:i,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:Fg(this.content,e.content),additional_kwargs:Gs(this.additional_kwargs,e.additional_kwargs),response_metadata:Gs(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=v6(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 Js,wp,EQ=b(()=>{$g();Js=class t extends tc{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}}},wp=class t extends ym{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:Fg(this.content,e.content),additional_kwargs:Gs(this.additional_kwargs,e.additional_kwargs),response_metadata:Gs(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}get _printableFields(){return{...super._printableFields,role:this.role}}}});var Ch,PQ=b(()=>{$g();Ch=class t extends ym{static lc_name(){return"FunctionMessageChunk"}_getType(){return"function"}concat(e){return new t({content:Fg(this.content,e.content),additional_kwargs:Gs(this.additional_kwargs,e.additional_kwargs),response_metadata:Gs(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});var Zs,xp,w6=b(()=>{$g();Zs=class extends tc{static lc_name(){return"HumanMessage"}_getType(){return"human"}constructor(e,r){super(e,r)}},xp=class t extends ym{static lc_name(){return"HumanMessageChunk"}_getType(){return"human"}constructor(e,r){super(e,r)}concat(e){return new t({content:Fg(this.content,e.content),additional_kwargs:Gs(this.additional_kwargs,e.additional_kwargs),response_metadata:Gs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});var pE,Of,TQ=b(()=>{$g();pE=class extends tc{static lc_name(){return"SystemMessage"}_getType(){return"system"}constructor(e,r){super(e,r)}},Of=class t extends ym{static lc_name(){return"SystemMessageChunk"}_getType(){return"system"}constructor(e,r){super(e,r)}concat(e){return new t({content:Fg(this.content,e.content),additional_kwargs:Gs(this.additional_kwargs,e.additional_kwargs),response_metadata:Gs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});function $Or(t){return jA(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 BOr(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function Y0e(t){let e,r;if(BOr(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 Zs(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new Fn(r);let i=n.map($Or);return new Fn({...o,tool_calls:i})}else{if(e==="system")return new pE(r);if(e==="developer")return new pE({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new fE({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});throw NA(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 Pb(t){if(typeof t=="string")return new Zs(t);if(kg(t))return t;if(Array.isArray(t)){let[e,r]=t;return Y0e({type:e,content:r})}else if(qYe(t)){let{role:e,...r}=t;return Y0e({...r,type:e})}else return Y0e(t)}function Sp(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 X0e(t){let e=t._getType();if(e==="human")return new xp({...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 xr({...r})}else{if(e==="system")return new Of({...t});if(e==="function")return new Ch({...t});if(Js.isInstance(t))return new wp({...t});throw new Error("Unknown message type.")}}var DA=b(()=>{b6();OQ();cj();$g();EQ();PQ();w6();TQ();vB()});var AQ=b(()=>{ZX()});var Q0e,exe,txe=b(()=>{AQ();aj();exe=()=>{if(Q0e===void 0){let t=ct("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};Q0e=new nj(t)}return Q0e}});var wB,WYe=b(()=>{AQ();SQ();Dwe();uj();txe();wB=class t extends Dg{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}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"usesRunTreeMap",{enumerable:!0,configurable:!0,writable:!0,value:!0});let{exampleId:r,projectName:n,client:o,replicas:i}=e;this.projectName=n??a6(),this.replicas=i,this.exampleId=r,this.client=o??exe();let a=t.getTraceableRunTree();a&&this.updateFromRunTree(a)}async persistRun(e){}async onRunCreate(e){await this.getRunTreeWithTracingConfig(e.id)?.postRun()}async onRunUpdate(e){await this.getRunTreeWithTracingConfig(e.id)?.patchRun()}getRun(e){return this.runTreeMap.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.runTreeMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.replicas=e.replicas??this.replicas,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}getRunTreeWithTracingConfig(e){let r=this.runTreeMap.get(e);if(r)return new Ob({...r,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return iJe(!0)}catch{return}}}});var KYe,dj,GYe,LA,x6=b(()=>{KYe=Symbol.for("ls:tracing_async_local_storage"),dj=Symbol.for("lc:context_variables"),GYe=t=>{globalThis[KYe]=t},LA=()=>globalThis[KYe]});function zOr(){let t="default"in IQ.default?IQ.default.default:IQ.default;return new t({autoStart:!0,concurrency:1})}function UOr(){return typeof S6>"u"&&(S6=zOr()),S6}async function Ys(t,e){if(e===!0){let r=LA();r!==void 0?await r.run(void 0,async()=>t()):await t()}else S6=UOr(),S6.add(async()=>{let r=LA();r!==void 0?await r.run(void 0,async()=>t()):await t()})}var IQ,S6,JYe=b(()=>{IQ=j(iQ(),1);x6();txe()});var ZYe=b(()=>{JYe()});var YYe,XYe=b(()=>{aj();YYe=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>ct(r)==="true")});function rxe(t){let e=LA();return e===void 0?void 0:e.getStore()?.[dj]?.[t]}var qOr,QYe,eXe=b(()=>{SQ();x6();qOr=Symbol("lc:configure_hooks"),QYe=()=>rxe(qOr)||[]});function O6(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function C6(t){return"name"in t?t:sj.fromMethods(t)}var nxe,xB,oxe,MQ,ixe,axe,mu,FA=b(()=>{ej();g6();LYe();DA();aj();WYe();ZYe();XYe();uj();eXe();nxe=class{setHandler(e){return this.setHandlers([e])}},xB=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=>Ys(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=>Ys(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)))}},oxe=class extends xB{getChild(e){let r=new mu(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=>Ys(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=>Ys(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)))}},MQ=class extends xB{async handleLLMNewToken(e,r,n,o,i,a){await Promise.all(this.handlers.map(s=>Ys(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=>Ys(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=>Ys(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)))}},ixe=class extends xB{getChild(e){let r=new mu(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=>Ys(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=>Ys(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=>Ys(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=>Ys(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)))}},axe=class extends xB{getChild(e){let r=new mu(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=>Ys(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=>Ys(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)))}},mu=class t extends nxe{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:As();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return yB(f)&&f._createRunForLLMStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),Ys(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 MQ(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:As();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return yB(f)&&f._createRunForChatModelStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),Ys(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=Sp(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 MQ(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=As(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreChain)return yB(u)&&u._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,s),Ys(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 ixe(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=As(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreAgent)return yB(u)&&u._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),Ys(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 axe(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=As(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreRetriever)return yB(u)&&u._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),Ys(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 oxe(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=>Ys(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 sj{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:As()}),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(C6)??[],!0)):u=e,u=u.copy(Array.isArray(r)?r.map(C6):r?.handlers,!1));let l=ct("LANGCHAIN_VERBOSE")==="true"||s?.verbose,c=wB.getTraceableRunTree()?.tracingEnabled||YYe(),d=c||(ct("LANGCHAIN_TRACING")??!1);if(l||d){if(u||(u=new t),l&&!u.handlers.some(f=>f.name===y6.prototype.name)){let f=new y6;u.addHandler(f,!0)}if(d&&!u.handlers.some(f=>f.name==="langchain_tracer")&&c){let f=new wB;u.addHandler(f,!0),u._parentRunId=wB.getTraceableRunTree()?.id??u._parentRunId}}for(let{contextVar:f,inheritable:p=!0,handlerClass:h,envVar:m}of QYe()){let g=m&&ct(m)==="true"&&h,y,_=f!==void 0?rxe(f):void 0;_&&IYe(_)?y=_:g&&(y=new h({})),y!==void 0&&(u||(u=new t),u.handlers.some(w=>w.name===y.name)||u.addHandler(y,p))}return(n||o)&&u&&(u.addTags(n??[]),u.addTags(o??[],!1)),(i||a)&&u&&(u.addMetadata(i??{}),u.addMetadata(a??{},!1)),u}}});var RQ,HOr,tXe,sxe,Cp,rXe=b(()=>{AQ();x6();FA();RQ=class{getStore(){}run(e,r){return r()}enterWith(e){}},HOr=new RQ,tXe=Symbol.for("lc:child_config"),sxe=class{getInstance(){return LA()??HOr}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[tXe]}runWithConfig(e,r,n){let o=mu._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.getRunTreeWithTracingConfig(s):n||(l=new Ob({name:"<runnable_lambda>",tracingEnabled:!1})),l&&(l.extra={...l.extra,[tXe]:e}),a!==void 0&&a[dj]!==void 0&&(l===void 0&&(l={}),l[dj]=a[dj]),i.run(l,r)}initializeGlobalInstance(e){LA()===void 0&&GYe(e)}},Cp=new sxe});var fj=b(()=>{rXe();x6()});async function bm(t){return mu._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function SB(...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(C6(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(C6(s),!0);e.callbacks=a}else e.callbacks=new mu(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 An(t){let e=Cp.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))VOr.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 Xs(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=An(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 zg(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 NQ,VOr,bv=b(()=>{FA();fj();NQ=25;VOr=new Set(["string","number","boolean"])});async function _v(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 uxe=b(()=>{});function lxe(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 Rc(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]=Rc(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function nXe(t,e,r,n,...o){let i=new mE({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var Ef,mE,vv=b(()=>{bv();fj();uxe();Ef=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)}})}};mE=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)=>{Cp.runWithConfig(zg(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?Cp.runWithConfig(zg(this.config),this.signal?async()=>_v(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 oXe(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 iXe(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 WOr(t){return t!==void 0&&t.message!==void 0}var Tb,E6,aXe,P6,sXe=b(()=>{Fwe();uj();vv();cj();Tb=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=MA({},r);return new E6({ops:r,state:n[n.length-1].newDocument})}},E6=class t extends Tb{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=MA(this.state,e.ops);return new t({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=MA({},e.ops);return new t({ops:e.ops,state:r[r.length-1].newDocument})}},aXe=t=>t.name==="log_stream_tracer";P6=class extends Dg{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=Ef.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 Tb({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 Tb({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 oXe(e,this._schemaFormat)),await this.writer.write(new Tb({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 oXe(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await iXe(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 Tb({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new Tb({ops:[{op:"replace",path:"/final_output",value:await iXe(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?WOr(n?.chunk)?a=n?.chunk:a=new xr({id:`run-${e.id}`,content:r}):a=r;let s=new Tb({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 T6,_m,so,CB=b(()=>{T6="__run",_m=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}})}},so=class t extends _m{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 jQ({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 uXe,DQ,lXe=b(()=>{uj();vv();cj();CB();uXe=t=>t.name==="event_stream_tracer",DQ=class extends Dg{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=Ef.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 _m({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=jQ(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 xr({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 _m({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=jQ(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=jQ(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=jQ(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 cXe,LQ,KOr,GOr,Oh,OB=b(()=>{cXe=j(jX(),1),LQ=j(iQ(),1),KOr=[400,401,402,403,404,405,406,407,409],GOr=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&&KOr.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},Oh=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??GOr;let r="default"in LQ.default?LQ.default.default:LQ.default;this.queue=new r({concurrency:this.maxConcurrency})}call(e,...r){return this.queue.add(()=>(0,cXe.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 A6,dXe=b(()=>{uj();A6=class extends Dg{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 I6(t){return t?t.lc_runnable:!1}var FQ,cxe=b(()=>{FQ=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}}});function dxe(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function ZOr(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n};
`;return e}function fXe(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",h={[p]:"{0}({1})"};n!==void 0&&(h[n]="{0}([{1}]):::first"),o!==void 0&&(h[o]="{0}([{1}]):::last");for(let[m,g]of Object.entries(t)){let y=g.name.split(":").pop()??"",w=JOr.some(C=>y.startsWith(C)&&y.endsWith(C))?`<p>${y}</p>`:y;Object.keys(g.metadata??{}).length&&(w+=`<hr/><small><em>${Object.entries(g.metadata??{}).map(([C,E])=>`${C} = ${E}`).join(`
`)}</em></small>`);let S=(h[m]??h[p]).replace("{0}",dxe(m)).replace("{1}",w);l+=` ${S}
`}}let c={};for(let p of e){let h=p.source.split(":"),m=p.target.split(":"),g=h.filter((y,_)=>y===m[_]).join(":");c[g]||(c[g]=[]),c[g].push(p)}let d=new Set;function f(p,h){let m=p.length===1&&p[0].source===p[0].target;if(h&&!m){let g=h.split(":").pop();if(d.has(g))throw new Error(`Found duplicate subgraph '${g}' -- 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(g),l+=` subgraph ${g}
`}for(let g of p){let{source:y,target:_,data:w,conditional:S}=g,C="";if(w!==void 0){let E=w,P=E.split(" ");P.length>u&&(E=Array.from({length:Math.ceil(P.length/u)},(T,I)=>P.slice(I*u,(I+1)*u).join(" ")).join("&nbsp;<br>&nbsp;")),C=S?` -. &nbsp;${E}&nbsp; .-> `:` -- &nbsp;${E}&nbsp; --> `}else C=S?" -.-> ":" --> ";l+=` ${dxe(y)}${C}${dxe(_)};
`}for(let g in c)g.startsWith(`${h}:`)&&g!==h&&f(c[g],g);h&&!m&&(l+=` end
`)}f(c[""]??[],"");for(let p in c)!p.includes(":")&&p!==""&&f(c[p],p);return a&&(l+=ZOr(i??{})),l}async function pXe(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 JOr,mXe=b(()=>{JOr=["*","_","`"]});function EB(t,e,r){function n(s,u){var l;Object.defineProperty(s,"_zod",{value:s._zod??{},enumerable:!1}),(l=s._zod).traits??(l.traits=new Set),s._zod.traits.add(t),e(s,u);for(let c in a.prototype)c in s||Object.defineProperty(s,c,{value:a.prototype[c].bind(s)});s._zod.constr=a,s._zod.def=u}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:t});function a(s){var u;let l=r?.Parent?new i:this;n(l,s),(u=l._zod).deferred??(u.deferred=[]);for(let c of l._zod.deferred)c();return l}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function PB(t){return t&&Object.assign(fxe,t),fxe}var oQn,iQn,kA,fxe,M6=b(()=>{oQn=Object.freeze({status:"aborted"});iQn=Symbol("zod_brand"),kA=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},fxe={}});function pxe(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function gXe(t,e){return typeof e=="bigint"?e.toString():e}function yXe(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function TB(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function bXe(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function $Q(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function kQ(t){return typeof t=="string"?t:t?.message}function AB(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=kQ(t.inst?._zod.def?.error?.(t))??kQ(e?.error?.(t))??kQ(r.customError?.(t))??kQ(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}var mxe,YOr,aQn,$A=b(()=>{mxe=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{},YOr=yXe(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});aQn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}});var _Xe,vXe,R6,hxe=b(()=>{M6();$A();_Xe=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,gXe,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},vXe=EB("$ZodError",_Xe),R6=EB("$ZodError",_Xe,{Parent:Error})});var QOr,BQ,eEr,wXe,tEr,xXe,rEr,SXe,gxe=b(()=>{M6();hxe();$A();QOr=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new kA;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>AB(u,i,PB())));throw mxe(s,o?.callee),s}return a.value},BQ=QOr(R6),eEr=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>AB(u,i,PB())));throw mxe(s,o?.callee),s}return a.value},wXe=eEr(R6),tEr=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new kA;return i.issues.length?{success:!1,error:new(t??vXe)(i.issues.map(a=>AB(a,o,PB())))}:{success:!0,data:i.value}},xXe=tEr(R6),rEr=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>AB(a,o,PB())))}:{success:!0,data:i.value}},SXe=rEr(R6)});var nEr,lQn,CXe=b(()=>{nEr="(?:(?:\\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])))",lQn=new RegExp(`^${nEr}$`)});var OXe=b(()=>{});var EXe=b(()=>{});var PXe,yxe=b(()=>{PXe={major:4,minor:0,patch:0}});var iEr,TXe,AXe=b(()=>{M6();gxe();$A();yxe();$A();iEr=EB("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=PXe;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(i,a,s)=>{let u=$Q(i),l;for(let c of a){if(c._zod.def.when){if(!c._zod.def.when(i))continue}else if(u)continue;let d=i.issues.length,f=c._zod.check(i);if(f instanceof Promise&&s?.async===!1)throw new kA;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==d&&(u||(u=$Q(i,d)))});else{if(i.issues.length===d)continue;u||(u=$Q(i,d))}}return l?l.then(()=>i):i};t._zod.run=(i,a)=>{let s=t._zod.parse(i,a);if(s instanceof Promise){if(a.async===!1)throw new kA;return s.then(u=>o(u,n,a))}return o(s,n,a)}}t["~standard"]={validate:o=>{try{let i=xXe(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return SXe(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),TXe=EB("$ZodNever",(t,e)=>{iEr.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)})});var IXe=b(()=>{});function sEr(){return new N6}var TQn,AQn,N6,wv,bxe=b(()=>{TQn=Symbol("ZodOutput"),AQn=Symbol("ZodInput"),N6=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};wv=sEr()});function MXe(t,e){return new t({type:"never",...bXe(e)})}var RXe=b(()=>{$A()});var NXe=b(()=>{});function j6(t,e){if(t instanceof N6){let n=new zQ(e),o={};for(let s of t._idmap.entries()){let[u,l]=s;n.process(l)}let i={},a={registry:t,uri:e?.uri,defs:o};for(let s of t._idmap.entries()){let[u,l]=s;i[u]=n.emit(l,{...e,external:a})}if(Object.keys(o).length>0){let s=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[s]:o}}return{schemas:i}}let r=new zQ(e);return r.process(t),r.emit(t,e)}function rc(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return rc(o.element,r);case"object":{for(let i in o.shape)if(rc(o.shape[i],r))return!0;return!1}case"union":{for(let i of o.options)if(rc(i,r))return!0;return!1}case"intersection":return rc(o.left,r)||rc(o.right,r);case"tuple":{for(let i of o.items)if(rc(i,r))return!0;return!!(o.rest&&rc(o.rest,r))}case"record":return rc(o.keyType,r)||rc(o.valueType,r);case"map":return rc(o.keyType,r)||rc(o.valueType,r);case"set":return rc(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return rc(o.innerType,r);case"lazy":return rc(o.getter(),r);case"default":return rc(o.innerType,r);case"prefault":return rc(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return rc(o.in,r)||rc(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var zQ,jXe=b(()=>{bxe();$A();zQ=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??wv,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},a=this.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,s);let u=e._zod.toJSONSchema?.();if(u)s.schema=u;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},f=e._zod.parent;if(f)s.ref=f,this.process(f,d),this.seen.get(f).isParent=!0;else{let p=s.schema;switch(o.type){case"string":{let h=p;h.type="string";let{minimum:m,maximum:g,format:y,patterns:_,contentEncoding:w}=e._zod.bag;if(typeof m=="number"&&(h.minLength=m),typeof g=="number"&&(h.maxLength=g),y&&(h.format=i[y]??y,h.format===""&&delete h.format),w&&(h.contentEncoding=w),_&&_.size>0){let S=[..._];S.length===1?h.pattern=S[0].source:S.length>1&&(s.schema.allOf=[...S.map(C=>({...this.target==="draft-7"?{type:"string"}:{},pattern:C.source}))])}break}case"number":{let h=p,{minimum:m,maximum:g,format:y,multipleOf:_,exclusiveMaximum:w,exclusiveMinimum:S}=e._zod.bag;typeof y=="string"&&y.includes("int")?h.type="integer":h.type="number",typeof S=="number"&&(h.exclusiveMinimum=S),typeof m=="number"&&(h.minimum=m,typeof S=="number"&&(S>=m?delete h.minimum:delete h.exclusiveMinimum)),typeof w=="number"&&(h.exclusiveMaximum=w),typeof g=="number"&&(h.maximum=g,typeof w=="number"&&(w<=g?delete h.maximum:delete h.exclusiveMaximum)),typeof _=="number"&&(h.multipleOf=_);break}case"boolean":{let h=p;h.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{p.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{p.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let h=p,{minimum:m,maximum:g}=e._zod.bag;typeof m=="number"&&(h.minItems=m),typeof g=="number"&&(h.maxItems=g),h.type="array",h.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let h=p;h.type="object",h.properties={};let m=o.shape;for(let _ in m)h.properties[_]=this.process(m[_],{...d,path:[...d.path,"properties",_]});let g=new Set(Object.keys(m)),y=new Set([...g].filter(_=>{let w=o.shape[_]._zod;return this.io==="input"?w.optin===void 0:w.optout===void 0}));y.size>0&&(h.required=Array.from(y)),o.catchall?._zod.def.type==="never"?h.additionalProperties=!1:o.catchall?o.catchall&&(h.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(h.additionalProperties=!1);break}case"union":{let h=p;h.anyOf=o.options.map((m,g)=>this.process(m,{...d,path:[...d.path,"anyOf",g]}));break}case"intersection":{let h=p,m=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),g=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),y=w=>"allOf"in w&&Object.keys(w).length===1,_=[...y(m)?m.allOf:[m],...y(g)?g.allOf:[g]];h.allOf=_;break}case"tuple":{let h=p;h.type="array";let m=o.items.map((_,w)=>this.process(_,{...d,path:[...d.path,"prefixItems",w]}));if(this.target==="draft-2020-12"?h.prefixItems=m:h.items=m,o.rest){let _=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?h.items=_:h.additionalItems=_}o.rest&&(h.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:g,maximum:y}=e._zod.bag;typeof g=="number"&&(h.minItems=g),typeof y=="number"&&(h.maxItems=y);break}case"record":{let h=p;h.type="object",h.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),h.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let h=p,m=pxe(o.entries);m.every(g=>typeof g=="number")&&(h.type="number"),m.every(g=>typeof g=="string")&&(h.type="string"),h.enum=m;break}case"literal":{let h=p,m=[];for(let g of o.values)if(g===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(g))}else m.push(g);if(m.length!==0)if(m.length===1){let g=m[0];h.type=g===null?"null":typeof g,h.const=g}else m.every(g=>typeof g=="number")&&(h.type="number"),m.every(g=>typeof g=="string")&&(h.type="string"),m.every(g=>typeof g=="boolean")&&(h.type="string"),m.every(g=>g===null)&&(h.type="null"),h.enum=m;break}case"file":{let h=p,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:y,mime:_}=e._zod.bag;g!==void 0&&(m.minLength=g),y!==void 0&&(m.maxLength=y),_?_.length===1?(m.contentMediaType=_[0],Object.assign(h,m)):h.anyOf=_.map(w=>({...m,contentMediaType:w})):Object.assign(h,m);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let h=this.process(o.innerType,d);p.anyOf=[h,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"success":{let h=p;h.type="boolean";break}case"default":{this.process(o.innerType,d),s.ref=o.innerType,p.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),s.ref=o.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),s.ref=o.innerType;let h;try{h=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}p.default=h;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let h=p,m=e._zod.pattern;if(!m)throw new Error("Pattern not found in template literal");h.type="string",h.pattern=m.source;break}case"pipe":{let h=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(h,d),s.ref=h;break}case"readonly":{this.process(o.innerType,d),s.ref=o.innerType,p.readOnly=!0;break}case"promise":{this.process(o.innerType,d),s.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"lazy":{let h=e._zod.innerType;this.process(h,d),s.ref=h;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let l=this.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),this.io==="input"&&rc(e)&&(delete s.schema.examples,delete s.schema.default),this.io==="input"&&s.schema._prefault&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=c=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let m=n.external.registry.get(c[0])?.id,g=n.external.uri??(_=>_);if(m)return{ref:g(m)};let y=c[1].defId??c[1].schema.id??`schema${this.counter++}`;return c[1].defId=y,{defId:y,ref:`${g("__shared")}#/${d}/${y}`}}if(c[1]===o)return{ref:"#"};let p=`#/${d}/`,h=c[1].schema.id??`__schema${this.counter++}`;return{defId:h,ref:p+h}},a=c=>{if(c[1].schema.$ref)return;let d=c[1],{ref:f,defId:p}=i(c);d.def={...d.schema},p&&(d.defId=p);let h=d.schema;for(let m in h)delete h[m];h.$ref=f};if(n.cycles==="throw")for(let c of this.seen.entries()){let d=c[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of this.seen.entries()){let d=c[1];if(e===c[0]){a(c);continue}if(n.external){let p=n.external.registry.get(c[0])?.id;if(e!==c[0]&&p){a(c);continue}}if(this.metadataRegistry.get(c[0])?.id){a(c);continue}if(d.cycle){a(c);continue}if(d.count>1&&n.reused==="ref"){a(c);continue}}let s=(c,d)=>{let f=this.seen.get(c),p=f.def??f.schema,h={...p};if(f.ref===null)return;let m=f.ref;if(f.ref=null,m){s(m,d);let g=this.seen.get(m).schema;g.$ref&&d.target==="draft-7"?(p.allOf=p.allOf??[],p.allOf.push(g)):(Object.assign(p,g),Object.assign(p,h))}f.isParent||this.override({zodSchema:c,jsonSchema:p,path:f.path??[]})};for(let c of[...this.seen.entries()].reverse())s(c[0],{target:this.target});let u={};if(this.target==="draft-2020-12"?u.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?u.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let c=n.external.registry.get(e)?.id;if(!c)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(c)}Object.assign(u,o.def);let l=n.external?.defs??{};for(let c of this.seen.entries()){let d=c[1];d.def&&d.defId&&(l[d.defId]=d.def)}n.external||Object.keys(l).length>0&&(this.target==="draft-2020-12"?u.$defs=l:u.definitions=l);try{return JSON.parse(JSON.stringify(u))}catch{throw new Error("Error converting schema to JSON.")}}}});var DXe=b(()=>{});var UQ=b(()=>{M6();gxe();hxe();AXe();OXe();yxe();$A();CXe();IXe();bxe();EXe();NXe();RXe();jXe();DXe()});var FXe,LXe,kXe,qQ=b(()=>{FXe=Symbol("Let zodToJsonSchema decide on which parser to use"),LXe={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"},kXe=t=>typeof t=="string"?{...LXe,name:t}:{...LXe,...t}});var $Xe,_xe=b(()=>{qQ();$Xe=t=>{let e=kXe(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 vxe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function uo(t,e,r,n,o){t[e]=r,vxe(t,e,n,o)}var BA=b(()=>{});var vd=b(()=>{r6();r6()});function BXe(){return{}}var wxe=b(()=>{});function zXe(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==re.ZodAny&&(r.items=Cr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&uo(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&uo(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(uo(r,"minItems",t.exactLength.value,t.exactLength.message,e),uo(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var xxe=b(()=>{vd();BA();hu()});function UXe(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?uo(r,"minimum",n.value,n.message,e):uo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),uo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?uo(r,"maximum",n.value,n.message,e):uo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),uo(r,"maximum",n.value,n.message,e));break;case"multipleOf":uo(r,"multipleOf",n.value,n.message,e);break}return r}var Sxe=b(()=>{BA()});function qXe(){return{type:"boolean"}}var Cxe=b(()=>{});function HQ(t,e){return Cr(t.type._def,e)}var VQ=b(()=>{hu()});var HXe,Oxe=b(()=>{hu();HXe=(t,e)=>Cr(t.innerType._def,e)});function Exe(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>Exe(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 uEr(t,e)}}var uEr,Pxe=b(()=>{BA();uEr=(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":uo(r,"minimum",n.value,n.message,e);break;case"max":uo(r,"maximum",n.value,n.message,e);break}return r}});function VXe(t,e){return{...Cr(t.innerType._def,e),default:t.defaultValue()}}var Txe=b(()=>{hu()});function WXe(t,e){return e.effectStrategy==="input"?Cr(t.schema._def,e):{}}var Axe=b(()=>{hu()});function KXe(t){return{type:"string",enum:Array.from(t.values)}}var Ixe=b(()=>{});function GXe(t,e){let r=[Cr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Cr(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(lEr(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 lEr,Mxe=b(()=>{hu();lEr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function JXe(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 Rxe=b(()=>{});function WQ(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":uo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":uo(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":Ib(r,"email",n.message,e);break;case"format:idn-email":Ib(r,"idn-email",n.message,e);break;case"pattern:zod":Op(r,Ab.email,n.message,e);break}break;case"url":Ib(r,"uri",n.message,e);break;case"uuid":Ib(r,"uuid",n.message,e);break;case"regex":Op(r,n.regex,n.message,e);break;case"cuid":Op(r,Ab.cuid,n.message,e);break;case"cuid2":Op(r,Ab.cuid2,n.message,e);break;case"startsWith":Op(r,RegExp(`^${jxe(n.value,e)}`),n.message,e);break;case"endsWith":Op(r,RegExp(`${jxe(n.value,e)}$`),n.message,e);break;case"datetime":Ib(r,"date-time",n.message,e);break;case"date":Ib(r,"date",n.message,e);break;case"time":Ib(r,"time",n.message,e);break;case"duration":Ib(r,"duration",n.message,e);break;case"length":uo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),uo(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Op(r,RegExp(jxe(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&Ib(r,"ipv4",n.message,e),n.version!=="v4"&&Ib(r,"ipv6",n.message,e);break}case"base64url":Op(r,Ab.base64url,n.message,e);break;case"jwt":Op(r,Ab.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Op(r,Ab.ipv4Cidr,n.message,e),n.version!=="v4"&&Op(r,Ab.ipv6Cidr,n.message,e);break}case"emoji":Op(r,Ab.emoji(),n.message,e);break;case"ulid":{Op(r,Ab.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Ib(r,"binary",n.message,e);break}case"contentEncoding:base64":{uo(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Op(r,Ab.base64,n.message,e);break}}break}case"nanoid":Op(r,Ab.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function jxe(t,e){return e.patternStrategy==="escape"?dEr(t):t}function dEr(t){let e="";for(let r=0;r<t.length;r++)cEr.has(t[r])||(e+="\\"),e+=t[r];return e}function Ib(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}}})):uo(t,"format",e,r,n)}function Op(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:ZXe(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):uo(t,"pattern",ZXe(e,n),r,n)}function ZXe(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 Nxe,Ab,cEr,KQ=b(()=>{BA();Ab={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:()=>(Nxe===void 0&&(Nxe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Nxe),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-_]*$/};cEr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function GQ(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===re.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:Cr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Cr(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===re.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=WQ(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===re.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===re.ZodBranded&&t.keyType._def.type._def.typeName===re.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=HQ(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var JQ=b(()=>{vd();hu();KQ();VQ()});function YXe(t,e){if(e.mapStrategy==="record")return GQ(t,e);let r=Cr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=Cr(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 Dxe=b(()=>{hu();JQ()});function XXe(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 Lxe=b(()=>{});function QXe(){return{not:{}}}var Fxe=b(()=>{});function eQe(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var kxe=b(()=>{});function rQe(t,e){if(e.target==="openApi3")return tQe(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in D6&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=D6[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 tQe(t,e)}var D6,tQe,ZQ=b(()=>{hu();D6={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};tQe=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Cr(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 nQe(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:D6[t.innerType._def.typeName],nullable:!0}:{type:[D6[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Cr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Cr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var $xe=b(()=>{hu();ZQ()});function oQe(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",vxe(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?uo(r,"minimum",n.value,n.message,e):uo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),uo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?uo(r,"maximum",n.value,n.message,e):uo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),uo(r,"maximum",n.value,n.message,e));break;case"multipleOf":uo(r,"multipleOf",n.value,n.message,e);break}return r}var Bxe=b(()=>{BA()});function fEr(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":Cr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":Cr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function iQe(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 dm&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=Cr(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:fEr(t,e)};return n.required.length||delete n.required,n}var zxe=b(()=>{vd();hu()});var aQe,Uxe=b(()=>{hu();aQe=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Cr(t.innerType._def,e);let r=Cr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var sQe,qxe=b(()=>{hu();sQe=(t,e)=>{if(e.pipeStrategy==="input")return Cr(t.in._def,e);if(e.pipeStrategy==="output")return Cr(t.out._def,e);let r=Cr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Cr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function uQe(t,e){return Cr(t.type._def,e)}var Hxe=b(()=>{hu()});function lQe(t,e){let n={type:"array",uniqueItems:!0,items:Cr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&uo(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&uo(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var Vxe=b(()=>{BA();hu()});function cQe(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Cr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Cr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Cr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var Wxe=b(()=>{hu()});function dQe(){return{not:{}}}var Kxe=b(()=>{});function fQe(){return{}}var Gxe=b(()=>{});var pQe,Jxe=b(()=>{hu();pQe=(t,e)=>Cr(t.innerType._def,e)});function Cr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==FXe)return a}if(n&&!r){let a=pEr(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=hEr(t,t.typeName,e);return i&&gEr(t,e,i),o.jsonSchema=i,i}var pEr,mEr,hEr,gEr,hu=b(()=>{vd();wxe();xxe();Sxe();Cxe();VQ();Oxe();Pxe();Txe();Axe();Ixe();Mxe();Rxe();Dxe();Lxe();Fxe();kxe();$xe();Bxe();zxe();Uxe();qxe();Hxe();JQ();Vxe();KQ();Wxe();Kxe();ZQ();Gxe();Jxe();qQ();pEr=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:mEr(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}},mEr=(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("/")},hEr=(t,e,r)=>{switch(e){case re.ZodString:return WQ(t,r);case re.ZodNumber:return oQe(t,r);case re.ZodObject:return iQe(t,r);case re.ZodBigInt:return UXe(t,r);case re.ZodBoolean:return qXe();case re.ZodDate:return Exe(t,r);case re.ZodUndefined:return dQe();case re.ZodNull:return eQe(r);case re.ZodArray:return zXe(t,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return rQe(t,r);case re.ZodIntersection:return GXe(t,r);case re.ZodTuple:return cQe(t,r);case re.ZodRecord:return GQ(t,r);case re.ZodLiteral:return JXe(t,r);case re.ZodEnum:return KXe(t);case re.ZodNativeEnum:return XXe(t);case re.ZodNullable:return nQe(t,r);case re.ZodOptional:return aQe(t,r);case re.ZodMap:return YXe(t,r);case re.ZodSet:return lQe(t,r);case re.ZodLazy:return Cr(t.getter()._def,r);case re.ZodPromise:return uQe(t,r);case re.ZodNaN:case re.ZodNever:return QXe();case re.ZodEffects:return WXe(t,r);case re.ZodAny:return BXe();case re.ZodUnknown:return fQe();case re.ZodDefault:return VXe(t,r);case re.ZodBranded:return HQ(t,r);case re.ZodReadonly:return pQe(t,r);case re.ZodCatch:return HXe(t,r);case re.ZodPipeline:return sQe(t,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(n=>{})(e)}},gEr=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var os,Zxe=b(()=>{hu();_xe();os=(t,e)=>{let r=$Xe(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:Cr(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=Cr(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 Ug=b(()=>{qQ();_xe();BA();hu();wxe();xxe();Sxe();Cxe();VQ();Oxe();Pxe();Txe();Axe();Ixe();Mxe();Rxe();Dxe();Lxe();Fxe();kxe();$xe();Bxe();zxe();Uxe();qxe();Hxe();Jxe();JQ();Vxe();KQ();Wxe();Kxe();ZQ();Gxe();Zxe();Zxe()});function hE(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(!hE(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(!hE(t[a],e[a]))return!1;return!0}return t===e}var Yxe=b(()=>{});function Eh(t){return encodeURI(yEr(t))}function yEr(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var YQ=b(()=>{});function zA(t,e=Object.create(null),r=wEr,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:zA(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(vEr[i])continue;let a=`${n}/${Eh(i)}`,s=t[i];if(Array.isArray(s)){if(bEr[i]){let u=s.length;for(let l=0;l<u;l++)zA(s[l],e,r,`${a}/${l}`)}}else if(_Er[i])for(let u in s)zA(s[u],e,r,`${a}/${Eh(u)}`);else zA(s,e,r,a)}return e}var bEr,_Er,vEr,wEr,XQ=b(()=>{YQ();bEr={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},_Er={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},vEr={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},wEr=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 vm(t){return t.test.bind(t)}function UEr(t){return t%4===0&&(t%100!==0||t%400===0)}function mQe(t){let e=t.match(xEr);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&UEr(r)?29:SEr[n])}function hQe(t,e){let r=e.match(CEr);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 HEr(t){let e=t.split(qEr);return e.length==2&&mQe(e[0])&&hQe(!0,e[1])}function KEr(t){return VEr.test(t)&&WEr.test(t)}function JEr(t){if(GEr.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var xEr,SEr,CEr,OEr,EEr,PEr,TEr,AEr,IEr,MEr,REr,NEr,jEr,DEr,LEr,FEr,kEr,$Er,BEr,zEr,Xxe,qEr,VEr,WEr,GEr,Qxe=b(()=>{xEr=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,SEr=[0,31,28,31,30,31,30,31,31,30,31,30,31],CEr=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,OEr=/^(?=.{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,EEr=/^(?:[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,PEr=/^(?:(?:[^\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,TEr=/^(?:(?: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,AEr=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,IEr=/^(?:\/(?:[^~/]|~0|~1)*)*$/,MEr=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,REr=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,NEr=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,jEr=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,DEr=/^\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,LEr=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,FEr=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))},kEr=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,$Er=/^((([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,BEr=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));zEr={date:mQe,time:hQe.bind(void 0,!1),"date-time":HEr,duration:BEr,uri:KEr,"uri-reference":vm(EEr),"uri-template":vm(PEr),url:vm(TEr),email:FEr,hostname:vm(OEr),ipv4:vm(kEr),ipv6:vm($Er),regex:JEr,uuid:vm(AEr),"json-pointer":vm(IEr),"json-pointer-uri-fragment":vm(MEr),"relative-json-pointer":vm(REr)},Xxe={...zEr,date:vm(NEr),time:vm(jEr),"date-time":vm(DEr),"uri-reference":vm(LEr)};qEr=/t|\s/i;VEr=/\/|:/,WEr=/^(?:[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;GEr=/[^\\]\\Z/});var gQe,yQe=b(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(gQe||(gQe={}))});function bQe(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 eSe=b(()=>{});function _a(t,e,r="2019-09",n=zA(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:h,const:m,enum:g,required:y,not:_,anyOf:w,allOf:S,oneOf:C,if:E,then:P,else:T,format:I,properties:N,patternProperties:M,additionalProperties:D,unevaluatedProperties:k,minProperties:F,maxProperties:K,propertyNames:U,dependentRequired:Y,dependentSchemas:ee,dependencies:L,prefixItems:Q,items:z,additionalItems:W,unevaluatedItems:V,contains:q,minContains:H,maxContains:G,minItems:Z,maxItems:de,uniqueItems:pe,minimum:ae,maximum:Te,exclusiveMinimum:Ae,exclusiveMaximum:ke,multipleOf:St,minLength:Nr,maxLength:Ir,pattern:Hn,__absolute_ref__:Yr,__absolute_recursive_ref__:Sr}=e,Me=[];if(p===!0&&i===null&&(i=e),f==="#"){let je=i===null?n[Sr]:i,le=`${s}/$recursiveRef`,ne=_a(t,i===null?e:i,r,n,o,je,a,le,u);ne.valid||Me.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:le,error:"A subschema had errors."},...ne.errors)}if(d!==void 0){let le=n[Yr||d];if(le===void 0){let be=`Unresolved $ref "${d}".`;throw Yr&&Yr!==d&&(be+=` Absolute URI "${Yr}".`),be+=`
Known schemas:
- ${Object.keys(n).join(`
- `)}`,new Error(be)}let ne=`${s}/$ref`,fe=_a(t,le,r,n,o,i,a,ne,u);if(fe.valid||Me.push({instanceLocation:a,keyword:"$ref",keywordLocation:ne,error:"A subschema had errors."},...fe.errors),r==="4"||r==="7")return{valid:Me.length===0,errors:Me}}if(Array.isArray(h)){let je=h.length,le=!1;for(let ne=0;ne<je;ne++)if(c===h[ne]||h[ne]==="integer"&&c==="number"&&t%1===0&&t===t){le=!0;break}le||Me.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${h.join('", "')}".`})}else h==="integer"?(c!=="number"||t%1||t!==t)&&Me.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${h}".`}):h!==void 0&&c!==h&&Me.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${h}".`});if(m!==void 0&&(c==="object"||c==="array"?hE(t,m)||Me.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(m)}.`}):t!==m&&Me.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(m)}.`})),g!==void 0&&(c==="object"||c==="array"?g.some(je=>hE(t,je))||Me.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`}):g.some(je=>t===je)||Me.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`})),_!==void 0){let je=`${s}/not`;_a(t,_,r,n,o,i,a,je).valid&&Me.push({instanceLocation:a,keyword:"not",keywordLocation:je,error:'Instance matched "not" schema.'})}let Ge=[];if(w!==void 0){let je=`${s}/anyOf`,le=Me.length,ne=!1;for(let fe=0;fe<w.length;fe++){let be=w[fe],ye=Object.create(u),ze=_a(t,be,r,n,o,p===!0?i:null,a,`${je}/${fe}`,ye);Me.push(...ze.errors),ne=ne||ze.valid,ze.valid&&Ge.push(ye)}ne?Me.length=le:Me.splice(le,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:je,error:"Instance does not match any subschemas."})}if(S!==void 0){let je=`${s}/allOf`,le=Me.length,ne=!0;for(let fe=0;fe<S.length;fe++){let be=S[fe],ye=Object.create(u),ze=_a(t,be,r,n,o,p===!0?i:null,a,`${je}/${fe}`,ye);Me.push(...ze.errors),ne=ne&&ze.valid,ze.valid&&Ge.push(ye)}ne?Me.length=le:Me.splice(le,0,{instanceLocation:a,keyword:"allOf",keywordLocation:je,error:"Instance does not match every subschema."})}if(C!==void 0){let je=`${s}/oneOf`,le=Me.length,ne=C.filter((fe,be)=>{let ye=Object.create(u),ze=_a(t,fe,r,n,o,p===!0?i:null,a,`${je}/${be}`,ye);return Me.push(...ze.errors),ze.valid&&Ge.push(ye),ze.valid}).length;ne===1?Me.length=le:Me.splice(le,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:je,error:`Instance does not match exactly one subschema (${ne} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...Ge),E!==void 0){let je=`${s}/if`;if(_a(t,E,r,n,o,i,a,je,u).valid){if(P!==void 0){let ne=_a(t,P,r,n,o,i,a,`${s}/then`,u);ne.valid||Me.push({instanceLocation:a,keyword:"if",keywordLocation:je,error:'Instance does not match "then" schema.'},...ne.errors)}}else if(T!==void 0){let ne=_a(t,T,r,n,o,i,a,`${s}/else`,u);ne.valid||Me.push({instanceLocation:a,keyword:"if",keywordLocation:je,error:'Instance does not match "else" schema.'},...ne.errors)}}if(c==="object"){if(y!==void 0)for(let fe of y)fe in t||Me.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${fe}".`});let je=Object.keys(t);if(F!==void 0&&je.length<F&&Me.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${F} properties.`}),K!==void 0&&je.length>K&&Me.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${K} properties.`}),U!==void 0){let fe=`${s}/propertyNames`;for(let be in t){let ye=`${a}/${Eh(be)}`,ze=_a(be,U,r,n,o,i,ye,fe);ze.valid||Me.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:fe,error:`Property name "${be}" does not match schema.`},...ze.errors)}}if(Y!==void 0){let fe=`${s}/dependantRequired`;for(let be in Y)if(be in t){let ye=Y[be];for(let ze of ye)ze in t||Me.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:fe,error:`Instance has "${be}" but does not have "${ze}".`})}}if(ee!==void 0)for(let fe in ee){let be=`${s}/dependentSchemas`;if(fe in t){let ye=_a(t,ee[fe],r,n,o,i,a,`${be}/${Eh(fe)}`,u);ye.valid||Me.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:be,error:`Instance has "${fe}" but does not match dependant schema.`},...ye.errors)}}if(L!==void 0){let fe=`${s}/dependencies`;for(let be in L)if(be in t){let ye=L[be];if(Array.isArray(ye))for(let ze of ye)ze in t||Me.push({instanceLocation:a,keyword:"dependencies",keywordLocation:fe,error:`Instance has "${be}" but does not have "${ze}".`});else{let ze=_a(t,ye,r,n,o,i,a,`${fe}/${Eh(be)}`);ze.valid||Me.push({instanceLocation:a,keyword:"dependencies",keywordLocation:fe,error:`Instance has "${be}" but does not match dependant schema.`},...ze.errors)}}}let le=Object.create(null),ne=!1;if(N!==void 0){let fe=`${s}/properties`;for(let be in N){if(!(be in t))continue;let ye=`${a}/${Eh(be)}`,ze=_a(t[be],N[be],r,n,o,i,ye,`${fe}/${Eh(be)}`);if(ze.valid)u[be]=le[be]=!0;else if(ne=o,Me.push({instanceLocation:a,keyword:"properties",keywordLocation:fe,error:`Property "${be}" does not match schema.`},...ze.errors),ne)break}}if(!ne&&M!==void 0){let fe=`${s}/patternProperties`;for(let be in M){let ye=new RegExp(be,"u"),ze=M[be];for(let mr in t){if(!ye.test(mr))continue;let Ti=`${a}/${Eh(mr)}`,yi=_a(t[mr],ze,r,n,o,i,Ti,`${fe}/${Eh(be)}`);yi.valid?u[mr]=le[mr]=!0:(ne=o,Me.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:fe,error:`Property "${mr}" matches pattern "${be}" but does not match associated schema.`},...yi.errors))}}}if(!ne&&D!==void 0){let fe=`${s}/additionalProperties`;for(let be in t){if(le[be])continue;let ye=`${a}/${Eh(be)}`,ze=_a(t[be],D,r,n,o,i,ye,fe);ze.valid?u[be]=!0:(ne=o,Me.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:fe,error:`Property "${be}" does not match additional properties schema.`},...ze.errors))}}else if(!ne&&k!==void 0){let fe=`${s}/unevaluatedProperties`;for(let be in t)if(!u[be]){let ye=`${a}/${Eh(be)}`,ze=_a(t[be],k,r,n,o,i,ye,fe);ze.valid?u[be]=!0:Me.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:fe,error:`Property "${be}" does not match unevaluated properties schema.`},...ze.errors)}}}else if(c==="array"){de!==void 0&&t.length>de&&Me.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${t.length} > ${de}).`}),Z!==void 0&&t.length<Z&&Me.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${t.length} < ${Z}).`});let je=t.length,le=0,ne=!1;if(Q!==void 0){let fe=`${s}/prefixItems`,be=Math.min(Q.length,je);for(;le<be;le++){let ye=_a(t[le],Q[le],r,n,o,i,`${a}/${le}`,`${fe}/${le}`);if(u[le]=!0,!ye.valid&&(ne=o,Me.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:fe,error:"Items did not match schema."},...ye.errors),ne))break}}if(z!==void 0){let fe=`${s}/items`;if(Array.isArray(z)){let be=Math.min(z.length,je);for(;le<be;le++){let ye=_a(t[le],z[le],r,n,o,i,`${a}/${le}`,`${fe}/${le}`);if(u[le]=!0,!ye.valid&&(ne=o,Me.push({instanceLocation:a,keyword:"items",keywordLocation:fe,error:"Items did not match schema."},...ye.errors),ne))break}}else for(;le<je;le++){let be=_a(t[le],z,r,n,o,i,`${a}/${le}`,fe);if(u[le]=!0,!be.valid&&(ne=o,Me.push({instanceLocation:a,keyword:"items",keywordLocation:fe,error:"Items did not match schema."},...be.errors),ne))break}if(!ne&&W!==void 0){let be=`${s}/additionalItems`;for(;le<je;le++){let ye=_a(t[le],W,r,n,o,i,`${a}/${le}`,be);u[le]=!0,ye.valid||(ne=o,Me.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:be,error:"Items did not match additional items schema."},...ye.errors))}}}if(q!==void 0)if(je===0&&H===void 0)Me.push({instanceLocation:a,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(H!==void 0&&je<H)Me.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${je}) than minContains (${H}).`});else{let fe=`${s}/contains`,be=Me.length,ye=0;for(let ze=0;ze<je;ze++){let mr=_a(t[ze],q,r,n,o,i,`${a}/${ze}`,fe);mr.valid?(u[ze]=!0,ye++):Me.push(...mr.errors)}ye>=(H||0)&&(Me.length=be),H===void 0&&G===void 0&&ye===0?Me.splice(be,0,{instanceLocation:a,keyword:"contains",keywordLocation:fe,error:"Array does not contain item matching schema."}):H!==void 0&&ye<H?Me.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${H} items matching schema. Only ${ye} items were found.`}):G!==void 0&&ye>G&&Me.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${G} items matching schema. ${ye} items were found.`})}if(!ne&&V!==void 0){let fe=`${s}/unevaluatedItems`;for(le;le<je;le++){if(u[le])continue;let be=_a(t[le],V,r,n,o,i,`${a}/${le}`,fe);u[le]=!0,be.valid||Me.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:fe,error:"Items did not match unevaluated items schema."},...be.errors)}}if(pe)for(let fe=0;fe<je;fe++){let be=t[fe],ye=typeof be=="object"&&be!==null;for(let ze=0;ze<je;ze++){if(fe===ze)continue;let mr=t[ze];(be===mr||ye&&(typeof mr=="object"&&mr!==null)&&hE(be,mr))&&(Me.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${fe} and ${ze}.`}),fe=Number.MAX_SAFE_INTEGER,ze=Number.MAX_SAFE_INTEGER)}}}else if(c==="number"){if(r==="4"?(ae!==void 0&&(Ae===!0&&t<=ae||t<ae)&&Me.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${Ae?"or equal to ":""} ${ae}.`}),Te!==void 0&&(ke===!0&&t>=Te||t>Te)&&Me.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${ke?"or equal to ":""} ${Te}.`})):(ae!==void 0&&t<ae&&Me.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${ae}.`}),Te!==void 0&&t>Te&&Me.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Te}.`}),Ae!==void 0&&t<=Ae&&Me.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${t} is less than ${Ae}.`}),ke!==void 0&&t>=ke&&Me.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${t} is greater than or equal to ${ke}.`})),St!==void 0){let je=t%St;Math.abs(0-je)>=11920929e-14&&Math.abs(St-je)>=11920929e-14&&Me.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${t} is not a multiple of ${St}.`})}}else if(c==="string"){let je=Nr===void 0&&Ir===void 0?0:bQe(t);Nr!==void 0&&je<Nr&&Me.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${je} < ${Nr}).`}),Ir!==void 0&&je>Ir&&Me.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${je} > ${Ir}).`}),Hn!==void 0&&!new RegExp(Hn,"u").test(t)&&Me.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),I!==void 0&&Xxe[I]&&!Xxe[I](t)&&Me.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${I}".`})}return{valid:Me.length===0,errors:Me}}var tSe=b(()=>{Yxe();XQ();Qxe();YQ();eSe()});var _Qe=b(()=>{XQ();tSe()});var L6=b(()=>{Yxe();XQ();Qxe();YQ();yQe();eSe();tSe();_Qe()});function wm(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_zod"in e))return!1;let r=e._zod;return typeof r=="object"&&r!==null&&"def"in r}function Ph(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_def"in e)||"_zod"in e)return!1;let r=e._def;return typeof r=="object"&&r!=null&&"typeName"in r}function xv(t){return wm(t)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),Ph(t)}function Th(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(wm(t)||Ph(t))}async function vQe(t,e){if(wm(t))try{return{success:!0,data:await wXe(t,e)}}catch(r){return{success:!1,error:r}}if(Ph(t))return t.safeParse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function NB(t,e){if(wm(t))return BQ(t,e);if(Ph(t))return t.parse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function pj(t){if(wm(t))return wv.get(t)?.description;if(Ph(t)||"description"in t&&typeof t.description=="string")return t.description}function rSe(t){return Th(t)?Ph(t)?t._def.typeName==="ZodString":wm(t)?t._zod.def.type==="string":!1:!1}function RB(t){return wm(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="object":!1}function wQe(t){return wm(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="array":!1}function QQ(t,e=!1){if(Ph(t))return t.strict();if(RB(t)){let r=t._zod.def.shape;if(e)for(let[i,a]of Object.entries(t._zod.def.shape)){if(RB(a)){let u=QQ(a,e);r[i]=u}else if(wQe(a)){let u=a._zod.def.element;RB(u)&&(u=QQ(u,e)),r[i]=TB(a,{...a._zod.def,element:u})}else r[i]=a;let s=wv.get(a);s&&wv.add(r[i],s)}let n=TB(t,{...t._zod.def,shape:r,catchall:MXe(TXe)}),o=wv.get(t);return o&&wv.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function ZEr(t){return Ph(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function YEr(t){return wm(t)&&t._zod.def.type==="pipe"}function MB(t,e=!1){if(Ph(t))return ZEr(t)?MB(t._def.schema,e):t;if(wm(t)){let r=t;if(YEr(t)&&(r=MB(t._zod.def.in,e)),e){if(RB(r)){let o=r._zod.def.shape;for(let[i,a]of Object.entries(r._zod.def.shape))o[i]=MB(a,e);r=TB(r,{...r._zod.def,shape:o})}else if(wQe(r)){let o=MB(r._zod.def.element,e);r=TB(r,{...r._zod.def,element:o})}}let n=wv.get(t);return n&&wv.add(r,n),r}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}var gE=b(()=>{UQ()});function xm(t){if(wm(t)){let e=MB(t,!0);if(RB(e)){let r=QQ(e,!0);return j6(r)}else return j6(t)}return Ph(t)?os(t):t}var mj=b(()=>{UQ();Ug();L6();gE();L6()});function XEr(t,e){if(t!==void 0&&!IA(t))return t;if(I6(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 QEr(t){return I6(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...xm(t.data.schema),title:t.data.name}}}function xQe(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 SQe(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 F6,CQe=b(()=>{ej();cxe();mXe();mj();F6=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]=IA(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...QEr(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??As(),i={id:o,data:e,name:XEr(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 xQe(this)}lastNode(){return SQe(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(l=>l.id).every(IA)&&(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&&xQe(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&SQe(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 IA(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 fXe(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 pXe(r,{backgroundColor:e?.backgroundColor})}}});function OQe(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 Ef.fromReadableStream(r)}var EQe=b(()=>{vv()});function nSe(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function eee(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*oSe(t,e){for(;;){let{value:r,done:n}=Cp.runWithConfig(zg(t),e.next.bind(e),!0);if(n)break;yield r}}async function*tee(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Cp.runWithConfig(zg(t),r.next.bind(e),!0);if(o)break;yield n}}var PQe,TQe=b(()=>{fj();bv();PQe=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function nc(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function ePr(t){if($X(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function yE(t){if(typeof t=="function")return new Ep({func:t});if(zn.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=yE(n);return new UA({steps:e})}else throw new Error(`Expected a Runnable, function or object.
Instead got an unsupported type.`)}function tPr(t,e){let r=e.name??t.getName(),n=e.description??pj(e.schema);return rSe(e.schema)?new $6({name:r,description:n,schema:ht.object({input:ht.string()}).transform(o=>o.input),bound:t}):new $6({name:r,description:n,schema:e.schema,bound:t})}var iSe,zn,Sv,ree,k6,ji,UA,aSe,Ep,nee,jB,oee,$6,Pf=b(()=>{MX();iSe=j(jX(),1);ej();Dwe();sXe();lXe();ij();vv();uxe();bv();OB();dXe();cxe();fj();CQe();EQe();TQe();OQ();gE();zn=class extends hm{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 Sv({bound:this,kwargs:e,config:{}})}map(){return new ree({bound:this})}withRetry(e){return new k6({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new Sv({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new nee({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(An);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)=>An(i===0?e:n))}return Array.from({length:r},()=>An(e))}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=o[0]?.maxConcurrency??n?.maxConcurrency,a=new Oh({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=An(r),o=new mE({generator:this._streamIterator(e,n),config:n});return await o.setup,Ef.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=An(e):r=An({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=An(n),a=await(await bm(o))?.handleChainStart(this.toJSON(),nc(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 _v(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(nc(s,"output")),s}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(bm)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),nc(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 _v(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(nc(u,"output")))),u}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=An(n),l=await bm(u);async function*c(){for await(let f of e){if(i)if(o===void 0)o=f;else try{o=Rc(o,f)}catch{o=void 0,i=!1}yield f}}let d;try{let f=await nXe(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(uXe),h=f.output;p!==void 0&&d!==void 0&&(h=p.tapOutputIterable(d.runId,h));let m=d?.handlers.find(aXe);m!==void 0&&d!==void 0&&(h=m.tapOutputIterable(d.runId,h));for await(let g of h)if(yield g,s)if(a===void 0)a=g;else try{a=Rc(a,g)}catch{a=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:nc(o,"input")}),f}await d?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:nc(o,"input")})}getGraph(e){let r=new F6,n=r.addNode({name:`${this.getName()}Input`,schema:ht.any()}),o=r.addNode(this),i=r.addNode({name:`${this.getName()}Output`,schema:ht.any()});return r.addEdge(n,o),r.addEdge(o,i),r}pipe(e){return new ji({first:this,last:yE(e)})}pick(e){return this.pipe(new oee(e))}assign(e){return this.pipe(new jB(new UA({steps:e})))}async*transform(e,r){let n;for await(let o of e)n===void 0?n=o:n=Rc(n,o);yield*this._streamIterator(n,An(r))}async*streamLog(e,r,n){let o=new P6({...n,autoClose:!1,_schemaFormat:"original"}),i=An(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 Tb({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"?OQe(o):Ef.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new DQ({...n,autoClose:!1}),i=An(r),a=i.runId??As();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 h=s.copy();h.addHandler(o,!0),i.callbacks=h}let u=new AbortController,l=this;async function c(){let h,m=null;try{r?.signal?"any"in AbortSignal?h=AbortSignal.any([u.signal,r.signal]):(h=r.signal,m=()=>{u.abort()},r.signal.addEventListener("abort",m,{once:!0})):h=u.signal;let g=await l.stream(e,{...i,signal:h}),y=o.tapOutputIterable(a,g);for await(let _ of y)if(u.signal.aborted)break}finally{await o.finish(),h&&m&&h.removeEventListener("abort",m)}}let d=c(),f=!1,p;try{for await(let h of o){if(!f){h.data.input=e,f=!0,p=h.run_id,yield h;continue}h.run_id===p&&h.event.endsWith("_end")&&h.data?.input&&delete h.data.input,yield h}}finally{u.abort(),await d}}async*_streamEventsV1(e,r,n){let o,i=!1,a=An(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new P6({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new FQ({...n}),f=this._streamLog(e,c,a);for await(let h of f){if(o?o=o.concat(h):o=E6.fromRunLogPatch(h),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 m=h.ops.filter(_=>_.path.startsWith("/logs/")).map(_=>_.path.split("/")[2]),g=[...new Set(m)];for(let _ of g){let w,S={},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&&(S.input=C.inputs);else if(w==="end")C.inputs!==void 0&&(S.input=C.inputs),S.output=C.final_output;else if(w==="stream"){let E=C.streamed_output.length;if(E!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${E} instead. Encountered in: "${C.name}"`);S={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:S}}let{state:y}=o;if(y.streamed_output.length>0){let _=y.streamed_output.length;if(_!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${_} instead. Encountered in: "${y.name}"`);let w={chunk:y.streamed_output[0]};y.streamed_output=[];let S={event:`on_${y.type}_stream`,run_id:y.id,tags:s,metadata:u,name:l,data:w};d.includeEvent(S,y.type)&&(yield S)}}let p=o?.state;if(p!==void 0){let h={event:`on_${p.type}_end`,name:l,run_id:p.id,tags:s,metadata:u,data:{output:p.final_output}};d.includeEvent(h,p.type)&&(yield h)}}static isRunnable(e){return I6(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new Sv({bound:this,config:{},configFactories:[o=>({callbacks:[new A6({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return tPr(this,e)}},Sv=class t extends zn{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=SB(this.config,...e);return SB(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 k6({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:e?.stopAfterAttempt,...e})}async invoke(e,r){return this.bound.invoke(e,await this._mergeConfig(An(r),this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(An(i),this.kwargs))):await this._mergeConfig(An(r),this.kwargs);return this.bound.batch(e,o,n)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(An(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(An(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(An(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(An(r),o.kwargs),version:r.version},n)};return Ef.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&zn.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 A6({config:o,onStart:e,onEnd:r,onError:n})]})]})}},ree=class t extends zn{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,Xs(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new t({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},k6=class extends Sv{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 Xs(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return(0,iSe.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,iSe.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],h=s[f];p instanceof Error&&d===void 0&&(d=p,d.input=u[f]),i[h.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)}},ji=class t extends zn{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=An(r),i=await(await bm(n))?.handleChainStart(this.toJSON(),nc(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,Xs(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${l+1}`)}));a=await _v(d,r?.signal)}if(r?.signal?.aborted)throw new Error("Aborted");s=await this.last.invoke(a,Xs(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(nc(s,"output")),s}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(bm)),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),nc(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 Xs(o[f],{callbacks:p})}),n);s=await _v(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(nc(s,"output")))),s}async*_streamIterator(e,r){let n=await bm(r),{runId:o,...i}=r??{},a=await n?.handleChainStart(this.toJSON(),nc(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(),Xs(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,Xs(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=Rc(l,f)}catch{l=void 0,u=!1}}catch(d){throw await a?.handleChainError(d),d}await a?.handleChainEnd(nc(l,"output"))}getGraph(e){let r=new F6,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:yE(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&zn.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:yE(e),middle:r.slice(0,-1).map(yE),last:yE(r[r.length-1])})}},UA=class t extends zn{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]=yE(n)}static from(e){return new t({steps:e})}async invoke(e,r){let n=An(r),i=await(await bm(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,Xs(n,{callbacks:i?.getChild(`map:key:${u}`)}))});await _v(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=lxe(e,Object.keys(o).length),a=new Map(Object.entries(o).map(([s,u],l)=>{let c=u.transform(i[l],Xs(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 _v(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=An(r),i=new mE({generator:this.transform(n(),o),config:o});return await i.setup,Ef.fromAsyncGenerator(i)}},aSe=class t extends zn{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}),!$X(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 bm(n),i=this.func(Xs(n,{callbacks:o}),e);return _v(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(eee(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(PQe(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})}};Ep=class t extends zn{static lc_name(){return"RunnableLambda"}constructor(e){if($X(e.func))return aSe.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}),ePr(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=Xs(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??NQ)-1});Cp.runWithConfig(zg(a),async()=>{try{let s=await this.func(e,{...a});if(s&&zn.isRunnable(s)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");s=await s.invoke(e,{...a,recursionLimit:(a.recursionLimit??NQ)-1})}else if(eee(s)){let u;for await(let l of tee(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=Rc(u,l)}catch{u=l}s=u}else if(nSe(s)){let u;for(let l of oSe(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=Rc(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=Rc(o,s)}catch{o=s}let i=Xs(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??NQ)-1}),a=await new Promise((s,u)=>{Cp.runWithConfig(zg(i),async()=>{try{let l=await this.func(o,{...i,config:i});s(l)}catch(l){u(l)}})});if(a&&zn.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(eee(a))for await(let s of tee(i,a))n?.signal?.throwIfAborted(),yield s;else if(nSe(a))for(let s of oSe(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=An(r),i=new mE({generator:this.transform(n(),o),config:o});return await i.setup,Ef.fromAsyncGenerator(i)}},nee=class extends zn{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=An(r),o=await bm(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),nc(e,"input"),i,void 0,void 0,void 0,a?.runName),u=Xs(a,{callbacks:s?.getChild()});return await Cp.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(nc(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=An(r),o=await bm(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),nc(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=Xs(a,{callbacks:s?.getChild()});try{let p=await d.stream(e,f);l=tee(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:Rc(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(nc(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=>bm(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),nc(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)=>Xs(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(nc(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.")}};jB=class extends zn{static lc_name(){return"RunnableAssign"}constructor(e){e instanceof UA&&(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]=lxe(e),s=this.mapper.transform(a,Xs(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=An(r),i=new mE({generator:this.transform(n(),o),config:o});return await i.setup,Ef.fromAsyncGenerator(i)}},oee=class extends zn{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=An(r),i=new mE({generator:this.transform(n(),o),config:o});return await i.setup,Ef.fromAsyncGenerator(i)}},$6=class extends Sv{constructor(e){let r=ji.from([Ep.from(async n=>{let o;if(jA(n))try{o=await NB(this.schema,n.args)}catch{throw new lj("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 jo,iee=b(()=>{vv();Pf();bv();jo=class extends zn{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=An(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=An(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=Rc(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(e){return new jB(new UA({steps:e}))}}});var AQe=b(()=>{Pf();bv()});var IQe=b(()=>{Pf();bv();vv()});var sSe=b(()=>{$g()});var MQe=b(()=>{Pf();cj();$g();EQ();PQ();w6();sSe();TQ();vB();DA()});var hj=b(()=>{cj();$g();EQ();PQ();w6();TQ();DA();MQe();sSe();G0e();vB()});var RQe=b(()=>{hj();Pf();iee()});var uSe=b(()=>{Pf();bv();iee();AQe();IQe();RQe()});var gj,yj,Ah,DB=b(()=>{uSe();b6();gj=class extends zn{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"})}},yj=class extends gj{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")}},Ah=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");NA(this,"OUTPUT_PARSING_FAILURE")}}});var bj,_j,qA=b(()=>{L6();DB();$g();DA();CB();bj=class extends yj{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"})}},_j=class extends bj{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(J0e(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new so({message:o,text:o.content})}else if(kg(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new so({message:X0e(o),text:o.content})}else i=new _m({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!hE(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var NQe=b(()=>{qA()});var jQe=b(()=>{DB();qA()});var aee,DQe=b(()=>{qA();aee=class extends bj{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 wd,LQe=b(()=>{MX();DB();gE();mj();wd=class extends yj{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=ht.object(Object.fromEntries(Object.entries(e).map(([n,o])=>[n,ht.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(xm(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 NB(this.schema,JSON.parse(n))}catch(r){throw new Ah(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}}});var lSe=b(()=>{Fwe()});var xd,cSe=b(()=>{qA();lSe();W0e();xd=class extends _j{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?KX(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return V0e(e[0].text)}async parse(e){return V0e(e,JSON.parse)}getFormatInstructions(){return""}}});var FQe=b(()=>{});var kQe=b(()=>{qA();lSe();FQe()});var $Qe=b(()=>{DB();NQe();jQe();DQe();LQe();qA();cSe();kQe()});var Mb=b(()=>{$Qe()});var B6,LB,FB,see,z6=b(()=>{ij();w6();DA();B6=class extends hm{},LB=class extends B6{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 Zs(this.value)]}},FB=class extends B6{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 Sp(this.messages)}toChatMessages(){return this.messages}},see=class extends B6{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 Zs({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var bE,U6=b(()=>{z6();kB();bE=class extends Cv{async formatPromptValue(e){let r=await this.format(e);return new LB(r)}}});function fSe(t){return typeof t=="function"}function nPr(t){return BB(t)?"array":typeof t}function dSe(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function BQe(t,e){return t!=null&&typeof t=="object"&&e in t}function oPr(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function aPr(t,e){return iPr.call(t,e)}function uPr(t){return!aPr(sPr,t)}function cPr(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return lPr[r]})}function hPr(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 h(T){if(typeof T=="string"&&(T=T.split(fPr,2)),!BB(T)||T.length!==2)throw new Error("Invalid tags: "+T);d=new RegExp(dSe(T[0])+"\\s*"),f=new RegExp("\\s*"+dSe(T[1])),p=new RegExp("\\s*"+dSe("}"+T[1]))}h(e||qg.tags);for(var m=new H6(t),g,y,_,w,S,C;!m.eos();){if(g=m.pos,_=m.scanUntil(d),_)for(var E=0,P=_.length;E<P;++E)w=_.charAt(E),uPr(w)?(i.push(o.length),u+=w):(s=!0,r=!0,u+=" "),o.push(["text",w,g,g+1]),g+=1,w===`
`&&(c(),u="",l=0,r=!1);if(!m.scan(d))break;if(a=!0,y=m.scan(mPr)||"name",m.scan(dPr),y==="="?(_=m.scanUntil(zQe),m.scan(zQe),m.scanUntil(f)):y==="{"?(_=m.scanUntil(p),m.scan(pPr),m.scanUntil(f),y="&"):_=m.scanUntil(f),!m.scan(f))throw new Error("Unclosed tag at "+m.pos);if(y==">"?S=[y,_,g,m.pos,u,l,r]:S=[y,_,g,m.pos],l++,o.push(S),y==="#"||y==="^")n.push(S);else if(y==="/"){if(C=n.pop(),!C)throw new Error('Unopened section "'+_+'" at '+g);if(C[1]!==_)throw new Error('Unclosed section "'+C[1]+'" at '+g)}else y==="name"||y==="{"||y==="&"?s=!0:y==="="&&h(_)}if(c(),C=n.pop(),C)throw new Error('Unclosed section "'+C[1]+'" at '+m.pos);return yPr(gPr(o))}function gPr(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 yPr(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 H6(t){this.string=t,this.tail=t,this.pos=0}function $B(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Pp(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}var rPr,BB,iPr,sPr,lPr,dPr,fPr,zQe,pPr,mPr,qg,q6,uee,UQe=b(()=>{rPr=Object.prototype.toString,BB=Array.isArray||function(e){return rPr.call(e)==="[object Array]"};iPr=RegExp.prototype.test;sPr=/\S/;lPr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};dPr=/\s*/,fPr=/\s+/,zQe=/\s*=/,pPr=/\s*\}/,mPr=/#|\^|\/|>|\{|&|=|!/;H6.prototype.eos=function(){return this.tail===""};H6.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};H6.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};$B.prototype.push=function(e){return new $B(e,this)};$B.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=BQe(i,a[s])||oPr(i,a[s])),i=i[a[s++]];else i=o.view[e],u=BQe(o.view,e);if(u){n=i;break}o=o.parent}r[e]=n}return fSe(n)&&(n=n.call(this.view)),n};Pp.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Pp.prototype.parse=function(e,r){var n=this.templateCache,o=e+":"+(r||qg.tags).join(":"),i=typeof n<"u",a=i?n.get(o):void 0;return a==null&&(a=hPr(e,r),i&&n.set(o,a)),a};Pp.prototype.render=function(e,r,n,o){var i=this.getConfigTags(o),a=this.parse(e,i),s=r instanceof $B?r:new $B(r,void 0);return this.renderTokens(a,s,n,e,o)};Pp.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};Pp.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(BB(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(fSe(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}};Pp.prototype.renderInverted=function(e,r,n,o,i){var a=r.lookup(e[1]);if(!a||BB(a)&&a.length===0)return this.renderTokens(e[4],r,n,o,i)};Pp.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(`
`)};Pp.prototype.renderPartial=function(e,r,n,o){if(n){var i=this.getConfigTags(o),a=fSe(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)}}};Pp.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};Pp.prototype.escapedValue=function(e,r,n){var o=this.getConfigEscape(n)||qg.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===qg.escape?String(i):o(i)};Pp.prototype.rawValue=function(e){return e[1]};Pp.prototype.getConfigTags=function(e){return BB(e)?e:e&&typeof e=="object"?e.tags:void 0};Pp.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!BB(e))return e.escape};qg={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){q6.templateCache=t},get templateCache(){return q6.templateCache}},q6=new Pp;qg.clearCache=function(){return q6.clearCache()};qg.parse=function(e,r){return q6.parse(e,r)};qg.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+nPr(e)+'" was given as the first argument for mustache#render(template, view, partials)');return q6.render(e,r,n,o)};qg.escape=cPr;qg.Scanner=H6;qg.Context=$B;qg.Writer=Pp;uee=qg});function qQe(){uee.escape=t=>t}var V6,HQe,lee,bPr,_Pr,pSe,vPr,Sm,W6,vj,wj=b(()=>{UQe();b6();V6=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},HQe=t=>{let e=[];for(let r of t)if(r[0]==="name"){let n=r[1].includes(".")?r[1].split(".")[0]:r[1];e.push({type:"variable",name:n})}else if(["#","&","^",">"].includes(r[0])){if(e.push({type:"variable",name:r[1]}),r[0]==="#"&&r.length>4&&Array.isArray(r[4])){let n=HQe(r[4]);e.push(...n)}}else e.push({type:"literal",text:r[1]});return e},lee=t=>{qQe();let e=uee.parse(t);return HQe(e)},bPr=(t,e)=>V6(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},""),_Pr=(t,e)=>(qQe(),uee.render(t,e)),pSe={"f-string":bPr,mustache:_Pr},vPr={"f-string":V6,mustache:lee},Sm=(t,e,r)=>{try{return pSe[e](t,r)}catch(n){throw NA(n,"INVALID_PROMPT_INPUT")}},W6=(t,e)=>vPr[e](t),vj=(t,e,r)=>{if(!(e in pSe)){let n=Object.keys(pSe);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")Sm(o.text,e,n);else if(o.type==="image_url")if(typeof o.image_url=="string")Sm(o.image_url,e,n);else{let i=o.image_url.url;Sm(i,e,n)}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):Sm(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var mSe={};ns(mSe,{PromptTemplate:()=>Tf});var Tf,zB=b(()=>{U6();wj();Tf=class t extends bE{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))),vj(this.template,this.templateFormat,r)}}_getPromptType(){return"prompt"}async format(e){let r=await this.mergePartialAndUserVariables(e);return Sm(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 W6(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 UB,hSe=b(()=>{z6();kB();wj();UB=class t extends Cv{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))),vj([{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]=Sm(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 see(r)}}});function gSe(t,e){let r=[];for(let n of Object.values(t))if(typeof n=="string")W6(n,e).forEach(o=>{o.type==="variable"&&r.push(o.name)});else if(Array.isArray(n))for(let o of n)typeof o=="string"?W6(o,e).forEach(i=>{i.type==="variable"&&r.push(i.name)}):typeof o=="object"&&r.push(...gSe(o,e));else typeof n=="object"&&n!==null&&r.push(...gSe(n,e));return Array.from(new Set(r))}function ySe(t,e,r){let n={};for(let[o,i]of Object.entries(t))if(typeof i=="string")n[o]=Sm(i,r,e);else if(Array.isArray(i)){let a=[];for(let s of i)typeof s=="string"?a.push(Sm(s,r,e)):typeof s=="object"&&a.push(ySe(s,e,r));n[o]=a}else typeof i=="object"&&i!==null?n[o]=ySe(i,e,r):n[o]=i;return n}var K6,bSe=b(()=>{Pf();wj();K6=class extends zn{static lc_name(){return"DictPromptTemplate"}constructor(e){let r=e.templateFormat??"f-string",n=gSe(e.template,r);super({inputVariables:n,...e}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","dict"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.template=e.template,this.templateFormat=r,this.inputVariables=n}async format(e){return ySe(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}}});function wPr(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).length===1&&"text"in t&&typeof t.text=="string"}function xPr(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:"image_url"in t&&(typeof t.image_url=="string"||typeof t.image_url=="object"&&t.image_url!==null&&"url"in t.image_url&&typeof t.image_url.url=="string")}function SPr(t){return typeof t.formatMessages=="function"}function CPr(t,e){if(SPr(t)||kg(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 Ov({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new Ov({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=Pb(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 Ev.fromTemplate(n,e);if(r._getType()==="ai")return wSe.fromTemplate(n,e);if(r._getType()==="system")return HA.fromTemplate(n,e);if(Js.isInstance(r))return vSe.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function OPr(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var G6,Ov,_Se,J6,vSe,Z6,Ev,wSe,HA,Cm,Y6=b(()=>{hj();z6();Pf();U6();kB();zB();hSe();wj();b6();bSe();G6=class extends zn{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"})}},Ov=class extends G6{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(Pb):n=[Pb(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}},_Se=class extends G6{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)]}},J6=class extends Cv{constructor(e){super(e)}async format(e){return(await this.formatPromptValue(e)).toString()}async formatPromptValue(e){let r=await this.formatMessages(e);return new FB(r)}},vSe=class extends _Se{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 Js(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this(Tf.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}};Z6=class extends G6{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(Tf.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string")n.push(Tf.fromTemplate(o,r));else if(o!==null)if(wPr(o)){let i="";typeof o.text=="string"&&(i=o.text??"");let a={...r,additionalContentFields:o};n.push(Tf.fromTemplate(i,a))}else if(xPr(o)){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=lee(i):u=V6(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 UB({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=lee(i.url):u=V6(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new UB({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else throw new Error("Invalid image template");n.push(a)}else typeof o=="object"&&n.push(new K6({template:o,templateFormat:r?.templateFormat}));return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof bE){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 bE){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"text",text:i})}else if(n instanceof UB){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"image_url",image_url:i})}else if(n instanceof K6){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,...i})}}return this.createMessage(r)}}async formatMessages(e){return[await this.format(e)]}},Ev=class extends Z6{static _messageClass(){return Zs}static lc_name(){return"HumanMessagePromptTemplate"}},wSe=class extends Z6{static _messageClass(){return Fn}static lc_name(){return"AIMessagePromptTemplate"}},HA=class extends Z6{static _messageClass(){return pE}static lc_name(){return"SystemMessagePromptTemplate"}};Cm=class t extends J6{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 tc))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 Tf.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 tc)n.push(await this._parseImagePrompts(o,r));else{let i=o.inputVariables.reduce((s,u)=>{if(!(u in r)&&!(OPr(o)&&o.optional))throw NA(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=Tf.fromTemplate(e,r),o=new Ev({prompt:n});return this.fromMessages([o])}static fromMessages(e,r){let n=e.reduce((a,s)=>a.concat(s instanceof t?s.promptMessages:[CPr(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 tc))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 VQe={};ns(VQe,{FewShotChatMessagePromptTemplate:()=>SSe,FewShotPromptTemplate:()=>xSe});var xSe,SSe,CSe=b(()=>{U6();wj();zB();Y6();xSe=class t extends bE{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))),vj(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 Sm(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 Tf.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})}},SSe=class t extends J6{_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))),vj(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 Sm(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 Cv,kB=b(()=>{Pf();Cv=class extends zn{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(()=>(zB(),mSe));return r.deserialize(e)}case void 0:{let{PromptTemplate:r}=await Promise.resolve().then(()=>(zB(),mSe));return r.deserialize({...e,_type:"prompt"})}case"few_shot":{let{FewShotPromptTemplate:r}=await Promise.resolve().then(()=>(CSe(),VQe));return r.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}});var WQe=b(()=>{kB();Y6()});var KQe=b(()=>{});var GQe=b(()=>{Pf();Y6()});var JQe=b(()=>{kB();Y6();CSe();WQe();zB();KQe();U6();wj();hSe();GQe();bSe()});var VA=b(()=>{JQe()});var Om=b(()=>{uSe()});var OSe,ESe=b(()=>{OSe=t=>t.map(e=>e.pageContent).join(`
`)});var ZQe=b(()=>{ESe()});function Ih(t,e){let r=`atom${++EPr}`,n={toString(){return(ka.env?ka.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=PPr,n.write=TPr),e&&(n.write=e),n}function PPr(t){return t(this)}function TPr(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var ka,EPr,YQe,PSe,TSe,dee,ISe,APr,IPr,MSe,XQe,cee,tet,QQe,qB,ASe,MPr,RPr,eet,WA,ret,HB,X6,net,RSe=b(()=>{ka={},EPr=0;YQe=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,PSe=t=>"init"in t,TSe=t=>!!t.write,dee=new WeakMap,ISe=t=>{var e;return MSe(t)&&!((e=dee.get(t))!=null&&e[1])},APr=(t,e)=>{let r=dee.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((ka.env?ka.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},IPr=t=>{if(dee.has(t))return;let e=[new Set,!1];dee.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},MSe=t=>typeof t?.then=="function",XQe=t=>"v"in t||"e"in t,cee=t=>{if("e"in t)throw t.e;if((ka.env?ka.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},tet=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},QQe=(t,e,r,n,o)=>{var i;if((ka.env?ka.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),ISe(r.v)&&tet(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&MPr(t,n,e)},qB=()=>[new Map,new Map,new Set],ASe=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},MPr=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},RPr=(t,e)=>t[0].get(e),eet=(t,e)=>{t[2].add(e)},WA=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},ret=(...[t,e,r,n])=>{let o;(ka.env?ka.env.MODE:void 0)!=="production"&&(o=new Set);let i=(w,S,C)=>{let E="v"in S,P=S.v,T=ISe(S.v)?S.v:null;if(MSe(C)){IPr(C);for(let I of S.d.keys())tet(w,C,t(I));S.v=C,delete S.e}else S.v=C,delete S.e;(!E||!Object.is(P,S.v))&&(++S.n,T&&APr(T,C))},a=(w,S,C)=>{var E;let P=t(S);if(XQe(P)&&(P.m&&!C?.has(S)||Array.from(P.d).every(([k,F])=>a(w,k,C).n===F)))return P;P.d.clear();let T=!0,I=k=>{if(YQe(S,k)){let K=t(k);if(!XQe(K))if(PSe(k))i(k,K,k.init);else throw new Error("no atom init");return cee(K)}let F=a(w,k,C);try{return cee(F)}finally{if(T)QQe(w,S,P,k,F);else{let K=qB();QQe(K,S,P,k,F),p(K,S,P),WA(K)}}},N,M,D={get signal(){return N||(N=new AbortController),N.signal},get setSelf(){return(ka.env?ka.env.MODE:void 0)!=="production"&&!TSe(S)&&console.warn("setSelf function cannot be used with read-only atom"),!M&&TSe(S)&&(M=(...k)=>{if((ka.env?ka.env.MODE:void 0)!=="production"&&T&&console.warn("setSelf function cannot be called in sync"),!T)return f(S,...k)}),M}};try{let k=e(S,I,D);if(i(S,P,k),MSe(k)){(E=k.onCancel)==null||E.call(k,()=>N?.abort());let F=()=>{if(P.m){let K=qB();p(K,S,P),WA(K)}};k.then(F,F)}return P}catch(k){return delete P.v,P.e=k,++P.n,P}finally{T=!1}},s=w=>cee(a(void 0,w)),u=(w,S,C)=>{var E,P;let T=new Map;for(let I of((E=C.m)==null?void 0:E.t)||[])T.set(I,t(I));for(let I of C.p)T.set(I,t(I));return(P=RPr(w,S))==null||P.forEach(I=>{T.set(I,t(I))}),T};function l(w,S,C){let E=[],P=new Set,T=new Set,I=[[S,C]];for(;I.length>0;){let[N,M]=I[I.length-1];if(T.has(N)){I.pop();continue}if(P.has(N)){E.push([N,M,M.n]),T.add(N),I.pop();continue}P.add(N);for(let[D,k]of u(w,N,M))N!==D&&!P.has(D)&&I.push([D,k])}return[E,T]}let c=(w,S,C)=>{let[E,P]=l(w,S,C),T=new Set([S]);for(let I=E.length-1;I>=0;--I){let[N,M,D]=E[I],k=!1;for(let F of M.d.keys())if(F!==N&&T.has(F)){k=!0;break}k&&(a(w,N,P),p(w,N,M),D!==M.n&&(ASe(w,N,M),T.add(N))),P.delete(N)}},d=(w,S,...C)=>{let E=!0,P=I=>cee(a(w,I)),T=(I,...N)=>{let M=t(I);try{if(YQe(S,I)){if(!PSe(I))throw new Error("atom not writable");let D=M.n,k=N[0];i(I,M,k),p(w,I,M),D!==M.n&&(ASe(w,I,M),c(w,I,M));return}else return d(w,I,...N)}finally{E||WA(w)}};try{return r(S,P,T,...C)}finally{E=!1}},f=(w,...S)=>{let C=qB();try{return d(C,w,...S)}finally{WA(C)}},p=(w,S,C)=>{if(C.m&&!ISe(C.v)){for(let E of C.d.keys())C.m.d.has(E)||(h(w,E,t(E)).t.add(S),C.m.d.add(E));for(let E of C.m.d||[])if(!C.d.has(E)){C.m.d.delete(E);let P=m(w,E,t(E));P?.t.delete(S)}}},h=(w,S,C)=>{if(!C.m){a(w,S);for(let E of C.d.keys())h(w,E,t(E)).t.add(S);if(C.m={l:new Set,d:new Set(C.d.keys()),t:new Set},(ka.env?ka.env.MODE:void 0)!=="production"&&o.add(S),TSe(S)){let E=C.m,P,T=(I,N)=>{let M=!0;P=(...D)=>{try{return d(I,S,...D)}finally{M||WA(I)}};try{return N()}finally{M=!1}};eet(w,()=>{let I=T(w,()=>n(S,(...N)=>P(...N)));I&&(E.u=N=>T(N,I))})}}return C.m},m=(w,S,C)=>{if(C.m&&!C.m.l.size&&!Array.from(C.m.t).some(E=>{var P;return(P=t(E).m)==null?void 0:P.d.has(S)})){let E=C.m.u;E&&eet(w,()=>E(w)),delete C.m,(ka.env?ka.env.MODE:void 0)!=="production"&&o.delete(S);for(let P of C.d.keys()){let T=m(w,P,t(P));T?.t.delete(S)}return}return C.m},_={get:s,set:f,sub:(w,S)=>{let C=qB(),E=t(w),T=h(C,w,E).l;return T.add(S),WA(C),()=>{T.delete(S);let I=qB();m(I,w,E),WA(I)}},unstable_derive:w=>ret(...w(t,e,r,n))};return(ka.env?ka.env.MODE:void 0)!=="production"&&Object.assign(_,{dev4_get_internal_weak_map:()=>({get:S=>{let C=t(S);if(C.n!==0)return C}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:S=>{let C=qB();for(let[E,P]of S)if(PSe(E)){let T=t(E),I=T.n;i(E,T,P),p(C,E,T),I!==T.n&&(ASe(C,E,T),c(C,E,T))}WA(C)}}),_},HB=()=>{let t=new WeakMap;return ret(r=>{if((ka.env?ka.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)})},net=()=>(X6||(X6=HB(),(ka.env?ka.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=X6),globalThis.__JOTAI_DEFAULT_STORE__!==X6&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),X6)});var het=x(Yn=>{"use strict";var Q6=Symbol.for("react.element"),NPr=Symbol.for("react.portal"),jPr=Symbol.for("react.fragment"),DPr=Symbol.for("react.strict_mode"),LPr=Symbol.for("react.profiler"),FPr=Symbol.for("react.provider"),kPr=Symbol.for("react.context"),$Pr=Symbol.for("react.forward_ref"),BPr=Symbol.for("react.suspense"),zPr=Symbol.for("react.memo"),UPr=Symbol.for("react.lazy"),oet=Symbol.iterator;function qPr(t){return t===null||typeof t!="object"?null:(t=oet&&t[oet]||t["@@iterator"],typeof t=="function"?t:null)}var set={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},uet=Object.assign,cet={};function VB(t,e,r){this.props=t,this.context=e,this.refs=cet,this.updater=r||set}VB.prototype.isReactComponent={};VB.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")};VB.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function det(){}det.prototype=VB.prototype;function jSe(t,e,r){this.props=t,this.context=e,this.refs=cet,this.updater=r||set}var DSe=jSe.prototype=new det;DSe.constructor=jSe;uet(DSe,VB.prototype);DSe.isPureReactComponent=!0;var iet=Array.isArray,fet=Object.prototype.hasOwnProperty,LSe={current:null},pet={key:!0,ref:!0,__self:!0,__source:!0};function met(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)fet.call(e,n)&&!pet.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:Q6,type:t,key:i,ref:a,props:o,_owner:LSe.current}}function HPr(t,e){return{$$typeof:Q6,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function FSe(t){return typeof t=="object"&&t!==null&&t.$$typeof===Q6}function VPr(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var aet=/\/+/g;function NSe(t,e){return typeof t=="object"&&t!==null&&t.key!=null?VPr(""+t.key):e.toString(36)}function pee(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 Q6:case NPr:a=!0}}if(a)return a=t,o=o(a),t=n===""?"."+NSe(a,0):n,iet(o)?(r="",t!=null&&(r=t.replace(aet,"$&/")+"/"),pee(o,e,r,"",function(l){return l})):o!=null&&(FSe(o)&&(o=HPr(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(aet,"$&/")+"/")+t)),e.push(o)),1;if(a=0,n=n===""?".":n+":",iet(t))for(var s=0;s<t.length;s++){i=t[s];var u=n+NSe(i,s);a+=pee(i,e,r,u,o)}else if(u=qPr(t),typeof u=="function")for(t=u.call(t),s=0;!(i=t.next()).done;)i=i.value,u=n+NSe(i,s++),a+=pee(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 fee(t,e,r){if(t==null)return t;var n=[],o=0;return pee(t,n,"","",function(i){return e.call(r,i,o++)}),n}function WPr(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 Tp={current:null},mee={transition:null},KPr={ReactCurrentDispatcher:Tp,ReactCurrentBatchConfig:mee,ReactCurrentOwner:LSe};Yn.Children={map:fee,forEach:function(t,e,r){fee(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return fee(t,function(){e++}),e},toArray:function(t){return fee(t,function(e){return e})||[]},only:function(t){if(!FSe(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Yn.Component=VB;Yn.Fragment=jPr;Yn.Profiler=LPr;Yn.PureComponent=jSe;Yn.StrictMode=DPr;Yn.Suspense=BPr;Yn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=KPr;Yn.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=uet({},t.props),o=t.key,i=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,a=LSe.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(u in e)fet.call(e,u)&&!pet.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:Q6,type:t.type,key:o,ref:i,props:n,_owner:a}};Yn.createContext=function(t){return t={$$typeof:kPr,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:FPr,_context:t},t.Consumer=t};Yn.createElement=met;Yn.createFactory=function(t){var e=met.bind(null,t);return e.type=t,e};Yn.createRef=function(){return{current:null}};Yn.forwardRef=function(t){return{$$typeof:$Pr,render:t}};Yn.isValidElement=FSe;Yn.lazy=function(t){return{$$typeof:UPr,_payload:{_status:-1,_result:t},_init:WPr}};Yn.memo=function(t,e){return{$$typeof:zPr,type:t,compare:e===void 0?null:e}};Yn.startTransition=function(t){var e=mee.transition;mee.transition={};try{t()}finally{mee.transition=e}};Yn.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};Yn.useCallback=function(t,e){return Tp.current.useCallback(t,e)};Yn.useContext=function(t){return Tp.current.useContext(t)};Yn.useDebugValue=function(){};Yn.useDeferredValue=function(t){return Tp.current.useDeferredValue(t)};Yn.useEffect=function(t,e){return Tp.current.useEffect(t,e)};Yn.useId=function(){return Tp.current.useId()};Yn.useImperativeHandle=function(t,e,r){return Tp.current.useImperativeHandle(t,e,r)};Yn.useInsertionEffect=function(t,e){return Tp.current.useInsertionEffect(t,e)};Yn.useLayoutEffect=function(t,e){return Tp.current.useLayoutEffect(t,e)};Yn.useMemo=function(t,e){return Tp.current.useMemo(t,e)};Yn.useReducer=function(t,e,r){return Tp.current.useReducer(t,e,r)};Yn.useRef=function(t){return Tp.current.useRef(t)};Yn.useState=function(t){return Tp.current.useState(t)};Yn.useSyncExternalStore=function(t,e,r){return Tp.current.useSyncExternalStore(t,e,r)};Yn.useTransition=function(){return Tp.current.useTransition()};Yn.version="18.2.0"});var X=x(($ao,get)=>{"use strict";get.exports=het()});function e8(t,e){let r=bet(e),[[n,o,i],a]=(0,Af.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,Af.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);$Se(c)&&_et(yet(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,Af.useDebugValue)(s),$Se(s)){let l=yet(s);return JPr(l)}return s}function ZPr(t,e){let r=bet(e);return(0,Af.useCallback)((...o)=>{if((hee.env?hee.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function WB(t,e){return[e8(t,e),ZPr(t,e)]}var Af,hee,GPr,bet,$Se,_et,JPr,kSe,yet,vet=b(()=>{"use client";Af=j(X(),1);RSe();hee={},GPr=(0,Af.createContext)(void 0),bet=t=>{let e=(0,Af.useContext)(GPr);return t?.store||e||net()},$Se=t=>typeof t?.then=="function",_et=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},JPr=Af.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(_et(t),t)}),kSe=new WeakMap,yet=t=>{let e=kSe.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((hee.env?hee.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");$Se(l)?(kSe.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),kSe.set(t,e)),e}});var t8=b(()=>{RSe();vet()});var r8={};ns(r8,{getModelKeyFromModel:()=>en,getSettings:()=>oe,getSystemPrompt:()=>If,resetSettings:()=>BSe,sanitizeSettings:()=>zSe,setSettings:()=>_E,settingsAtom:()=>KA,settingsStore:()=>Wi,subscribeToSettingsChange:()=>va,updateSetting:()=>ot,useSettingsValue:()=>_n});function _E(t){let e=YPr({...oe(),...t});Wi.set(KA,e)}function ot(t,e){let r=oe();_E({...r,[t]:e})}function oe(){return Wi.get(KA)}function BSe(){let t={...gu,activeModels:Pv.map(e=>({...e,enabled:!0})),activeEmbeddingModels:xj.map(e=>({...e,enabled:!0}))};_E(t)}function va(t){let e=oe();return Wi.sub(KA,()=>{let r=oe();t(e,r),e=r})}function _n(){return e8(KA,{store:Wi})}function zSe(t){let e=t||gu;e.userId||(e.userId=lm()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(c=>({...c,provider:c.provider==="azure_openai"?"azure openai":c.provider})):e.activeEmbeddingModels=xj.map(c=>({...c,enabled:!0}));let r={...e},n=Number(e.temperature);r.temperature=isNaN(n)?gu.temperature:n;let o=Number(e.maxTokens);r.maxTokens=isNaN(o)?gu.maxTokens:o;let i=Number(e.contextTurns);r.contextTurns=isNaN(i)?gu.contextTurns:i;let a=Number(e.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(a)?gu.embeddingRequestsPerMin:a;let s=Number(e.embeddingBatchSize);r.embeddingBatchSize=isNaN(s)?gu.embeddingBatchSize:s;let u=Number(e.lexicalSearchRamLimit);isNaN(u)?r.lexicalSearchRamLimit=gu.lexicalSearchRamLimit:r.lexicalSearchRamLimit=Math.min(1e3,Math.max(20,u)),typeof r.includeActiveNoteAsContext!="boolean"&&(r.includeActiveNoteAsContext=gu.includeActiveNoteAsContext),typeof r.passMarkdownImages!="boolean"&&(r.passMarkdownImages=gu.passMarkdownImages),typeof r.enableCustomPromptTemplating!="boolean"&&(r.enableCustomPromptTemplating=gu.enableCustomPromptTemplating),typeof r.allowAdditionalContext!="boolean"&&(r.allowAdditionalContext=gu.allowAdditionalContext),typeof r.enableWordCompletion!="boolean"&&(r.enableWordCompletion=gu.enableWordCompletion);let l=Number(e.autonomousAgentMaxIterations);return isNaN(l)||l<4||l>8?r.autonomousAgentMaxIterations=gu.autonomousAgentMaxIterations:r.autonomousAgentMaxIterations=l,Array.isArray(r.autonomousAgentEnabledToolIds)||(r.autonomousAgentEnabledToolIds=gu.autonomousAgentEnabledToolIds),r}function If(){let t=oe().userSystemPrompt,e=xet;return t?`${e}
<user_custom_instructions>
${t}
</user_custom_instructions>`:e}function YPr(t){return t.activeModels=wet(t.activeModels,Pv),t.activeEmbeddingModels=wet(t.activeEmbeddingModels,xj),t}function en(t){return`${t.name}|${t.provider}`}function wet(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(en(n),{...n})}),t.forEach(n=>{let o=en(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())}var Wi,KA,bt=b(()=>{t8();LN();nr();Wi=HB(),KA=Ih(gu)});function B(...t){oe().debug&&console.log(...t)}function ie(...t){oe().debug&&console.error(...t)}function $t(...t){oe().debug&&console.warn(...t)}var Kt=b(()=>{bt()});var Cet=x((USe,KB)=>{(function(t,e){typeof USe=="object"&&typeof KB<"u"?KB.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(USe,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(v){t=v}function n(v){return v instanceof Array||Object.prototype.toString.call(v)==="[object Array]"}function o(v){return v!=null&&Object.prototype.toString.call(v)==="[object Object]"}function i(v,O){return Object.prototype.hasOwnProperty.call(v,O)}function a(v){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(v).length===0;var O;for(O in v)if(i(v,O))return!1;return!0}function s(v){return v===void 0}function u(v){return typeof v=="number"||Object.prototype.toString.call(v)==="[object Number]"}function l(v){return v instanceof Date||Object.prototype.toString.call(v)==="[object Date]"}function c(v,O){var A=[],R,$=v.length;for(R=0;R<$;++R)A.push(O(v[R],R));return A}function d(v,O){for(var A in O)i(O,A)&&(v[A]=O[A]);return i(O,"toString")&&(v.toString=O.toString),i(O,"valueOf")&&(v.valueOf=O.valueOf),v}function f(v,O,A,R){return XKe(v,O,A,R,!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 h(v){return v._pf==null&&(v._pf=p()),v._pf}var m;Array.prototype.some?m=Array.prototype.some:m=function(v){var O=Object(this),A=O.length>>>0,R;for(R=0;R<A;R++)if(R in O&&v.call(this,O[R],R,O))return!0;return!1};function g(v){if(v._isValid==null){var O=h(v),A=m.call(O.parsedDateParts,function($){return $!=null}),R=!isNaN(v._d.getTime())&&O.overflow<0&&!O.empty&&!O.invalidEra&&!O.invalidMonth&&!O.invalidWeekday&&!O.weekdayMismatch&&!O.nullInput&&!O.invalidFormat&&!O.userInvalidated&&(!O.meridiem||O.meridiem&&A);if(v._strict&&(R=R&&O.charsLeftOver===0&&O.unusedTokens.length===0&&O.bigHour===void 0),Object.isFrozen==null||!Object.isFrozen(v))v._isValid=R;else return R}return v._isValid}function y(v){var O=f(NaN);return v!=null?d(h(O),v):h(O).userInvalidated=!0,O}var _=e.momentProperties=[],w=!1;function S(v,O){var A,R,$,te=_.length;if(s(O._isAMomentObject)||(v._isAMomentObject=O._isAMomentObject),s(O._i)||(v._i=O._i),s(O._f)||(v._f=O._f),s(O._l)||(v._l=O._l),s(O._strict)||(v._strict=O._strict),s(O._tzm)||(v._tzm=O._tzm),s(O._isUTC)||(v._isUTC=O._isUTC),s(O._offset)||(v._offset=O._offset),s(O._pf)||(v._pf=h(O)),s(O._locale)||(v._locale=O._locale),te>0)for(A=0;A<te;A++)R=_[A],$=O[R],s($)||(v[R]=$);return v}function C(v){S(this,v),this._d=new Date(v._d!=null?v._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),w===!1&&(w=!0,e.updateOffset(this),w=!1)}function E(v){return v instanceof C||v!=null&&v._isAMomentObject!=null}function P(v){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+v)}function T(v,O){var A=!0;return d(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,v),A){var R=[],$,te,we,dr=arguments.length;for(te=0;te<dr;te++){if($="",typeof arguments[te]=="object"){$+=`
[`+te+"] ";for(we in arguments[0])i(arguments[0],we)&&($+=we+": "+arguments[0][we]+", ");$=$.slice(0,-2)}else $=arguments[te];R.push($)}P(v+`
Arguments: `+Array.prototype.slice.call(R).join("")+`
`+new Error().stack),A=!1}return O.apply(this,arguments)},O)}var I={};function N(v,O){e.deprecationHandler!=null&&e.deprecationHandler(v,O),I[v]||(P(O),I[v]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function M(v){return typeof Function<"u"&&v instanceof Function||Object.prototype.toString.call(v)==="[object Function]"}function D(v){var O,A;for(A in v)i(v,A)&&(O=v[A],M(O)?this[A]=O:this["_"+A]=O);this._config=v,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function k(v,O){var A=d({},v),R;for(R in O)i(O,R)&&(o(v[R])&&o(O[R])?(A[R]={},d(A[R],v[R]),d(A[R],O[R])):O[R]!=null?A[R]=O[R]:delete A[R]);for(R in v)i(v,R)&&!i(O,R)&&o(v[R])&&(A[R]=d({},A[R]));return A}function F(v){v!=null&&this.set(v)}var K;Object.keys?K=Object.keys:K=function(v){var O,A=[];for(O in v)i(v,O)&&A.push(O);return A};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 Y(v,O,A){var R=this._calendar[v]||this._calendar.sameElse;return M(R)?R.call(O,A):R}function ee(v,O,A){var R=""+Math.abs(v),$=O-R.length,te=v>=0;return(te?A?"+":"":"-")+Math.pow(10,Math.max(0,$)).toString().substr(1)+R}var L=/(\[[^\[]*\])|(\\)?([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,Q=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,z={},W={};function V(v,O,A,R){var $=R;typeof R=="string"&&($=function(){return this[R]()}),v&&(W[v]=$),O&&(W[O[0]]=function(){return ee($.apply(this,arguments),O[1],O[2])}),A&&(W[A]=function(){return this.localeData().ordinal($.apply(this,arguments),v)})}function q(v){return v.match(/\[[\s\S]/)?v.replace(/^\[|\]$/g,""):v.replace(/\\/g,"")}function H(v){var O=v.match(L),A,R;for(A=0,R=O.length;A<R;A++)W[O[A]]?O[A]=W[O[A]]:O[A]=q(O[A]);return function($){var te="",we;for(we=0;we<R;we++)te+=M(O[we])?O[we].call($,v):O[we];return te}}function G(v,O){return v.isValid()?(O=Z(O,v.localeData()),z[O]=z[O]||H(O),z[O](v)):v.localeData().invalidDate()}function Z(v,O){var A=5;function R($){return O.longDateFormat($)||$}for(Q.lastIndex=0;A>=0&&Q.test(v);)v=v.replace(Q,R),Q.lastIndex=0,A-=1;return v}var de={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 pe(v){var O=this._longDateFormat[v],A=this._longDateFormat[v.toUpperCase()];return O||!A?O:(this._longDateFormat[v]=A.match(L).map(function(R){return R==="MMMM"||R==="MM"||R==="DD"||R==="dddd"?R.slice(1):R}).join(""),this._longDateFormat[v])}var ae="Invalid date";function Te(){return this._invalidDate}var Ae="%d",ke=/\d{1,2}/;function St(v){return this._ordinal.replace("%d",v)}var Nr={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 Ir(v,O,A,R){var $=this._relativeTime[A];return M($)?$(v,O,A,R):$.replace(/%d/i,v)}function Hn(v,O){var A=this._relativeTime[v>0?"future":"past"];return M(A)?A(O):A.replace(/%s/i,O)}var Yr={};function Sr(v,O){var A=v.toLowerCase();Yr[A]=Yr[A+"s"]=Yr[O]=v}function Me(v){return typeof v=="string"?Yr[v]||Yr[v.toLowerCase()]:void 0}function Ge(v){var O={},A,R;for(R in v)i(v,R)&&(A=Me(R),A&&(O[A]=v[R]));return O}var je={};function le(v,O){je[v]=O}function ne(v){var O=[],A;for(A in v)i(v,A)&&O.push({unit:A,priority:je[A]});return O.sort(function(R,$){return R.priority-$.priority}),O}function fe(v){return v%4===0&&v%100!==0||v%400===0}function be(v){return v<0?Math.ceil(v)||0:Math.floor(v)}function ye(v){var O=+v,A=0;return O!==0&&isFinite(O)&&(A=be(O)),A}function ze(v,O){return function(A){return A!=null?(Ti(this,v,A),e.updateOffset(this,O),this):mr(this,v)}}function mr(v,O){return v.isValid()?v._d["get"+(v._isUTC?"UTC":"")+O]():NaN}function Ti(v,O,A){v.isValid()&&!isNaN(A)&&(O==="FullYear"&&fe(v.year())&&v.month()===1&&v.date()===29?(A=ye(A),v._d["set"+(v._isUTC?"UTC":"")+O](A,v.month(),dX(A,v.month()))):v._d["set"+(v._isUTC?"UTC":"")+O](A))}function yi(v){return v=Me(v),M(this[v])?this[v]():this}function yf(v,O){if(typeof v=="object"){v=Ge(v);var A=ne(v),R,$=A.length;for(R=0;R<$;R++)this[A[R].unit](v[A[R].unit])}else if(v=Me(v),M(this[v]))return this[v](O);return this}var fp=/\d/,qi=/\d\d/,md=/\d{3}/,hd=/\d{4}/,bf=/[+-]?\d{6}/,Vn=/\d\d?/,wA=/\d\d\d\d?/,RN=/\d\d\d\d\d\d?/,xA=/\d{1,3}/,Ts=/\d{1,4}/,pu=/[+-]?\d{1,6}/,rs=/\d+/,pp=/[+-]?\d+/,_f=/Z|[+-]\d\d:?\d\d/gi,Ws=/Z|[+-]\d\d(?::?\d\d)?/gi,um=/[+-]?\d+(\.\d{1,3})?/,mp=/[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,Zn;Zn={};function Qe(v,O,A){Zn[v]=M(O)?O:function(R,$){return R&&A?A:O}}function hp(v,O){return i(Zn,v)?Zn[v](O._strict,O._locale):new RegExp(xh(v))}function xh(v){return Xl(v.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(O,A,R,$,te){return A||R||$||te}))}function Xl(v){return v.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var JO={};function Wn(v,O){var A,R=O,$;for(typeof v=="string"&&(v=[v]),u(O)&&(R=function(te,we){we[O]=ye(te)}),$=v.length,A=0;A<$;A++)JO[v[A]]=R}function wb(v,O){Wn(v,function(A,R,$,te){$._w=$._w||{},O(A,$._w,$,te)})}function HV(v,O,A){O!=null&&i(JO,v)&&JO[v](O,A._a,A,v)}var vf=0,ZO=1,pv=2,Ql=3,xb=4,YO=5,NN=6,Syr=7,Cyr=8;function Oyr(v,O){return(v%O+O)%O}var Ks;Array.prototype.indexOf?Ks=Array.prototype.indexOf:Ks=function(v){var O;for(O=0;O<this.length;++O)if(this[O]===v)return O;return-1};function dX(v,O){if(isNaN(v)||isNaN(O))return NaN;var A=Oyr(O,12);return v+=(O-A)/12,A===1?fe(v)?29:28:31-A%7%2}V("M",["MM",2],"Mo",function(){return this.month()+1}),V("MMM",0,0,function(v){return this.localeData().monthsShort(this,v)}),V("MMMM",0,0,function(v){return this.localeData().months(this,v)}),Sr("month","M"),le("month",8),Qe("M",Vn),Qe("MM",Vn,qi),Qe("MMM",function(v,O){return O.monthsShortRegex(v)}),Qe("MMMM",function(v,O){return O.monthsRegex(v)}),Wn(["M","MM"],function(v,O){O[ZO]=ye(v)-1}),Wn(["MMM","MMMM"],function(v,O,A,R){var $=A._locale.monthsParse(v,R,A._strict);$!=null?O[ZO]=$:h(A).invalidMonth=v});var Eyr="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),FKe="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),kKe=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Pyr=mp,Tyr=mp;function Ayr(v,O){return v?n(this._months)?this._months[v.month()]:this._months[(this._months.isFormat||kKe).test(O)?"format":"standalone"][v.month()]:n(this._months)?this._months:this._months.standalone}function Iyr(v,O){return v?n(this._monthsShort)?this._monthsShort[v.month()]:this._monthsShort[kKe.test(O)?"format":"standalone"][v.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Myr(v,O,A){var R,$,te,we=v.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],R=0;R<12;++R)te=f([2e3,R]),this._shortMonthsParse[R]=this.monthsShort(te,"").toLocaleLowerCase(),this._longMonthsParse[R]=this.months(te,"").toLocaleLowerCase();return A?O==="MMM"?($=Ks.call(this._shortMonthsParse,we),$!==-1?$:null):($=Ks.call(this._longMonthsParse,we),$!==-1?$:null):O==="MMM"?($=Ks.call(this._shortMonthsParse,we),$!==-1?$:($=Ks.call(this._longMonthsParse,we),$!==-1?$:null)):($=Ks.call(this._longMonthsParse,we),$!==-1?$:($=Ks.call(this._shortMonthsParse,we),$!==-1?$:null))}function Ryr(v,O,A){var R,$,te;if(this._monthsParseExact)return Myr.call(this,v,O,A);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),R=0;R<12;R++){if($=f([2e3,R]),A&&!this._longMonthsParse[R]&&(this._longMonthsParse[R]=new RegExp("^"+this.months($,"").replace(".","")+"$","i"),this._shortMonthsParse[R]=new RegExp("^"+this.monthsShort($,"").replace(".","")+"$","i")),!A&&!this._monthsParse[R]&&(te="^"+this.months($,"")+"|^"+this.monthsShort($,""),this._monthsParse[R]=new RegExp(te.replace(".",""),"i")),A&&O==="MMMM"&&this._longMonthsParse[R].test(v))return R;if(A&&O==="MMM"&&this._shortMonthsParse[R].test(v))return R;if(!A&&this._monthsParse[R].test(v))return R}}function $Ke(v,O){var A;if(!v.isValid())return v;if(typeof O=="string"){if(/^\d+$/.test(O))O=ye(O);else if(O=v.localeData().monthsParse(O),!u(O))return v}return A=Math.min(v.date(),dX(v.year(),O)),v._d["set"+(v._isUTC?"UTC":"")+"Month"](O,A),v}function BKe(v){return v!=null?($Ke(this,v),e.updateOffset(this,!0),this):mr(this,"Month")}function Nyr(){return dX(this.year(),this.month())}function jyr(v){return this._monthsParseExact?(i(this,"_monthsRegex")||zKe.call(this),v?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=Pyr),this._monthsShortStrictRegex&&v?this._monthsShortStrictRegex:this._monthsShortRegex)}function Dyr(v){return this._monthsParseExact?(i(this,"_monthsRegex")||zKe.call(this),v?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=Tyr),this._monthsStrictRegex&&v?this._monthsStrictRegex:this._monthsRegex)}function zKe(){function v(we,dr){return dr.length-we.length}var O=[],A=[],R=[],$,te;for($=0;$<12;$++)te=f([2e3,$]),O.push(this.monthsShort(te,"")),A.push(this.months(te,"")),R.push(this.months(te,"")),R.push(this.monthsShort(te,""));for(O.sort(v),A.sort(v),R.sort(v),$=0;$<12;$++)O[$]=Xl(O[$]),A[$]=Xl(A[$]);for($=0;$<24;$++)R[$]=Xl(R[$]);this._monthsRegex=new RegExp("^("+R.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+A.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+O.join("|")+")","i")}V("Y",0,0,function(){var v=this.year();return v<=9999?ee(v,4):"+"+v}),V(0,["YY",2],0,function(){return this.year()%100}),V(0,["YYYY",4],0,"year"),V(0,["YYYYY",5],0,"year"),V(0,["YYYYYY",6,!0],0,"year"),Sr("year","y"),le("year",1),Qe("Y",pp),Qe("YY",Vn,qi),Qe("YYYY",Ts,hd),Qe("YYYYY",pu,bf),Qe("YYYYYY",pu,bf),Wn(["YYYYY","YYYYYY"],vf),Wn("YYYY",function(v,O){O[vf]=v.length===2?e.parseTwoDigitYear(v):ye(v)}),Wn("YY",function(v,O){O[vf]=e.parseTwoDigitYear(v)}),Wn("Y",function(v,O){O[vf]=parseInt(v,10)});function VV(v){return fe(v)?366:365}e.parseTwoDigitYear=function(v){return ye(v)+(ye(v)>68?1900:2e3)};var UKe=ze("FullYear",!0);function Lyr(){return fe(this.year())}function Fyr(v,O,A,R,$,te,we){var dr;return v<100&&v>=0?(dr=new Date(v+400,O,A,R,$,te,we),isFinite(dr.getFullYear())&&dr.setFullYear(v)):dr=new Date(v,O,A,R,$,te,we),dr}function WV(v){var O,A;return v<100&&v>=0?(A=Array.prototype.slice.call(arguments),A[0]=v+400,O=new Date(Date.UTC.apply(null,A)),isFinite(O.getUTCFullYear())&&O.setUTCFullYear(v)):O=new Date(Date.UTC.apply(null,arguments)),O}function fX(v,O,A){var R=7+O-A,$=(7+WV(v,0,R).getUTCDay()-O)%7;return-$+R-1}function qKe(v,O,A,R,$){var te=(7+A-R)%7,we=fX(v,R,$),dr=1+7*(O-1)+te+we,Pn,Hi;return dr<=0?(Pn=v-1,Hi=VV(Pn)+dr):dr>VV(v)?(Pn=v+1,Hi=dr-VV(v)):(Pn=v,Hi=dr),{year:Pn,dayOfYear:Hi}}function KV(v,O,A){var R=fX(v.year(),O,A),$=Math.floor((v.dayOfYear()-R-1)/7)+1,te,we;return $<1?(we=v.year()-1,te=$+XO(we,O,A)):$>XO(v.year(),O,A)?(te=$-XO(v.year(),O,A),we=v.year()+1):(we=v.year(),te=$),{week:te,year:we}}function XO(v,O,A){var R=fX(v,O,A),$=fX(v+1,O,A);return(VV(v)-R+$)/7}V("w",["ww",2],"wo","week"),V("W",["WW",2],"Wo","isoWeek"),Sr("week","w"),Sr("isoWeek","W"),le("week",5),le("isoWeek",5),Qe("w",Vn),Qe("ww",Vn,qi),Qe("W",Vn),Qe("WW",Vn,qi),wb(["w","ww","W","WW"],function(v,O,A,R){O[R.substr(0,1)]=ye(v)});function kyr(v){return KV(v,this._week.dow,this._week.doy).week}var $yr={dow:0,doy:6};function Byr(){return this._week.dow}function zyr(){return this._week.doy}function Uyr(v){var O=this.localeData().week(this);return v==null?O:this.add((v-O)*7,"d")}function qyr(v){var O=KV(this,1,4).week;return v==null?O:this.add((v-O)*7,"d")}V("d",0,"do","day"),V("dd",0,0,function(v){return this.localeData().weekdaysMin(this,v)}),V("ddd",0,0,function(v){return this.localeData().weekdaysShort(this,v)}),V("dddd",0,0,function(v){return this.localeData().weekdays(this,v)}),V("e",0,0,"weekday"),V("E",0,0,"isoWeekday"),Sr("day","d"),Sr("weekday","e"),Sr("isoWeekday","E"),le("day",11),le("weekday",11),le("isoWeekday",11),Qe("d",Vn),Qe("e",Vn),Qe("E",Vn),Qe("dd",function(v,O){return O.weekdaysMinRegex(v)}),Qe("ddd",function(v,O){return O.weekdaysShortRegex(v)}),Qe("dddd",function(v,O){return O.weekdaysRegex(v)}),wb(["dd","ddd","dddd"],function(v,O,A,R){var $=A._locale.weekdaysParse(v,R,A._strict);$!=null?O.d=$:h(A).invalidWeekday=v}),wb(["d","e","E"],function(v,O,A,R){O[R]=ye(v)});function Hyr(v,O){return typeof v!="string"?v:isNaN(v)?(v=O.weekdaysParse(v),typeof v=="number"?v:null):parseInt(v,10)}function Vyr(v,O){return typeof v=="string"?O.weekdaysParse(v)%7||7:isNaN(v)?null:v}function ewe(v,O){return v.slice(O,7).concat(v.slice(0,O))}var Wyr="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),HKe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Kyr="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Gyr=mp,Jyr=mp,Zyr=mp;function Yyr(v,O){var A=n(this._weekdays)?this._weekdays:this._weekdays[v&&v!==!0&&this._weekdays.isFormat.test(O)?"format":"standalone"];return v===!0?ewe(A,this._week.dow):v?A[v.day()]:A}function Xyr(v){return v===!0?ewe(this._weekdaysShort,this._week.dow):v?this._weekdaysShort[v.day()]:this._weekdaysShort}function Qyr(v){return v===!0?ewe(this._weekdaysMin,this._week.dow):v?this._weekdaysMin[v.day()]:this._weekdaysMin}function ebr(v,O,A){var R,$,te,we=v.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],R=0;R<7;++R)te=f([2e3,1]).day(R),this._minWeekdaysParse[R]=this.weekdaysMin(te,"").toLocaleLowerCase(),this._shortWeekdaysParse[R]=this.weekdaysShort(te,"").toLocaleLowerCase(),this._weekdaysParse[R]=this.weekdays(te,"").toLocaleLowerCase();return A?O==="dddd"?($=Ks.call(this._weekdaysParse,we),$!==-1?$:null):O==="ddd"?($=Ks.call(this._shortWeekdaysParse,we),$!==-1?$:null):($=Ks.call(this._minWeekdaysParse,we),$!==-1?$:null):O==="dddd"?($=Ks.call(this._weekdaysParse,we),$!==-1||($=Ks.call(this._shortWeekdaysParse,we),$!==-1)?$:($=Ks.call(this._minWeekdaysParse,we),$!==-1?$:null)):O==="ddd"?($=Ks.call(this._shortWeekdaysParse,we),$!==-1||($=Ks.call(this._weekdaysParse,we),$!==-1)?$:($=Ks.call(this._minWeekdaysParse,we),$!==-1?$:null)):($=Ks.call(this._minWeekdaysParse,we),$!==-1||($=Ks.call(this._weekdaysParse,we),$!==-1)?$:($=Ks.call(this._shortWeekdaysParse,we),$!==-1?$:null))}function tbr(v,O,A){var R,$,te;if(this._weekdaysParseExact)return ebr.call(this,v,O,A);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),R=0;R<7;R++){if($=f([2e3,1]).day(R),A&&!this._fullWeekdaysParse[R]&&(this._fullWeekdaysParse[R]=new RegExp("^"+this.weekdays($,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[R]=new RegExp("^"+this.weekdaysShort($,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[R]=new RegExp("^"+this.weekdaysMin($,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[R]||(te="^"+this.weekdays($,"")+"|^"+this.weekdaysShort($,"")+"|^"+this.weekdaysMin($,""),this._weekdaysParse[R]=new RegExp(te.replace(".",""),"i")),A&&O==="dddd"&&this._fullWeekdaysParse[R].test(v))return R;if(A&&O==="ddd"&&this._shortWeekdaysParse[R].test(v))return R;if(A&&O==="dd"&&this._minWeekdaysParse[R].test(v))return R;if(!A&&this._weekdaysParse[R].test(v))return R}}function rbr(v){if(!this.isValid())return v!=null?this:NaN;var O=this._isUTC?this._d.getUTCDay():this._d.getDay();return v!=null?(v=Hyr(v,this.localeData()),this.add(v-O,"d")):O}function nbr(v){if(!this.isValid())return v!=null?this:NaN;var O=(this.day()+7-this.localeData()._week.dow)%7;return v==null?O:this.add(v-O,"d")}function obr(v){if(!this.isValid())return v!=null?this:NaN;if(v!=null){var O=Vyr(v,this.localeData());return this.day(this.day()%7?O:O-7)}else return this.day()||7}function ibr(v){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||twe.call(this),v?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=Gyr),this._weekdaysStrictRegex&&v?this._weekdaysStrictRegex:this._weekdaysRegex)}function abr(v){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||twe.call(this),v?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Jyr),this._weekdaysShortStrictRegex&&v?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function sbr(v){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||twe.call(this),v?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Zyr),this._weekdaysMinStrictRegex&&v?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function twe(){function v(gp,nE){return nE.length-gp.length}var O=[],A=[],R=[],$=[],te,we,dr,Pn,Hi;for(te=0;te<7;te++)we=f([2e3,1]).day(te),dr=Xl(this.weekdaysMin(we,"")),Pn=Xl(this.weekdaysShort(we,"")),Hi=Xl(this.weekdays(we,"")),O.push(dr),A.push(Pn),R.push(Hi),$.push(dr),$.push(Pn),$.push(Hi);O.sort(v),A.sort(v),R.sort(v),$.sort(v),this._weekdaysRegex=new RegExp("^("+$.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+R.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+A.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+O.join("|")+")","i")}function rwe(){return this.hours()%12||12}function ubr(){return this.hours()||24}V("H",["HH",2],0,"hour"),V("h",["hh",2],0,rwe),V("k",["kk",2],0,ubr),V("hmm",0,0,function(){return""+rwe.apply(this)+ee(this.minutes(),2)}),V("hmmss",0,0,function(){return""+rwe.apply(this)+ee(this.minutes(),2)+ee(this.seconds(),2)}),V("Hmm",0,0,function(){return""+this.hours()+ee(this.minutes(),2)}),V("Hmmss",0,0,function(){return""+this.hours()+ee(this.minutes(),2)+ee(this.seconds(),2)});function VKe(v,O){V(v,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),O)})}VKe("a",!0),VKe("A",!1),Sr("hour","h"),le("hour",13);function WKe(v,O){return O._meridiemParse}Qe("a",WKe),Qe("A",WKe),Qe("H",Vn),Qe("h",Vn),Qe("k",Vn),Qe("HH",Vn,qi),Qe("hh",Vn,qi),Qe("kk",Vn,qi),Qe("hmm",wA),Qe("hmmss",RN),Qe("Hmm",wA),Qe("Hmmss",RN),Wn(["H","HH"],Ql),Wn(["k","kk"],function(v,O,A){var R=ye(v);O[Ql]=R===24?0:R}),Wn(["a","A"],function(v,O,A){A._isPm=A._locale.isPM(v),A._meridiem=v}),Wn(["h","hh"],function(v,O,A){O[Ql]=ye(v),h(A).bigHour=!0}),Wn("hmm",function(v,O,A){var R=v.length-2;O[Ql]=ye(v.substr(0,R)),O[xb]=ye(v.substr(R)),h(A).bigHour=!0}),Wn("hmmss",function(v,O,A){var R=v.length-4,$=v.length-2;O[Ql]=ye(v.substr(0,R)),O[xb]=ye(v.substr(R,2)),O[YO]=ye(v.substr($)),h(A).bigHour=!0}),Wn("Hmm",function(v,O,A){var R=v.length-2;O[Ql]=ye(v.substr(0,R)),O[xb]=ye(v.substr(R))}),Wn("Hmmss",function(v,O,A){var R=v.length-4,$=v.length-2;O[Ql]=ye(v.substr(0,R)),O[xb]=ye(v.substr(R,2)),O[YO]=ye(v.substr($))});function lbr(v){return(v+"").toLowerCase().charAt(0)==="p"}var cbr=/[ap]\.?m?\.?/i,dbr=ze("Hours",!0);function fbr(v,O,A){return v>11?A?"pm":"PM":A?"am":"AM"}var KKe={calendar:U,longDateFormat:de,invalidDate:ae,ordinal:Ae,dayOfMonthOrdinalParse:ke,relativeTime:Nr,months:Eyr,monthsShort:FKe,week:$yr,weekdays:Wyr,weekdaysMin:Kyr,weekdaysShort:HKe,meridiemParse:cbr},Fa={},GV={},JV;function pbr(v,O){var A,R=Math.min(v.length,O.length);for(A=0;A<R;A+=1)if(v[A]!==O[A])return A;return R}function GKe(v){return v&&v.toLowerCase().replace("_","-")}function mbr(v){for(var O=0,A,R,$,te;O<v.length;){for(te=GKe(v[O]).split("-"),A=te.length,R=GKe(v[O+1]),R=R?R.split("-"):null;A>0;){if($=pX(te.slice(0,A).join("-")),$)return $;if(R&&R.length>=A&&pbr(te,R)>=A-1)break;A--}O++}return JV}function hbr(v){return v.match("^[^/\\\\]*$")!=null}function pX(v){var O=null,A;if(Fa[v]===void 0&&typeof KB<"u"&&KB&&KB.exports&&hbr(v))try{O=JV._abbr,A=require,A("./locale/"+v),SA(O)}catch{Fa[v]=null}return Fa[v]}function SA(v,O){var A;return v&&(s(O)?A=QO(v):A=nwe(v,O),A?JV=A:typeof console<"u"&&console.warn&&console.warn("Locale "+v+" not found. Did you forget to load it?")),JV._abbr}function nwe(v,O){if(O!==null){var A,R=KKe;if(O.abbr=v,Fa[v]!=null)N("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."),R=Fa[v]._config;else if(O.parentLocale!=null)if(Fa[O.parentLocale]!=null)R=Fa[O.parentLocale]._config;else if(A=pX(O.parentLocale),A!=null)R=A._config;else return GV[O.parentLocale]||(GV[O.parentLocale]=[]),GV[O.parentLocale].push({name:v,config:O}),null;return Fa[v]=new F(k(R,O)),GV[v]&&GV[v].forEach(function($){nwe($.name,$.config)}),SA(v),Fa[v]}else return delete Fa[v],null}function gbr(v,O){if(O!=null){var A,R,$=KKe;Fa[v]!=null&&Fa[v].parentLocale!=null?Fa[v].set(k(Fa[v]._config,O)):(R=pX(v),R!=null&&($=R._config),O=k($,O),R==null&&(O.abbr=v),A=new F(O),A.parentLocale=Fa[v],Fa[v]=A),SA(v)}else Fa[v]!=null&&(Fa[v].parentLocale!=null?(Fa[v]=Fa[v].parentLocale,v===SA()&&SA(v)):Fa[v]!=null&&delete Fa[v]);return Fa[v]}function QO(v){var O;if(v&&v._locale&&v._locale._abbr&&(v=v._locale._abbr),!v)return JV;if(!n(v)){if(O=pX(v),O)return O;v=[v]}return mbr(v)}function ybr(){return K(Fa)}function owe(v){var O,A=v._a;return A&&h(v).overflow===-2&&(O=A[ZO]<0||A[ZO]>11?ZO:A[pv]<1||A[pv]>dX(A[vf],A[ZO])?pv:A[Ql]<0||A[Ql]>24||A[Ql]===24&&(A[xb]!==0||A[YO]!==0||A[NN]!==0)?Ql:A[xb]<0||A[xb]>59?xb:A[YO]<0||A[YO]>59?YO:A[NN]<0||A[NN]>999?NN:-1,h(v)._overflowDayOfYear&&(O<vf||O>pv)&&(O=pv),h(v)._overflowWeeks&&O===-1&&(O=Syr),h(v)._overflowWeekday&&O===-1&&(O=Cyr),h(v).overflow=O),v}var bbr=/^\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)?)?$/,_br=/^\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)?)?$/,vbr=/Z|[+-]\d\d(?::?\d\d)?/,mX=[["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]],iwe=[["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/]],wbr=/^\/?Date\((-?\d+)/i,xbr=/^(?:(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}))$/,Sbr={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 JKe(v){var O,A,R=v._i,$=bbr.exec(R)||_br.exec(R),te,we,dr,Pn,Hi=mX.length,gp=iwe.length;if($){for(h(v).iso=!0,O=0,A=Hi;O<A;O++)if(mX[O][1].exec($[1])){we=mX[O][0],te=mX[O][2]!==!1;break}if(we==null){v._isValid=!1;return}if($[3]){for(O=0,A=gp;O<A;O++)if(iwe[O][1].exec($[3])){dr=($[2]||" ")+iwe[O][0];break}if(dr==null){v._isValid=!1;return}}if(!te&&dr!=null){v._isValid=!1;return}if($[4])if(vbr.exec($[4]))Pn="Z";else{v._isValid=!1;return}v._f=we+(dr||"")+(Pn||""),swe(v)}else v._isValid=!1}function Cbr(v,O,A,R,$,te){var we=[Obr(v),FKe.indexOf(O),parseInt(A,10),parseInt(R,10),parseInt($,10)];return te&&we.push(parseInt(te,10)),we}function Obr(v){var O=parseInt(v,10);return O<=49?2e3+O:O<=999?1900+O:O}function Ebr(v){return v.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Pbr(v,O,A){if(v){var R=HKe.indexOf(v),$=new Date(O[0],O[1],O[2]).getDay();if(R!==$)return h(A).weekdayMismatch=!0,A._isValid=!1,!1}return!0}function Tbr(v,O,A){if(v)return Sbr[v];if(O)return 0;var R=parseInt(A,10),$=R%100,te=(R-$)/100;return te*60+$}function ZKe(v){var O=xbr.exec(Ebr(v._i)),A;if(O){if(A=Cbr(O[4],O[3],O[2],O[5],O[6],O[7]),!Pbr(O[1],A,v))return;v._a=A,v._tzm=Tbr(O[8],O[9],O[10]),v._d=WV.apply(null,v._a),v._d.setUTCMinutes(v._d.getUTCMinutes()-v._tzm),h(v).rfc2822=!0}else v._isValid=!1}function Abr(v){var O=wbr.exec(v._i);if(O!==null){v._d=new Date(+O[1]);return}if(JKe(v),v._isValid===!1)delete v._isValid;else return;if(ZKe(v),v._isValid===!1)delete v._isValid;else return;v._strict?v._isValid=!1:e.createFromInputFallback(v)}e.createFromInputFallback=T("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(v){v._d=new Date(v._i+(v._useUTC?" UTC":""))});function eB(v,O,A){return v??O??A}function Ibr(v){var O=new Date(e.now());return v._useUTC?[O.getUTCFullYear(),O.getUTCMonth(),O.getUTCDate()]:[O.getFullYear(),O.getMonth(),O.getDate()]}function awe(v){var O,A,R=[],$,te,we;if(!v._d){for($=Ibr(v),v._w&&v._a[pv]==null&&v._a[ZO]==null&&Mbr(v),v._dayOfYear!=null&&(we=eB(v._a[vf],$[vf]),(v._dayOfYear>VV(we)||v._dayOfYear===0)&&(h(v)._overflowDayOfYear=!0),A=WV(we,0,v._dayOfYear),v._a[ZO]=A.getUTCMonth(),v._a[pv]=A.getUTCDate()),O=0;O<3&&v._a[O]==null;++O)v._a[O]=R[O]=$[O];for(;O<7;O++)v._a[O]=R[O]=v._a[O]==null?O===2?1:0:v._a[O];v._a[Ql]===24&&v._a[xb]===0&&v._a[YO]===0&&v._a[NN]===0&&(v._nextDay=!0,v._a[Ql]=0),v._d=(v._useUTC?WV:Fyr).apply(null,R),te=v._useUTC?v._d.getUTCDay():v._d.getDay(),v._tzm!=null&&v._d.setUTCMinutes(v._d.getUTCMinutes()-v._tzm),v._nextDay&&(v._a[Ql]=24),v._w&&typeof v._w.d<"u"&&v._w.d!==te&&(h(v).weekdayMismatch=!0)}}function Mbr(v){var O,A,R,$,te,we,dr,Pn,Hi;O=v._w,O.GG!=null||O.W!=null||O.E!=null?(te=1,we=4,A=eB(O.GG,v._a[vf],KV(ya(),1,4).year),R=eB(O.W,1),$=eB(O.E,1),($<1||$>7)&&(Pn=!0)):(te=v._locale._week.dow,we=v._locale._week.doy,Hi=KV(ya(),te,we),A=eB(O.gg,v._a[vf],Hi.year),R=eB(O.w,Hi.week),O.d!=null?($=O.d,($<0||$>6)&&(Pn=!0)):O.e!=null?($=O.e+te,(O.e<0||O.e>6)&&(Pn=!0)):$=te),R<1||R>XO(A,te,we)?h(v)._overflowWeeks=!0:Pn!=null?h(v)._overflowWeekday=!0:(dr=qKe(A,R,$,te,we),v._a[vf]=dr.year,v._dayOfYear=dr.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function swe(v){if(v._f===e.ISO_8601){JKe(v);return}if(v._f===e.RFC_2822){ZKe(v);return}v._a=[],h(v).empty=!0;var O=""+v._i,A,R,$,te,we,dr=O.length,Pn=0,Hi,gp;for($=Z(v._f,v._locale).match(L)||[],gp=$.length,A=0;A<gp;A++)te=$[A],R=(O.match(hp(te,v))||[])[0],R&&(we=O.substr(0,O.indexOf(R)),we.length>0&&h(v).unusedInput.push(we),O=O.slice(O.indexOf(R)+R.length),Pn+=R.length),W[te]?(R?h(v).empty=!1:h(v).unusedTokens.push(te),HV(te,R,v)):v._strict&&!R&&h(v).unusedTokens.push(te);h(v).charsLeftOver=dr-Pn,O.length>0&&h(v).unusedInput.push(O),v._a[Ql]<=12&&h(v).bigHour===!0&&v._a[Ql]>0&&(h(v).bigHour=void 0),h(v).parsedDateParts=v._a.slice(0),h(v).meridiem=v._meridiem,v._a[Ql]=Rbr(v._locale,v._a[Ql],v._meridiem),Hi=h(v).era,Hi!==null&&(v._a[vf]=v._locale.erasConvertYear(Hi,v._a[vf])),awe(v),owe(v)}function Rbr(v,O,A){var R;return A==null?O:v.meridiemHour!=null?v.meridiemHour(O,A):(v.isPM!=null&&(R=v.isPM(A),R&&O<12&&(O+=12),!R&&O===12&&(O=0)),O)}function Nbr(v){var O,A,R,$,te,we,dr=!1,Pn=v._f.length;if(Pn===0){h(v).invalidFormat=!0,v._d=new Date(NaN);return}for($=0;$<Pn;$++)te=0,we=!1,O=S({},v),v._useUTC!=null&&(O._useUTC=v._useUTC),O._f=v._f[$],swe(O),g(O)&&(we=!0),te+=h(O).charsLeftOver,te+=h(O).unusedTokens.length*10,h(O).score=te,dr?te<R&&(R=te,A=O):(R==null||te<R||we)&&(R=te,A=O,we&&(dr=!0));d(v,A||O)}function jbr(v){if(!v._d){var O=Ge(v._i),A=O.day===void 0?O.date:O.day;v._a=c([O.year,O.month,A,O.hour,O.minute,O.second,O.millisecond],function(R){return R&&parseInt(R,10)}),awe(v)}}function Dbr(v){var O=new C(owe(YKe(v)));return O._nextDay&&(O.add(1,"d"),O._nextDay=void 0),O}function YKe(v){var O=v._i,A=v._f;return v._locale=v._locale||QO(v._l),O===null||A===void 0&&O===""?y({nullInput:!0}):(typeof O=="string"&&(v._i=O=v._locale.preparse(O)),E(O)?new C(owe(O)):(l(O)?v._d=O:n(A)?Nbr(v):A?swe(v):Lbr(v),g(v)||(v._d=null),v))}function Lbr(v){var O=v._i;s(O)?v._d=new Date(e.now()):l(O)?v._d=new Date(O.valueOf()):typeof O=="string"?Abr(v):n(O)?(v._a=c(O.slice(0),function(A){return parseInt(A,10)}),awe(v)):o(O)?jbr(v):u(O)?v._d=new Date(O):e.createFromInputFallback(v)}function XKe(v,O,A,R,$){var te={};return(O===!0||O===!1)&&(R=O,O=void 0),(A===!0||A===!1)&&(R=A,A=void 0),(o(v)&&a(v)||n(v)&&v.length===0)&&(v=void 0),te._isAMomentObject=!0,te._useUTC=te._isUTC=$,te._l=A,te._i=v,te._f=O,te._strict=R,Dbr(te)}function ya(v,O,A,R){return XKe(v,O,A,R,!1)}var Fbr=T("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var v=ya.apply(null,arguments);return this.isValid()&&v.isValid()?v<this?this:v:y()}),kbr=T("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var v=ya.apply(null,arguments);return this.isValid()&&v.isValid()?v>this?this:v:y()});function QKe(v,O){var A,R;if(O.length===1&&n(O[0])&&(O=O[0]),!O.length)return ya();for(A=O[0],R=1;R<O.length;++R)(!O[R].isValid()||O[R][v](A))&&(A=O[R]);return A}function $br(){var v=[].slice.call(arguments,0);return QKe("isBefore",v)}function Bbr(){var v=[].slice.call(arguments,0);return QKe("isAfter",v)}var zbr=function(){return Date.now?Date.now():+new Date},ZV=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ubr(v){var O,A=!1,R,$=ZV.length;for(O in v)if(i(v,O)&&!(Ks.call(ZV,O)!==-1&&(v[O]==null||!isNaN(v[O]))))return!1;for(R=0;R<$;++R)if(v[ZV[R]]){if(A)return!1;parseFloat(v[ZV[R]])!==ye(v[ZV[R]])&&(A=!0)}return!0}function qbr(){return this._isValid}function Hbr(){return Sb(NaN)}function hX(v){var O=Ge(v),A=O.year||0,R=O.quarter||0,$=O.month||0,te=O.week||O.isoWeek||0,we=O.day||0,dr=O.hour||0,Pn=O.minute||0,Hi=O.second||0,gp=O.millisecond||0;this._isValid=Ubr(O),this._milliseconds=+gp+Hi*1e3+Pn*6e4+dr*1e3*60*60,this._days=+we+te*7,this._months=+$+R*3+A*12,this._data={},this._locale=QO(),this._bubble()}function gX(v){return v instanceof hX}function uwe(v){return v<0?Math.round(-1*v)*-1:Math.round(v)}function Vbr(v,O,A){var R=Math.min(v.length,O.length),$=Math.abs(v.length-O.length),te=0,we;for(we=0;we<R;we++)(A&&v[we]!==O[we]||!A&&ye(v[we])!==ye(O[we]))&&te++;return te+$}function eGe(v,O){V(v,0,0,function(){var A=this.utcOffset(),R="+";return A<0&&(A=-A,R="-"),R+ee(~~(A/60),2)+O+ee(~~A%60,2)})}eGe("Z",":"),eGe("ZZ",""),Qe("Z",Ws),Qe("ZZ",Ws),Wn(["Z","ZZ"],function(v,O,A){A._useUTC=!0,A._tzm=lwe(Ws,v)});var Wbr=/([\+\-]|\d\d)/gi;function lwe(v,O){var A=(O||"").match(v),R,$,te;return A===null?null:(R=A[A.length-1]||[],$=(R+"").match(Wbr)||["-",0,0],te=+($[1]*60)+ye($[2]),te===0?0:$[0]==="+"?te:-te)}function cwe(v,O){var A,R;return O._isUTC?(A=O.clone(),R=(E(v)||l(v)?v.valueOf():ya(v).valueOf())-A.valueOf(),A._d.setTime(A._d.valueOf()+R),e.updateOffset(A,!1),A):ya(v).local()}function dwe(v){return-Math.round(v._d.getTimezoneOffset())}e.updateOffset=function(){};function Kbr(v,O,A){var R=this._offset||0,$;if(!this.isValid())return v!=null?this:NaN;if(v!=null){if(typeof v=="string"){if(v=lwe(Ws,v),v===null)return this}else Math.abs(v)<16&&!A&&(v=v*60);return!this._isUTC&&O&&($=dwe(this)),this._offset=v,this._isUTC=!0,$!=null&&this.add($,"m"),R!==v&&(!O||this._changeInProgress?oGe(this,Sb(v-R,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?R:dwe(this)}function Gbr(v,O){return v!=null?(typeof v!="string"&&(v=-v),this.utcOffset(v,O),this):-this.utcOffset()}function Jbr(v){return this.utcOffset(0,v)}function Zbr(v){return this._isUTC&&(this.utcOffset(0,v),this._isUTC=!1,v&&this.subtract(dwe(this),"m")),this}function Ybr(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var v=lwe(_f,this._i);v!=null?this.utcOffset(v):this.utcOffset(0,!0)}return this}function Xbr(v){return this.isValid()?(v=v?ya(v).utcOffset():0,(this.utcOffset()-v)%60===0):!1}function Qbr(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function e_r(){if(!s(this._isDSTShifted))return this._isDSTShifted;var v={},O;return S(v,this),v=YKe(v),v._a?(O=v._isUTC?f(v._a):ya(v._a),this._isDSTShifted=this.isValid()&&Vbr(v._a,O.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function t_r(){return this.isValid()?!this._isUTC:!1}function r_r(){return this.isValid()?this._isUTC:!1}function tGe(){return this.isValid()?this._isUTC&&this._offset===0:!1}var n_r=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,o_r=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Sb(v,O){var A=v,R=null,$,te,we;return gX(v)?A={ms:v._milliseconds,d:v._days,M:v._months}:u(v)||!isNaN(+v)?(A={},O?A[O]=+v:A.milliseconds=+v):(R=n_r.exec(v))?($=R[1]==="-"?-1:1,A={y:0,d:ye(R[pv])*$,h:ye(R[Ql])*$,m:ye(R[xb])*$,s:ye(R[YO])*$,ms:ye(uwe(R[NN]*1e3))*$}):(R=o_r.exec(v))?($=R[1]==="-"?-1:1,A={y:jN(R[2],$),M:jN(R[3],$),w:jN(R[4],$),d:jN(R[5],$),h:jN(R[6],$),m:jN(R[7],$),s:jN(R[8],$)}):A==null?A={}:typeof A=="object"&&("from"in A||"to"in A)&&(we=i_r(ya(A.from),ya(A.to)),A={},A.ms=we.milliseconds,A.M=we.months),te=new hX(A),gX(v)&&i(v,"_locale")&&(te._locale=v._locale),gX(v)&&i(v,"_isValid")&&(te._isValid=v._isValid),te}Sb.fn=hX.prototype,Sb.invalid=Hbr;function jN(v,O){var A=v&&parseFloat(v.replace(",","."));return(isNaN(A)?0:A)*O}function rGe(v,O){var A={};return A.months=O.month()-v.month()+(O.year()-v.year())*12,v.clone().add(A.months,"M").isAfter(O)&&--A.months,A.milliseconds=+O-+v.clone().add(A.months,"M"),A}function i_r(v,O){var A;return v.isValid()&&O.isValid()?(O=cwe(O,v),v.isBefore(O)?A=rGe(v,O):(A=rGe(O,v),A.milliseconds=-A.milliseconds,A.months=-A.months),A):{milliseconds:0,months:0}}function nGe(v,O){return function(A,R){var $,te;return R!==null&&!isNaN(+R)&&(N(O,"moment()."+O+"(period, number) is deprecated. Please use moment()."+O+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),te=A,A=R,R=te),$=Sb(A,R),oGe(this,$,v),this}}function oGe(v,O,A,R){var $=O._milliseconds,te=uwe(O._days),we=uwe(O._months);v.isValid()&&(R=R??!0,we&&$Ke(v,mr(v,"Month")+we*A),te&&Ti(v,"Date",mr(v,"Date")+te*A),$&&v._d.setTime(v._d.valueOf()+$*A),R&&e.updateOffset(v,te||we))}var a_r=nGe(1,"add"),s_r=nGe(-1,"subtract");function iGe(v){return typeof v=="string"||v instanceof String}function u_r(v){return E(v)||l(v)||iGe(v)||u(v)||c_r(v)||l_r(v)||v===null||v===void 0}function l_r(v){var O=o(v)&&!a(v),A=!1,R=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],$,te,we=R.length;for($=0;$<we;$+=1)te=R[$],A=A||i(v,te);return O&&A}function c_r(v){var O=n(v),A=!1;return O&&(A=v.filter(function(R){return!u(R)&&iGe(v)}).length===0),O&&A}function d_r(v){var O=o(v)&&!a(v),A=!1,R=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],$,te;for($=0;$<R.length;$+=1)te=R[$],A=A||i(v,te);return O&&A}function f_r(v,O){var A=v.diff(O,"days",!0);return A<-6?"sameElse":A<-1?"lastWeek":A<0?"lastDay":A<1?"sameDay":A<2?"nextDay":A<7?"nextWeek":"sameElse"}function p_r(v,O){arguments.length===1&&(arguments[0]?u_r(arguments[0])?(v=arguments[0],O=void 0):d_r(arguments[0])&&(O=arguments[0],v=void 0):(v=void 0,O=void 0));var A=v||ya(),R=cwe(A,this).startOf("day"),$=e.calendarFormat(this,R)||"sameElse",te=O&&(M(O[$])?O[$].call(this,A):O[$]);return this.format(te||this.localeData().calendar($,this,ya(A)))}function m_r(){return new C(this)}function h_r(v,O){var A=E(v)?v:ya(v);return this.isValid()&&A.isValid()?(O=Me(O)||"millisecond",O==="millisecond"?this.valueOf()>A.valueOf():A.valueOf()<this.clone().startOf(O).valueOf()):!1}function g_r(v,O){var A=E(v)?v:ya(v);return this.isValid()&&A.isValid()?(O=Me(O)||"millisecond",O==="millisecond"?this.valueOf()<A.valueOf():this.clone().endOf(O).valueOf()<A.valueOf()):!1}function y_r(v,O,A,R){var $=E(v)?v:ya(v),te=E(O)?O:ya(O);return this.isValid()&&$.isValid()&&te.isValid()?(R=R||"()",(R[0]==="("?this.isAfter($,A):!this.isBefore($,A))&&(R[1]===")"?this.isBefore(te,A):!this.isAfter(te,A))):!1}function b_r(v,O){var A=E(v)?v:ya(v),R;return this.isValid()&&A.isValid()?(O=Me(O)||"millisecond",O==="millisecond"?this.valueOf()===A.valueOf():(R=A.valueOf(),this.clone().startOf(O).valueOf()<=R&&R<=this.clone().endOf(O).valueOf())):!1}function __r(v,O){return this.isSame(v,O)||this.isAfter(v,O)}function v_r(v,O){return this.isSame(v,O)||this.isBefore(v,O)}function w_r(v,O,A){var R,$,te;if(!this.isValid())return NaN;if(R=cwe(v,this),!R.isValid())return NaN;switch($=(R.utcOffset()-this.utcOffset())*6e4,O=Me(O),O){case"year":te=yX(this,R)/12;break;case"month":te=yX(this,R);break;case"quarter":te=yX(this,R)/3;break;case"second":te=(this-R)/1e3;break;case"minute":te=(this-R)/6e4;break;case"hour":te=(this-R)/36e5;break;case"day":te=(this-R-$)/864e5;break;case"week":te=(this-R-$)/6048e5;break;default:te=this-R}return A?te:be(te)}function yX(v,O){if(v.date()<O.date())return-yX(O,v);var A=(O.year()-v.year())*12+(O.month()-v.month()),R=v.clone().add(A,"months"),$,te;return O-R<0?($=v.clone().add(A-1,"months"),te=(O-R)/(R-$)):($=v.clone().add(A+1,"months"),te=(O-R)/($-R)),-(A+te)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function x_r(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function S_r(v){if(!this.isValid())return null;var O=v!==!0,A=O?this.clone().utc():this;return A.year()<0||A.year()>9999?G(A,O?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):M(Date.prototype.toISOString)?O?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",G(A,"Z")):G(A,O?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function C_r(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var v="moment",O="",A,R,$,te;return this.isLocal()||(v=this.utcOffset()===0?"moment.utc":"moment.parseZone",O="Z"),A="["+v+'("]',R=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",$="-MM-DD[T]HH:mm:ss.SSS",te=O+'[")]',this.format(A+R+$+te)}function O_r(v){v||(v=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var O=G(this,v);return this.localeData().postformat(O)}function E_r(v,O){return this.isValid()&&(E(v)&&v.isValid()||ya(v).isValid())?Sb({to:this,from:v}).locale(this.locale()).humanize(!O):this.localeData().invalidDate()}function P_r(v){return this.from(ya(),v)}function T_r(v,O){return this.isValid()&&(E(v)&&v.isValid()||ya(v).isValid())?Sb({from:this,to:v}).locale(this.locale()).humanize(!O):this.localeData().invalidDate()}function A_r(v){return this.to(ya(),v)}function aGe(v){var O;return v===void 0?this._locale._abbr:(O=QO(v),O!=null&&(this._locale=O),this)}var sGe=T("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(v){return v===void 0?this.localeData():this.locale(v)});function uGe(){return this._locale}var bX=1e3,tB=60*bX,_X=60*tB,lGe=(365*400+97)*24*_X;function rB(v,O){return(v%O+O)%O}function cGe(v,O,A){return v<100&&v>=0?new Date(v+400,O,A)-lGe:new Date(v,O,A).valueOf()}function dGe(v,O,A){return v<100&&v>=0?Date.UTC(v+400,O,A)-lGe:Date.UTC(v,O,A)}function I_r(v){var O,A;if(v=Me(v),v===void 0||v==="millisecond"||!this.isValid())return this;switch(A=this._isUTC?dGe:cGe,v){case"year":O=A(this.year(),0,1);break;case"quarter":O=A(this.year(),this.month()-this.month()%3,1);break;case"month":O=A(this.year(),this.month(),1);break;case"week":O=A(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":O=A(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":O=A(this.year(),this.month(),this.date());break;case"hour":O=this._d.valueOf(),O-=rB(O+(this._isUTC?0:this.utcOffset()*tB),_X);break;case"minute":O=this._d.valueOf(),O-=rB(O,tB);break;case"second":O=this._d.valueOf(),O-=rB(O,bX);break}return this._d.setTime(O),e.updateOffset(this,!0),this}function M_r(v){var O,A;if(v=Me(v),v===void 0||v==="millisecond"||!this.isValid())return this;switch(A=this._isUTC?dGe:cGe,v){case"year":O=A(this.year()+1,0,1)-1;break;case"quarter":O=A(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":O=A(this.year(),this.month()+1,1)-1;break;case"week":O=A(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":O=A(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":O=A(this.year(),this.month(),this.date()+1)-1;break;case"hour":O=this._d.valueOf(),O+=_X-rB(O+(this._isUTC?0:this.utcOffset()*tB),_X)-1;break;case"minute":O=this._d.valueOf(),O+=tB-rB(O,tB)-1;break;case"second":O=this._d.valueOf(),O+=bX-rB(O,bX)-1;break}return this._d.setTime(O),e.updateOffset(this,!0),this}function R_r(){return this._d.valueOf()-(this._offset||0)*6e4}function N_r(){return Math.floor(this.valueOf()/1e3)}function j_r(){return new Date(this.valueOf())}function D_r(){var v=this;return[v.year(),v.month(),v.date(),v.hour(),v.minute(),v.second(),v.millisecond()]}function L_r(){var v=this;return{years:v.year(),months:v.month(),date:v.date(),hours:v.hours(),minutes:v.minutes(),seconds:v.seconds(),milliseconds:v.milliseconds()}}function F_r(){return this.isValid()?this.toISOString():null}function k_r(){return g(this)}function $_r(){return d({},h(this))}function B_r(){return h(this).overflow}function z_r(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}V("N",0,0,"eraAbbr"),V("NN",0,0,"eraAbbr"),V("NNN",0,0,"eraAbbr"),V("NNNN",0,0,"eraName"),V("NNNNN",0,0,"eraNarrow"),V("y",["y",1],"yo","eraYear"),V("y",["yy",2],0,"eraYear"),V("y",["yyy",3],0,"eraYear"),V("y",["yyyy",4],0,"eraYear"),Qe("N",fwe),Qe("NN",fwe),Qe("NNN",fwe),Qe("NNNN",X_r),Qe("NNNNN",Q_r),Wn(["N","NN","NNN","NNNN","NNNNN"],function(v,O,A,R){var $=A._locale.erasParse(v,R,A._strict);$?h(A).era=$:h(A).invalidEra=v}),Qe("y",rs),Qe("yy",rs),Qe("yyy",rs),Qe("yyyy",rs),Qe("yo",evr),Wn(["y","yy","yyy","yyyy"],vf),Wn(["yo"],function(v,O,A,R){var $;A._locale._eraYearOrdinalRegex&&($=v.match(A._locale._eraYearOrdinalRegex)),A._locale.eraYearOrdinalParse?O[vf]=A._locale.eraYearOrdinalParse(v,$):O[vf]=parseInt(v,10)});function U_r(v,O){var A,R,$,te=this._eras||QO("en")._eras;for(A=0,R=te.length;A<R;++A){switch(typeof te[A].since){case"string":$=e(te[A].since).startOf("day"),te[A].since=$.valueOf();break}switch(typeof te[A].until){case"undefined":te[A].until=1/0;break;case"string":$=e(te[A].until).startOf("day").valueOf(),te[A].until=$.valueOf();break}}return te}function q_r(v,O,A){var R,$,te=this.eras(),we,dr,Pn;for(v=v.toUpperCase(),R=0,$=te.length;R<$;++R)if(we=te[R].name.toUpperCase(),dr=te[R].abbr.toUpperCase(),Pn=te[R].narrow.toUpperCase(),A)switch(O){case"N":case"NN":case"NNN":if(dr===v)return te[R];break;case"NNNN":if(we===v)return te[R];break;case"NNNNN":if(Pn===v)return te[R];break}else if([we,dr,Pn].indexOf(v)>=0)return te[R]}function H_r(v,O){var A=v.since<=v.until?1:-1;return O===void 0?e(v.since).year():e(v.since).year()+(O-v.offset)*A}function V_r(){var v,O,A,R=this.localeData().eras();for(v=0,O=R.length;v<O;++v)if(A=this.clone().startOf("day").valueOf(),R[v].since<=A&&A<=R[v].until||R[v].until<=A&&A<=R[v].since)return R[v].name;return""}function W_r(){var v,O,A,R=this.localeData().eras();for(v=0,O=R.length;v<O;++v)if(A=this.clone().startOf("day").valueOf(),R[v].since<=A&&A<=R[v].until||R[v].until<=A&&A<=R[v].since)return R[v].narrow;return""}function K_r(){var v,O,A,R=this.localeData().eras();for(v=0,O=R.length;v<O;++v)if(A=this.clone().startOf("day").valueOf(),R[v].since<=A&&A<=R[v].until||R[v].until<=A&&A<=R[v].since)return R[v].abbr;return""}function G_r(){var v,O,A,R,$=this.localeData().eras();for(v=0,O=$.length;v<O;++v)if(A=$[v].since<=$[v].until?1:-1,R=this.clone().startOf("day").valueOf(),$[v].since<=R&&R<=$[v].until||$[v].until<=R&&R<=$[v].since)return(this.year()-e($[v].since).year())*A+$[v].offset;return this.year()}function J_r(v){return i(this,"_erasNameRegex")||pwe.call(this),v?this._erasNameRegex:this._erasRegex}function Z_r(v){return i(this,"_erasAbbrRegex")||pwe.call(this),v?this._erasAbbrRegex:this._erasRegex}function Y_r(v){return i(this,"_erasNarrowRegex")||pwe.call(this),v?this._erasNarrowRegex:this._erasRegex}function fwe(v,O){return O.erasAbbrRegex(v)}function X_r(v,O){return O.erasNameRegex(v)}function Q_r(v,O){return O.erasNarrowRegex(v)}function evr(v,O){return O._eraYearOrdinalRegex||rs}function pwe(){var v=[],O=[],A=[],R=[],$,te,we=this.eras();for($=0,te=we.length;$<te;++$)O.push(Xl(we[$].name)),v.push(Xl(we[$].abbr)),A.push(Xl(we[$].narrow)),R.push(Xl(we[$].name)),R.push(Xl(we[$].abbr)),R.push(Xl(we[$].narrow));this._erasRegex=new RegExp("^("+R.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+O.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+v.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+A.join("|")+")","i")}V(0,["gg",2],0,function(){return this.weekYear()%100}),V(0,["GG",2],0,function(){return this.isoWeekYear()%100});function vX(v,O){V(0,[v,v.length],0,O)}vX("gggg","weekYear"),vX("ggggg","weekYear"),vX("GGGG","isoWeekYear"),vX("GGGGG","isoWeekYear"),Sr("weekYear","gg"),Sr("isoWeekYear","GG"),le("weekYear",1),le("isoWeekYear",1),Qe("G",pp),Qe("g",pp),Qe("GG",Vn,qi),Qe("gg",Vn,qi),Qe("GGGG",Ts,hd),Qe("gggg",Ts,hd),Qe("GGGGG",pu,bf),Qe("ggggg",pu,bf),wb(["gggg","ggggg","GGGG","GGGGG"],function(v,O,A,R){O[R.substr(0,2)]=ye(v)}),wb(["gg","GG"],function(v,O,A,R){O[R]=e.parseTwoDigitYear(v)});function tvr(v){return fGe.call(this,v,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function rvr(v){return fGe.call(this,v,this.isoWeek(),this.isoWeekday(),1,4)}function nvr(){return XO(this.year(),1,4)}function ovr(){return XO(this.isoWeekYear(),1,4)}function ivr(){var v=this.localeData()._week;return XO(this.year(),v.dow,v.doy)}function avr(){var v=this.localeData()._week;return XO(this.weekYear(),v.dow,v.doy)}function fGe(v,O,A,R,$){var te;return v==null?KV(this,R,$).year:(te=XO(v,R,$),O>te&&(O=te),svr.call(this,v,O,A,R,$))}function svr(v,O,A,R,$){var te=qKe(v,O,A,R,$),we=WV(te.year,0,te.dayOfYear);return this.year(we.getUTCFullYear()),this.month(we.getUTCMonth()),this.date(we.getUTCDate()),this}V("Q",0,"Qo","quarter"),Sr("quarter","Q"),le("quarter",7),Qe("Q",fp),Wn("Q",function(v,O){O[ZO]=(ye(v)-1)*3});function uvr(v){return v==null?Math.ceil((this.month()+1)/3):this.month((v-1)*3+this.month()%3)}V("D",["DD",2],"Do","date"),Sr("date","D"),le("date",9),Qe("D",Vn),Qe("DD",Vn,qi),Qe("Do",function(v,O){return v?O._dayOfMonthOrdinalParse||O._ordinalParse:O._dayOfMonthOrdinalParseLenient}),Wn(["D","DD"],pv),Wn("Do",function(v,O){O[pv]=ye(v.match(Vn)[0])});var pGe=ze("Date",!0);V("DDD",["DDDD",3],"DDDo","dayOfYear"),Sr("dayOfYear","DDD"),le("dayOfYear",4),Qe("DDD",xA),Qe("DDDD",md),Wn(["DDD","DDDD"],function(v,O,A){A._dayOfYear=ye(v)});function lvr(v){var O=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return v==null?O:this.add(v-O,"d")}V("m",["mm",2],0,"minute"),Sr("minute","m"),le("minute",14),Qe("m",Vn),Qe("mm",Vn,qi),Wn(["m","mm"],xb);var cvr=ze("Minutes",!1);V("s",["ss",2],0,"second"),Sr("second","s"),le("second",15),Qe("s",Vn),Qe("ss",Vn,qi),Wn(["s","ss"],YO);var dvr=ze("Seconds",!1);V("S",0,0,function(){return~~(this.millisecond()/100)}),V(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),V(0,["SSS",3],0,"millisecond"),V(0,["SSSS",4],0,function(){return this.millisecond()*10}),V(0,["SSSSS",5],0,function(){return this.millisecond()*100}),V(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),V(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),V(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),V(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Sr("millisecond","ms"),le("millisecond",16),Qe("S",xA,fp),Qe("SS",xA,qi),Qe("SSS",xA,md);var CA,mGe;for(CA="SSSS";CA.length<=9;CA+="S")Qe(CA,rs);function fvr(v,O){O[NN]=ye(("0."+v)*1e3)}for(CA="S";CA.length<=9;CA+="S")Wn(CA,fvr);mGe=ze("Milliseconds",!1),V("z",0,0,"zoneAbbr"),V("zz",0,0,"zoneName");function pvr(){return this._isUTC?"UTC":""}function mvr(){return this._isUTC?"Coordinated Universal Time":""}var Je=C.prototype;Je.add=a_r,Je.calendar=p_r,Je.clone=m_r,Je.diff=w_r,Je.endOf=M_r,Je.format=O_r,Je.from=E_r,Je.fromNow=P_r,Je.to=T_r,Je.toNow=A_r,Je.get=yi,Je.invalidAt=B_r,Je.isAfter=h_r,Je.isBefore=g_r,Je.isBetween=y_r,Je.isSame=b_r,Je.isSameOrAfter=__r,Je.isSameOrBefore=v_r,Je.isValid=k_r,Je.lang=sGe,Je.locale=aGe,Je.localeData=uGe,Je.max=kbr,Je.min=Fbr,Je.parsingFlags=$_r,Je.set=yf,Je.startOf=I_r,Je.subtract=s_r,Je.toArray=D_r,Je.toObject=L_r,Je.toDate=j_r,Je.toISOString=S_r,Je.inspect=C_r,typeof Symbol<"u"&&Symbol.for!=null&&(Je[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Je.toJSON=F_r,Je.toString=x_r,Je.unix=N_r,Je.valueOf=R_r,Je.creationData=z_r,Je.eraName=V_r,Je.eraNarrow=W_r,Je.eraAbbr=K_r,Je.eraYear=G_r,Je.year=UKe,Je.isLeapYear=Lyr,Je.weekYear=tvr,Je.isoWeekYear=rvr,Je.quarter=Je.quarters=uvr,Je.month=BKe,Je.daysInMonth=Nyr,Je.week=Je.weeks=Uyr,Je.isoWeek=Je.isoWeeks=qyr,Je.weeksInYear=ivr,Je.weeksInWeekYear=avr,Je.isoWeeksInYear=nvr,Je.isoWeeksInISOWeekYear=ovr,Je.date=pGe,Je.day=Je.days=rbr,Je.weekday=nbr,Je.isoWeekday=obr,Je.dayOfYear=lvr,Je.hour=Je.hours=dbr,Je.minute=Je.minutes=cvr,Je.second=Je.seconds=dvr,Je.millisecond=Je.milliseconds=mGe,Je.utcOffset=Kbr,Je.utc=Jbr,Je.local=Zbr,Je.parseZone=Ybr,Je.hasAlignedHourOffset=Xbr,Je.isDST=Qbr,Je.isLocal=t_r,Je.isUtcOffset=r_r,Je.isUtc=tGe,Je.isUTC=tGe,Je.zoneAbbr=pvr,Je.zoneName=mvr,Je.dates=T("dates accessor is deprecated. Use date instead.",pGe),Je.months=T("months accessor is deprecated. Use month instead",BKe),Je.years=T("years accessor is deprecated. Use year instead",UKe),Je.zone=T("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Gbr),Je.isDSTShifted=T("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",e_r);function hvr(v){return ya(v*1e3)}function gvr(){return ya.apply(null,arguments).parseZone()}function hGe(v){return v}var ko=F.prototype;ko.calendar=Y,ko.longDateFormat=pe,ko.invalidDate=Te,ko.ordinal=St,ko.preparse=hGe,ko.postformat=hGe,ko.relativeTime=Ir,ko.pastFuture=Hn,ko.set=D,ko.eras=U_r,ko.erasParse=q_r,ko.erasConvertYear=H_r,ko.erasAbbrRegex=Z_r,ko.erasNameRegex=J_r,ko.erasNarrowRegex=Y_r,ko.months=Ayr,ko.monthsShort=Iyr,ko.monthsParse=Ryr,ko.monthsRegex=Dyr,ko.monthsShortRegex=jyr,ko.week=kyr,ko.firstDayOfYear=zyr,ko.firstDayOfWeek=Byr,ko.weekdays=Yyr,ko.weekdaysMin=Qyr,ko.weekdaysShort=Xyr,ko.weekdaysParse=tbr,ko.weekdaysRegex=ibr,ko.weekdaysShortRegex=abr,ko.weekdaysMinRegex=sbr,ko.isPM=lbr,ko.meridiem=fbr;function wX(v,O,A,R){var $=QO(),te=f().set(R,O);return $[A](te,v)}function gGe(v,O,A){if(u(v)&&(O=v,v=void 0),v=v||"",O!=null)return wX(v,O,A,"month");var R,$=[];for(R=0;R<12;R++)$[R]=wX(v,R,A,"month");return $}function mwe(v,O,A,R){typeof v=="boolean"?(u(O)&&(A=O,O=void 0),O=O||""):(O=v,A=O,v=!1,u(O)&&(A=O,O=void 0),O=O||"");var $=QO(),te=v?$._week.dow:0,we,dr=[];if(A!=null)return wX(O,(A+te)%7,R,"day");for(we=0;we<7;we++)dr[we]=wX(O,(we+te)%7,R,"day");return dr}function yvr(v,O){return gGe(v,O,"months")}function bvr(v,O){return gGe(v,O,"monthsShort")}function _vr(v,O,A){return mwe(v,O,A,"weekdays")}function vvr(v,O,A){return mwe(v,O,A,"weekdaysShort")}function wvr(v,O,A){return mwe(v,O,A,"weekdaysMin")}SA("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(v){var O=v%10,A=ye(v%100/10)===1?"th":O===1?"st":O===2?"nd":O===3?"rd":"th";return v+A}}),e.lang=T("moment.lang is deprecated. Use moment.locale instead.",SA),e.langData=T("moment.langData is deprecated. Use moment.localeData instead.",QO);var eE=Math.abs;function xvr(){var v=this._data;return this._milliseconds=eE(this._milliseconds),this._days=eE(this._days),this._months=eE(this._months),v.milliseconds=eE(v.milliseconds),v.seconds=eE(v.seconds),v.minutes=eE(v.minutes),v.hours=eE(v.hours),v.months=eE(v.months),v.years=eE(v.years),this}function yGe(v,O,A,R){var $=Sb(O,A);return v._milliseconds+=R*$._milliseconds,v._days+=R*$._days,v._months+=R*$._months,v._bubble()}function Svr(v,O){return yGe(this,v,O,1)}function Cvr(v,O){return yGe(this,v,O,-1)}function bGe(v){return v<0?Math.floor(v):Math.ceil(v)}function Ovr(){var v=this._milliseconds,O=this._days,A=this._months,R=this._data,$,te,we,dr,Pn;return v>=0&&O>=0&&A>=0||v<=0&&O<=0&&A<=0||(v+=bGe(hwe(A)+O)*864e5,O=0,A=0),R.milliseconds=v%1e3,$=be(v/1e3),R.seconds=$%60,te=be($/60),R.minutes=te%60,we=be(te/60),R.hours=we%24,O+=be(we/24),Pn=be(_Ge(O)),A+=Pn,O-=bGe(hwe(Pn)),dr=be(A/12),A%=12,R.days=O,R.months=A,R.years=dr,this}function _Ge(v){return v*4800/146097}function hwe(v){return v*146097/4800}function Evr(v){if(!this.isValid())return NaN;var O,A,R=this._milliseconds;if(v=Me(v),v==="month"||v==="quarter"||v==="year")switch(O=this._days+R/864e5,A=this._months+_Ge(O),v){case"month":return A;case"quarter":return A/3;case"year":return A/12}else switch(O=this._days+Math.round(hwe(this._months)),v){case"week":return O/7+R/6048e5;case"day":return O+R/864e5;case"hour":return O*24+R/36e5;case"minute":return O*1440+R/6e4;case"second":return O*86400+R/1e3;case"millisecond":return Math.floor(O*864e5)+R;default:throw new Error("Unknown unit "+v)}}function Pvr(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+ye(this._months/12)*31536e6:NaN}function tE(v){return function(){return this.as(v)}}var Tvr=tE("ms"),Avr=tE("s"),Ivr=tE("m"),Mvr=tE("h"),Rvr=tE("d"),Nvr=tE("w"),jvr=tE("M"),Dvr=tE("Q"),Lvr=tE("y");function Fvr(){return Sb(this)}function kvr(v){return v=Me(v),this.isValid()?this[v+"s"]():NaN}function DN(v){return function(){return this.isValid()?this._data[v]:NaN}}var $vr=DN("milliseconds"),Bvr=DN("seconds"),zvr=DN("minutes"),Uvr=DN("hours"),qvr=DN("days"),Hvr=DN("months"),Vvr=DN("years");function Wvr(){return be(this.days()/7)}var rE=Math.round,nB={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Kvr(v,O,A,R,$){return $.relativeTime(O||1,!!A,v,R)}function Gvr(v,O,A,R){var $=Sb(v).abs(),te=rE($.as("s")),we=rE($.as("m")),dr=rE($.as("h")),Pn=rE($.as("d")),Hi=rE($.as("M")),gp=rE($.as("w")),nE=rE($.as("y")),OA=te<=A.ss&&["s",te]||te<A.s&&["ss",te]||we<=1&&["m"]||we<A.m&&["mm",we]||dr<=1&&["h"]||dr<A.h&&["hh",dr]||Pn<=1&&["d"]||Pn<A.d&&["dd",Pn];return A.w!=null&&(OA=OA||gp<=1&&["w"]||gp<A.w&&["ww",gp]),OA=OA||Hi<=1&&["M"]||Hi<A.M&&["MM",Hi]||nE<=1&&["y"]||["yy",nE],OA[2]=O,OA[3]=+v>0,OA[4]=R,Kvr.apply(null,OA)}function Jvr(v){return v===void 0?rE:typeof v=="function"?(rE=v,!0):!1}function Zvr(v,O){return nB[v]===void 0?!1:O===void 0?nB[v]:(nB[v]=O,v==="s"&&(nB.ss=O-1),!0)}function Yvr(v,O){if(!this.isValid())return this.localeData().invalidDate();var A=!1,R=nB,$,te;return typeof v=="object"&&(O=v,v=!1),typeof v=="boolean"&&(A=v),typeof O=="object"&&(R=Object.assign({},nB,O),O.s!=null&&O.ss==null&&(R.ss=O.s-1)),$=this.localeData(),te=Gvr(this,!A,R,$),A&&(te=$.pastFuture(+this,te)),$.postformat(te)}var gwe=Math.abs;function oB(v){return(v>0)-(v<0)||+v}function xX(){if(!this.isValid())return this.localeData().invalidDate();var v=gwe(this._milliseconds)/1e3,O=gwe(this._days),A=gwe(this._months),R,$,te,we,dr=this.asSeconds(),Pn,Hi,gp,nE;return dr?(R=be(v/60),$=be(R/60),v%=60,R%=60,te=be(A/12),A%=12,we=v?v.toFixed(3).replace(/\.?0+$/,""):"",Pn=dr<0?"-":"",Hi=oB(this._months)!==oB(dr)?"-":"",gp=oB(this._days)!==oB(dr)?"-":"",nE=oB(this._milliseconds)!==oB(dr)?"-":"",Pn+"P"+(te?Hi+te+"Y":"")+(A?Hi+A+"M":"")+(O?gp+O+"D":"")+($||R||v?"T":"")+($?nE+$+"H":"")+(R?nE+R+"M":"")+(v?nE+we+"S":"")):"P0D"}var bo=hX.prototype;bo.isValid=qbr,bo.abs=xvr,bo.add=Svr,bo.subtract=Cvr,bo.as=Evr,bo.asMilliseconds=Tvr,bo.asSeconds=Avr,bo.asMinutes=Ivr,bo.asHours=Mvr,bo.asDays=Rvr,bo.asWeeks=Nvr,bo.asMonths=jvr,bo.asQuarters=Dvr,bo.asYears=Lvr,bo.valueOf=Pvr,bo._bubble=Ovr,bo.clone=Fvr,bo.get=kvr,bo.milliseconds=$vr,bo.seconds=Bvr,bo.minutes=zvr,bo.hours=Uvr,bo.days=qvr,bo.weeks=Wvr,bo.months=Hvr,bo.years=Vvr,bo.humanize=Yvr,bo.toISOString=xX,bo.toString=xX,bo.toJSON=xX,bo.locale=aGe,bo.localeData=uGe,bo.toIsoString=T("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",xX),bo.lang=sGe,V("X",0,0,"unix"),V("x",0,0,"valueOf"),Qe("x",pp),Qe("X",um),Wn("X",function(v,O,A){A._d=new Date(parseFloat(v)*1e3)}),Wn("x",function(v,O,A){A._d=new Date(ye(v))});return e.version="2.29.4",r(ya),e.fn=Je,e.min=$br,e.max=Bbr,e.now=zbr,e.utc=f,e.unix=hvr,e.months=yvr,e.isDate=l,e.locale=SA,e.invalid=y,e.duration=Sb,e.isMoment=E,e.weekdays=_vr,e.parseZone=gvr,e.localeData=QO,e.isDuration=gX,e.monthsShort=bvr,e.weekdaysMin=wvr,e.defineLocale=nwe,e.updateLocale=gbr,e.locales=ybr,e.weekdaysShort=vvr,e.normalizeUnits=Me,e.relativeTimeRounding=Jvr,e.relativeTimeThreshold=Zvr,e.calendarFormat=f_r,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 Oet={};ns(Oet,{CustomError:()=>tn,TimeoutError:()=>n8});var tn,n8,vE=b(()=>{tn=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype)}},n8=class t extends Error{constructor(e,r){super(`${e} timed out after ${r}ms`),this.name="TimeoutError",Object.setPrototypeOf(this,t.prototype)}}});function Eet(t){let e=t?.detail||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function XPr(t){let e=Eet(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function Pet(t){let e=Eet(t);return XPr(t)?qSe.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:qSe.UNKNOWN_ERROR)}function GB(t){return t.replace(/^#/,"").trim().toLowerCase()}function Sj(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(GB(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(GB(i))}):typeof n=="string"&&o.add(GB(n))),Array.from(o)}function Tet(t,e,r){if(e.length===0)return[];e=e.map(i=>GB(i));let n=r&&r.length>0?r:WSe(t,"/"),o=[];for(let i of n){let a=Sj(i);e.some(s=>a.includes(s))&&o.push(i)}return o}function KSe(t){let e=(0,VSe.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()}:Qs(new Date)}async function JB(t,e){return t.extension!="md"&&t.extension!="canvas"?null:await e.cachedRead(t)}function gee(t){return t.basename}function GSe(t){return t?t.extension==="md"||t.extension==="pdf"||t.extension==="canvas":!1}function Rb(t){return t==="copilot_plus"||t==="project"}function ZB(t,e){return t?t.extension==="md"||t.extension==="canvas"?!0:Rb(e):!1}function Iet(t,e){return!t||!e?!1:t.includes(HSe)&&e.includes(HSe)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function YB(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({role:"user",content:o},{role:"assistant",content:i})}return e}function Hg(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 Mh.TFile)o.set(s.path,s);else{let l=e.getMarkdownFiles().filter(c=>c.basename===a);l.length>0&&(JSe(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 JSe(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function Met(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function Ret(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}function Net(t){return ZSe.test(t)}function YSe(t){let e=t.match(ZSe);return e?e[0]:null}function yee(t){let e=t.matchAll(new RegExp(ZSe,"g"));return Array.from(e,r=>r[0])}async function yu(t,e={}){let r=new Headers(e.headers),n=Object.fromEntries(r.entries());delete n["content-length"],B("==== safeFetch method request ====");let o=e.method?.toUpperCase()||"POST",a=await(0,Mh.requestUrl)({url:t,contentType:"application/json",headers:n,method:o,...["POST","PUT","PATCH"].includes(o)&&{body:e.body?.toString()},throw:!1});if(a.status>=400){let s;try{s=typeof a.json=="string"?JSON.parse(a.json):a.json}catch{try{s=typeof a.text=="string"?JSON.parse(a.text):a.text}catch{s=null}}let u=new Error(qSe.REQUEST_FAILED(a.status));if(u.json=s,s?.detail?.reason==="Invalid license key"||s?.reason==="Invalid license key")u.message="Invalid license key";else if(s?.detail?.message||s?.message){let l=s?.detail?.message||s?.message,c=s?.detail?.reason||s?.reason;u.message=c?`${l}: ${c}`:l}else s?.detail?u.message=JSON.stringify(s.detail):s&&(u.message+=". "+JSON.stringify(s));throw u}return{ok:a.status>=200&&a.status<300,status:a.status,statusText:a.status.toString(),headers:new Headers(a.headers),url:t,type:"basic",redirected:!1,bytes:()=>Promise.resolve(new Uint8Array(0)),body:tTr(a.text),bodyUsed:!0,json:()=>a.json,text:async()=>a.text,arrayBuffer:async()=>{if(a.arrayBuffer)return a.arrayBuffer;let s=a.text.replace(/^data:.*;base64,/,""),u=atob(s),l=new Uint8Array(u.length);for(let c=0;c<u.length;c++)l[c]=u.charCodeAt(c);return l.buffer},blob:()=>{throw new Error("not implemented")},formData:()=>{throw new Error("not implemented")},clone:()=>{throw new Error("not implemented")}}}function tTr(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function Xn(t,e=!1){return t instanceof Error?t.message+`
${t?.cause?"more message: "+t.cause.message:""}
${e?t.stack:""}`:JSON.stringify(t)}function o8(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function bee(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 wE(t){let e=ez[t];return{...e,label:e.label||t}}function Ap(t,e){let r=ez[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}function _ee(t){let e=t;return e=Cj(e),e=e.replace(/```xml\s*[\s\S]*?<writeToFile>[\s\S]*?<\/writeToFile>[\s\S]*?```/g,""),e=e.replace(/<writeToFile>[\s\S]*?<\/writeToFile>/g,""),e=e.replace(/<!--TOOL_CALL_START:[^:]+:[^:]+:[^:]+:[^:]+:[^:]*:[^:]+-->[\s\S]*?<!--TOOL_CALL_END:[^:]+:[\s\S]*?-->/g,""),e=e.replace(/\n{3,}/g,`
`),e=e.trim(),e}async function i8(t,e=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new Mh.Notice("No active leaf found.");return}if(r.view instanceof Mh.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof Mh.MarkdownView)){new Mh.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to"),a=_ee(t);e?n.replaceRange(a,o,i):n.replaceRange(a,i),new Mh.Notice("Message inserted into the active note.")}function vee(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function wee(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 jet(){try{return{version:(await(0,Mh.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 a8(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 rTr(t){return typeof t=="string"?t.startsWith("gpt-5"):(t.modelName||t.model||"").startsWith("gpt-5")}function XB(t){let e=typeof t=="string"?t:t.modelName||t.model||"",r=a8(e),n=rTr(e),o=e.startsWith("claude-3-7-sonnet")||e.startsWith("claude-sonnet-4");return{isOSeries:r,isGPT5:n,isThinkingEnabled:o}}function JA(t,e="system"){return a8(t)?"human":e}function XSe(){let t=["3rd party (openai-format)","ollama","lm-studio","azure openai","copilot-plus","copilot-plus-jina"];return Object.entries(ez).filter(([e])=>!t.includes(e)).map(([e])=>e)}function QB(t,e){let r=!!XSe().find(i=>i===t.provider),n=SE[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 nTr(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e.type==="text").map(e=>e.text).join(""):String(t||"")}function Cj(t){let r=nTr(t).replace(/<think>[\s\S]*?<\/think>/g,"");return r=r.replace(/<think>[\s\S]*$/g,""),r.trim()}function Det(){return crypto.randomUUID()}async function Sd(t){let e=console.warn;try{return console.warn=function(...r){if(!(r[0]?.includes&&(r[0].includes("Failed to calculate number of tokens")||r[0].includes("Unknown model"))))return e.apply(console,r)},await t()}finally{console.warn=e}}async function xee(t,e,r="Operation"){let{TimeoutError:n}=await Promise.resolve().then(()=>(vE(),Oet)),o=new AbortController,i=setTimeout(()=>{o.abort()},e);try{return await Promise.race([t(o.signal),new Promise((a,s)=>{o.signal.addEventListener("abort",()=>{s(new n(r,e))})})])}finally{clearTimeout(i)}}function QSe(){let t=app.workspace.getActiveViewOfType(Mh.MarkdownView);return t?t.getState().source===!0:!0}var VSe,Mh,qSe,WSe,QPr,eTr,Aet,Qs,ZSe,fr=b(()=>{oc();nr();Kt();VSe=j(Cet()),Mh=require("obsidian"),qSe={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}`};WSe=(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})};QPr=t=>t.last.bound.modelName||t.last.bound.model,eTr=t=>t.last.bound.retriever!==void 0,Aet=t=>QPr(t)||eTr(t),Qs=(t,e="local")=>{let r=(0,VSe.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};ZSe=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/});var tz,eCe,s8,oc=b(()=>{Mb();VA();Om();ZQe();fr();tz=class tz{static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.bind({signal:i?.signal}),s=ji.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return tz.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=tz.instances.get("llm_chain");return r||(r=tz.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,u=Tf.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=Tf.fromTemplate(`{system_message}
Answer the question with as detailed as possible based only on the following context:
{context}
Question: {question}
`),d=g=>g.map(_=>`Human: ${_[0]}
Assistant: ${_[1]}`).join(`
`),f=ji.from([{question:g=>(n&&console.log("Input Question: ",g.question),g.question),chat_history:g=>{let y=d(g.chat_history);return n&&console.log("Formatted Chat History: ",y),y}},u,o,new aee,g=>{let y=Cj(g);return n&&console.log("Standalone Question: ",y),y}]),p=async g=>(r(g),OSe(g)),h=ji.from([{context:i.pipe(p),question:new jo,system_message:()=>a},c,o]);return f.pipe(h)}};tz.instances=new Map;eCe=tz,s8=eCe});var u8=b(()=>{});var ZA,Ms,Do,Vg,Let,Fet,xet,$et,l8,Em,c8,Oj,d8,tCe,Ej,rCe,nCe,rz,Tv,CE,Mf,xE,YA,Pv,GA,xj,HSe,ez,SE,Bet,dn,See,Wg,nz,gu,Kg,nr=b(()=>{LN();oc();u8();ZA="https://api.brevilabs.com/v1",Ms="copilot-chat-view",Do="user",Vg="ai",Let="copilot-conversations",Fet="copilot-custom-prompts",xet=`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, format as github markdown tables, however, for table headings, immediately add ' |' after the table heading.
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.
13. If the user mentions "tags", it most likely means tags in Obsidian note properties.
14. YouTube URLs: If the user provides YouTube URLs in their message, transcriptions will be automatically fetched and provided to you. You don't need to do anything special - just use the transcription content if available.`,$et=`Return the new note content or canvas JSON in <writeToFile> tags.
# Steps to find the the target notes
1. Extract the target note information from user message and find out the note path from the context below.
2. If target note is not specified, use the <active_note> as the target note.
3. If still failed to find the target note or the note path, ask the user to specify the target note.
# Examples
Input: Add a new section to note A
Output:
<writeToFile>
<path>path/to/file.md</path>
<content>The FULL CONTENT of the note A with added section goes here</content>
</writeToFile>
Input: Create a new canvas with "Hello, world!"
Output:
<writeToFile>
<path>path/to/file.canvas</path>
<content>
{
"nodes": [
{
"id": "1",
"type": "text",
"text": "Hello, world!",
"x": 0,
"y": 0,
"width": 200,
"height": 50
}
],
"edges": [
{
"id": "e1-2",
"fromNode": "1",
"toNode": "2",
"label": "connects to"
}
]
}
</content>
</writeToFile>
# Important
# The content within the <content> tags for canvas files is in JSON format.
* For canvas files, both 'nodes' and 'edges' arrays must be properly closed with ]
* Prefer to create new files in existing folders or root folder unless the user's request specifies otherwise
* File paths must end with a .md or .canvas extension
* When generating changes on multiple files, output multiple <writeToFile> tags
* For canvas files:
- Every node must have: id, type, x, y, width, height
- Every edge must have: id, fromNode, toNode
- All IDs must be unique
- Edge fromNode and toNode must reference existing node IDs.
`,l8="note_context",Em="selected_text",c8="variable",Oj="variable_note",d8="embedded_pdf",tCe="retrieved_document",Ej=6e3,rCe=.4,nCe=448e3,rz=3e4,Tv={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree"},CE={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"},Mf={MAX_TOKENS:6e3,TEMPERATURE:.1,REASONING_EFFORT:"low",VERBOSITY:"medium"},xE=(h=>(h.OPENAI="openai",h.OPENAI_FORMAT="3rd party (openai-format)",h.AZURE_OPENAI="azure openai",h.ANTHROPIC="anthropic",h.COHEREAI="cohereai",h.GOOGLE="google",h.XAI="xai",h.OPENROUTERAI="openrouterai",h.GROQ="groq",h.OLLAMA="ollama",h.LM_STUDIO="lm-studio",h.COPILOT_PLUS="copilot-plus",h.MISTRAL="mistralai",h.DEEPSEEK="deepseek",h))(xE||{}),YA={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},Pv=[{name:"copilot-plus-flash",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,core:!0,plusExclusive:!0,projectEnabled:!1,capabilities:["vision"]},{name:"google/gemini-2.5-flash-lite",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"google/gemini-2.5-flash",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"google/gemini-2.5-pro",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-5",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"gpt-5-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"gpt-5-nano",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"gpt-4.1",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-4.1-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-4.1-nano",provider:"openai",enabled:!0,isBuiltIn:!0,capabilities:["vision"]},{name:"claude-sonnet-4-20250514",provider:"anthropic",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"claude-3-7-sonnet-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"grok-3-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"grok-3-mini-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"gemini-2.5-flash",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gemini-2.5-flash-lite",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gemini-2.5-pro",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!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"]}],GA=(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))(GA||{}),xj=[{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:"gemini-embedding-001",provider:"google",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0}],HSe="nomic-embed-text",ez={openrouterai:{label:"OpenRouter",host:"https://openrouter.ai/api/v1/",keyManagementURL:"https://openrouter.ai/keys",listModelURL:"https://openrouter.ai/api/v1/models",testModel:"openai/chatgpt-4o-latest"},google:{label:"Gemini",host:"https://generativelanguage.googleapis.com",keyManagementURL:"https://makersuite.google.com/app/apikey",listModelURL:"https://generativelanguage.googleapis.com/v1beta/models",testModel:"gemini-2.5-flash"},openai:{label:"OpenAI",host:"https://api.openai.com",keyManagementURL:"https://platform.openai.com/api-keys",listModelURL:"https://api.openai.com/v1/models",testModel:"gpt-4.1"},"azure openai":{label:"Azure OpenAI",host:"",keyManagementURL:"",listModelURL:"",testModel:"azure-openai"},anthropic:{label:"Anthropic",host:"https://api.anthropic.com/",keyManagementURL:"https://console.anthropic.com/settings/keys",listModelURL:"https://api.anthropic.com/v1/models",testModel:"claude-3-5-sonnet-latest"},cohereai:{label:"Cohere",host:"https://api.cohere.com",keyManagementURL:"https://dashboard.cohere.ai/api-keys",listModelURL:"https://api.cohere.com/v1/models",testModel:"command-r"},xai:{label:"XAI",host:"https://api.x.ai/v1",keyManagementURL:"https://console.x.ai",listModelURL:"https://api.x.ai/v1/models",testModel:"grok-3-beta"},groq:{label:"Groq",host:"https://api.groq.com/openai",keyManagementURL:"https://console.groq.com/keys",listModelURL:"https://api.groq.com/openai/v1/models",testModel:"llama3-8b-8192"},ollama:{label:"Ollama",host:"http://localhost:11434/v1/",keyManagementURL:"",listModelURL:""},"lm-studio":{label:"LM Studio",host:"http://localhost:1234/v1",keyManagementURL:"",listModelURL:""},"3rd party (openai-format)":{label:"OpenAI Format",host:"https://api.example.com/v1",keyManagementURL:"",listModelURL:""},mistralai:{label:"Mistral",host:"https://api.mistral.ai/v1",keyManagementURL:"https://console.mistral.ai/api-keys",listModelURL:"https://api.mistral.ai/v1/models",testModel:"mistral-tiny-latest"},deepseek:{label:"DeepSeek",host:"https://api.deepseek.com/",keyManagementURL:"https://platform.deepseek.com/api-keys",listModelURL:"https://api.deepseek.com/models",testModel:"deepseek-chat"},"copilot-plus":{label:"Copilot Plus",host:"https://api.brevilabs.com/v1",keyManagementURL:"",listModelURL:""},"copilot-plus-jina":{label:"Copilot Plus",host:"https://api.brevilabs.com/v1",keyManagementURL:"",listModelURL:""}},SE={anthropic:"anthropicApiKey",openai:"openAIApiKey","azure openai":"azureOpenAIApiKey",google:"googleApiKey",groq:"groqApiKey",openrouterai:"openRouterAiApiKey",cohereai:"cohereApiKey",xai:"xaiApiKey","copilot-plus":"plusLicenseKey",mistralai:"mistralApiKey",deepseek:"deepseekApiKey"},Bet=["NEVER","ON STARTUP","ON MODE SWITCH"],dn={TRIGGER_QUICK_COMMAND:"trigger-quick-command",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",DEBUG_WORD_COMPLETION:"debug-word-completion",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",NEW_CHAT:"new-chat",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",TOGGLE_AUTOCOMPLETE:"toggle-autocomplete",ADD_SELECTION_TO_CHAT_CONTEXT:"add-selection-to-chat-context",ADD_CUSTOM_COMMAND:"add-custom-command",APPLY_CUSTOM_COMMAND:"apply-custom-command"},See={[dn.TRIGGER_QUICK_COMMAND]:"Trigger quick command",[dn.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[dn.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[dn.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[dn.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[dn.DEBUG_WORD_COMPLETION]:"Word completion: Debug",[dn.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[dn.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[dn.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[dn.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[dn.LIST_INDEXED_FILES]:"List all indexed files (debug)",[dn.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[dn.NEW_CHAT]:"New Copilot Chat",[dn.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[dn.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[dn.SEARCH_ORAMA_DB]:"Search semantic index (debug)",[dn.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window",[dn.TOGGLE_AUTOCOMPLETE]:"Toggle autocomplete",[dn.ADD_SELECTION_TO_CHAT_CONTEXT]:"Add selection to chat context",[dn.ADD_CUSTOM_COMMAND]:"Add new custom command",[dn.APPLY_CUSTOM_COMMAND]:"Apply custom command"},Wg={DELAY_MS:600,MIN_TRIGGER_LENGTH:3,MAX_CONTEXT_LENGTH:1e4,KEYBIND:"Tab"},nz={NON_MARKDOWN_FILES_RESTRICTED:"Non-markdown files are only available in Copilot Plus mode. Please upgrade to access this file type.",URL_PROCESSING_RESTRICTED:"URL processing is only available in Copilot Plus mode. URLs will not be processed for context.",UNSUPPORTED_FILE_TYPE:t=>`${t.toUpperCase()} files are not supported in the current mode.`},gu={userId:lm(),isPlusUser:!1,plusLicenseKey:"",openAIApiKey:"",openAIOrgId:"",huggingfaceApiKey:"",cohereApiKey:"",anthropicApiKey:"",azureOpenAIApiKey:"",azureOpenAIApiInstanceName:"",azureOpenAIApiDeploymentName:"",azureOpenAIApiVersion:"",azureOpenAIApiEmbeddingDeploymentName:"",googleApiKey:"",openRouterAiApiKey:"",xaiApiKey:"",mistralApiKey:"",deepseekApiKey:"",defaultChainType:"llm_chain",defaultModelKey:"google/gemini-2.5-flash|openrouterai",embeddingModelKey:"text-embedding-3-small|openai",temperature:Mf.TEMPERATURE,maxTokens:Mf.MAX_TOKENS,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:Let,defaultConversationTag:"copilot-conversation",autosaveChat:!1,includeActiveNoteAsContext:!0,defaultOpenArea:"view",customPromptsFolder:Fet,indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:`${Let},${Fet}`,qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:15,groqApiKey:"",activeModels:Pv,activeEmbeddingModels:xj,embeddingRequestsPerMin:60,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,lexicalSearchRamLimit:100,promptUsageTimestamps:{},promptSortStrategy:"timestamp",defaultConversationNoteName:"{$topic}@{$date}_{$time}",inlineEditCommands:[],projectList:[],enableAutocomplete:!1,autocompleteAcceptKey:Wg.KEYBIND,allowAdditionalContext:!0,enableWordCompletion:!1,lastDismissedVersion:null,passMarkdownImages:!0,enableAutonomousAgent:!1,enableCustomPromptTemplating:!0,enableSemanticSearchV3:!1,enableLexicalBoosts:!0,suggestedDefaultCommands:!1,autonomousAgentMaxIterations:4,autonomousAgentEnabledToolIds:["localSearch","webSearch","pomodoro","youtubeTranscription","writeToFile","replaceInFile"],reasoningEffort:Mf.REASONING_EFFORT,verbosity:Mf.VERBOSITY},Kg={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change",ABORT_STREAM:"abort-stream"}});var iCe=x(Cee=>{"use strict";Cee.byteLength=iTr;Cee.toByteArray=sTr;Cee.fromByteArray=cTr;var Av=[],Gg=[],oTr=typeof Uint8Array<"u"?Uint8Array:Array,oCe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Pj=0,zet=oCe.length;Pj<zet;++Pj)Av[Pj]=oCe[Pj],Gg[oCe.charCodeAt(Pj)]=Pj;var Pj,zet;Gg[45]=62;Gg[95]=63;function Uet(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 iTr(t){var e=Uet(t),r=e[0],n=e[1];return(r+n)*3/4-n}function aTr(t,e,r){return(e+r)*3/4-r}function sTr(t){var e,r=Uet(t),n=r[0],o=r[1],i=new oTr(aTr(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u<s;u+=4)e=Gg[t.charCodeAt(u)]<<18|Gg[t.charCodeAt(u+1)]<<12|Gg[t.charCodeAt(u+2)]<<6|Gg[t.charCodeAt(u+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=Gg[t.charCodeAt(u)]<<2|Gg[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=Gg[t.charCodeAt(u)]<<10|Gg[t.charCodeAt(u+1)]<<4|Gg[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function uTr(t){return Av[t>>18&63]+Av[t>>12&63]+Av[t>>6&63]+Av[t&63]}function lTr(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(uTr(n));return o.join("")}function cTr(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,s=r-n;a<s;a+=i)o.push(lTr(t,a,a+i>s?s:a+i));return n===1?(e=t[r-1],o.push(Av[e>>2]+Av[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(Av[e>>10]+Av[e>>4&63]+Av[e<<2&63]+"=")),o.join("")}});var qet=x(aCe=>{aCe.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)};aCe.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,h=n?1:-1,m=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+=h,s/=256,o-=8);for(a=a<<o|s,l+=o;l>0;t[r+p]=a&255,p+=h,a/=256,l-=8);t[r+p-h]|=m*128}});var Tm=x(sz=>{"use strict";var sCe=iCe(),iz=qet(),Het=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;sz.Buffer=Se;sz.SlowBuffer=gTr;sz.INSPECT_MAX_BYTES=50;var Oee=2147483647;sz.kMaxLength=Oee;Se.TYPED_ARRAY_SUPPORT=dTr();!Se.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 dTr(){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(Se.prototype,"parent",{enumerable:!0,get:function(){if(Se.isBuffer(this))return this.buffer}});Object.defineProperty(Se.prototype,"offset",{enumerable:!0,get:function(){if(Se.isBuffer(this))return this.byteOffset}});function OE(t){if(t>Oee)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,Se.prototype),e}function Se(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 dCe(t)}return Get(t,e,r)}Se.poolSize=8192;function Get(t,e,r){if(typeof t=="string")return pTr(t,e);if(ArrayBuffer.isView(t))return mTr(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(Iv(t,ArrayBuffer)||t&&Iv(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Iv(t,SharedArrayBuffer)||t&&Iv(t.buffer,SharedArrayBuffer)))return lCe(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 Se.from(n,e,r);let o=hTr(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return Se.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)}Se.from=function(t,e,r){return Get(t,e,r)};Object.setPrototypeOf(Se.prototype,Uint8Array.prototype);Object.setPrototypeOf(Se,Uint8Array);function Jet(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 fTr(t,e,r){return Jet(t),t<=0?OE(t):e!==void 0?typeof r=="string"?OE(t).fill(e,r):OE(t).fill(e):OE(t)}Se.alloc=function(t,e,r){return fTr(t,e,r)};function dCe(t){return Jet(t),OE(t<0?0:fCe(t)|0)}Se.allocUnsafe=function(t){return dCe(t)};Se.allocUnsafeSlow=function(t){return dCe(t)};function pTr(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Se.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Zet(t,e)|0,n=OE(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function uCe(t){let e=t.length<0?0:fCe(t.length)|0,r=OE(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function mTr(t){if(Iv(t,Uint8Array)){let e=new Uint8Array(t);return lCe(e.buffer,e.byteOffset,e.byteLength)}return uCe(t)}function lCe(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,Se.prototype),n}function hTr(t){if(Se.isBuffer(t)){let e=fCe(t.length)|0,r=OE(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||mCe(t.length)?OE(0):uCe(t);if(t.type==="Buffer"&&Array.isArray(t.data))return uCe(t.data)}function fCe(t){if(t>=Oee)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Oee.toString(16)+" bytes");return t|0}function gTr(t){return+t!=t&&(t=0),Se.alloc(+t)}Se.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==Se.prototype};Se.compare=function(e,r){if(Iv(e,Uint8Array)&&(e=Se.from(e,e.offset,e.byteLength)),Iv(r,Uint8Array)&&(r=Se.from(r,r.offset,r.byteLength)),!Se.isBuffer(e)||!Se.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};Se.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}};Se.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return Se.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let o=Se.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){let a=e[n];if(Iv(a,Uint8Array))i+a.length>o.length?(Se.isBuffer(a)||(a=Se.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(Se.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function Zet(t,e){if(Se.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Iv(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 cCe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return itt(t).length;default:if(o)return n?-1:cCe(t).length;e=(""+e).toLowerCase(),o=!0}}Se.byteLength=Zet;function yTr(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 PTr(this,e,r);case"utf8":case"utf-8":return Xet(this,e,r);case"ascii":return OTr(this,e,r);case"latin1":case"binary":return ETr(this,e,r);case"base64":return STr(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return TTr(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}Se.prototype._isBuffer=!0;function Tj(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}Se.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)Tj(this,r,r+1);return this};Se.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)Tj(this,r,r+3),Tj(this,r+1,r+2);return this};Se.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)Tj(this,r,r+7),Tj(this,r+1,r+6),Tj(this,r+2,r+5),Tj(this,r+3,r+4);return this};Se.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Xet(this,0,e):yTr.apply(this,arguments)};Se.prototype.toLocaleString=Se.prototype.toString;Se.prototype.equals=function(e){if(!Se.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:Se.compare(this,e)===0};Se.prototype.inspect=function(){let e="",r=sz.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Het&&(Se.prototype[Het]=Se.prototype.inspect);Se.prototype.compare=function(e,r,n,o,i){if(Iv(e,Uint8Array)&&(e=Se.from(e,e.offset,e.byteLength)),!Se.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 Yet(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,mCe(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=Se.from(e,n)),Se.isBuffer(e))return e.length===0?-1:Vet(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):Vet(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function Vet(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}Se.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};Se.prototype.indexOf=function(e,r,n){return Yet(this,e,r,n,!0)};Se.prototype.lastIndexOf=function(e,r,n){return Yet(this,e,r,n,!1)};function bTr(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(mCe(s))return a;t[r+a]=s}return a}function _Tr(t,e,r,n){return Eee(cCe(e,t.length-r),t,r,n)}function vTr(t,e,r,n){return Eee(RTr(e),t,r,n)}function wTr(t,e,r,n){return Eee(itt(e),t,r,n)}function xTr(t,e,r,n){return Eee(NTr(e,t.length-r),t,r,n)}Se.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 bTr(this,e,r,n);case"utf8":case"utf-8":return _Tr(this,e,r,n);case"ascii":case"latin1":case"binary":return vTr(this,e,r,n);case"base64":return wTr(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xTr(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};Se.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function STr(t,e,r){return e===0&&r===t.length?sCe.fromByteArray(t):sCe.fromByteArray(t.slice(e,r))}function Xet(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 CTr(n)}var Wet=4096;function CTr(t){let e=t.length;if(e<=Wet)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Wet));return r}function OTr(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 ETr(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 PTr(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+=jTr[t[i]];return o}function TTr(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}Se.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,Se.prototype),o};function Nc(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")}Se.prototype.readUintLE=Se.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nc(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return o};Se.prototype.readUintBE=Se.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nc(e,r,this.length);let o=this[e+--r],i=1;for(;r>0&&(i*=256);)o+=this[e+--r]*i;return o};Se.prototype.readUint8=Se.prototype.readUInt8=function(e,r){return e=e>>>0,r||Nc(e,1,this.length),this[e]};Se.prototype.readUint16LE=Se.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Nc(e,2,this.length),this[e]|this[e+1]<<8};Se.prototype.readUint16BE=Se.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Nc(e,2,this.length),this[e]<<8|this[e+1]};Se.prototype.readUint32LE=Se.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Nc(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};Se.prototype.readUint32BE=Se.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Nc(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};Se.prototype.readBigUInt64LE=XA(function(e){e=e>>>0,az(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&f8(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))});Se.prototype.readBigUInt64BE=XA(function(e){e=e>>>0,az(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&f8(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)});Se.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nc(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};Se.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nc(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};Se.prototype.readInt8=function(e,r){return e=e>>>0,r||Nc(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};Se.prototype.readInt16LE=function(e,r){e=e>>>0,r||Nc(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};Se.prototype.readInt16BE=function(e,r){e=e>>>0,r||Nc(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};Se.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Nc(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};Se.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Nc(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};Se.prototype.readBigInt64LE=XA(function(e){e=e>>>0,az(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&f8(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)});Se.prototype.readBigInt64BE=XA(function(e){e=e>>>0,az(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&f8(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)});Se.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Nc(e,4,this.length),iz.read(this,e,!0,23,4)};Se.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Nc(e,4,this.length),iz.read(this,e,!1,23,4)};Se.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Nc(e,8,this.length),iz.read(this,e,!0,52,8)};Se.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Nc(e,8,this.length),iz.read(this,e,!1,52,8)};function Pm(t,e,r,n,o,i){if(!Se.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")}Se.prototype.writeUintLE=Se.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;Pm(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};Se.prototype.writeUintBE=Se.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;Pm(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};Se.prototype.writeUint8=Se.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Pm(this,e,r,1,255,0),this[r]=e&255,r+1};Se.prototype.writeUint16LE=Se.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Pm(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};Se.prototype.writeUint16BE=Se.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Pm(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};Se.prototype.writeUint32LE=Se.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Pm(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};Se.prototype.writeUint32BE=Se.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Pm(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 Qet(t,e,r,n,o){ott(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 ett(t,e,r,n,o){ott(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}Se.prototype.writeBigUInt64LE=XA(function(e,r=0){return Qet(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});Se.prototype.writeBigUInt64BE=XA(function(e,r=0){return ett(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});Se.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Pm(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};Se.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Pm(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};Se.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Pm(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};Se.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Pm(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};Se.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Pm(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};Se.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Pm(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};Se.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Pm(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};Se.prototype.writeBigInt64LE=XA(function(e,r=0){return Qet(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});Se.prototype.writeBigInt64BE=XA(function(e,r=0){return ett(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ttt(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 rtt(t,e,r,n,o){return e=+e,r=r>>>0,o||ttt(t,e,r,4,34028234663852886e22,-34028234663852886e22),iz.write(t,e,r,n,23,4),r+4}Se.prototype.writeFloatLE=function(e,r,n){return rtt(this,e,r,!0,n)};Se.prototype.writeFloatBE=function(e,r,n){return rtt(this,e,r,!1,n)};function ntt(t,e,r,n,o){return e=+e,r=r>>>0,o||ttt(t,e,r,8,17976931348623157e292,-17976931348623157e292),iz.write(t,e,r,n,52,8),r+8}Se.prototype.writeDoubleLE=function(e,r,n){return ntt(this,e,r,!0,n)};Se.prototype.writeDoubleBE=function(e,r,n){return ntt(this,e,r,!1,n)};Se.prototype.copy=function(e,r,n,o){if(!Se.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};Se.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"&&!Se.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=Se.isBuffer(e)?e:Se.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 oz={};function pCe(t,e,r){oz[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}`}}}pCe("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);pCe("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);pCe("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=Ket(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=Ket(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function Ket(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 ATr(t,e,r){az(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&f8(e,t.length-(r+1))}function ott(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 oz.ERR_OUT_OF_RANGE("value",s,t)}ATr(n,o,i)}function az(t,e){if(typeof t!="number")throw new oz.ERR_INVALID_ARG_TYPE(e,"number",t)}function f8(t,e,r){throw Math.floor(t)!==t?(az(t,r),new oz.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new oz.ERR_BUFFER_OUT_OF_BOUNDS:new oz.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var ITr=/[^+/0-9A-Za-z-_]/g;function MTr(t){if(t=t.split("=")[0],t=t.trim().replace(ITr,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function cCe(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 RTr(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function NTr(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 itt(t){return sCe.toByteArray(MTr(t))}function Eee(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 Iv(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function mCe(t){return t!==t}var jTr=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 XA(t){return typeof BigInt>"u"?DTr:t}function DTr(){throw new Error("BigInt not supported")}});function p8(){return stt.Platform.isDesktop&&Pee||(Pee=require("electron")?.remote?.safeStorage),Pee}async function _Ce(){return await crypto.subtle.importKey("raw",LTr,Tee.name,!1,["encrypt","decrypt"])}async function utt(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 hCe(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await hCe(n.apiKey||"")})))),Array.isArray(t.activeEmbeddingModels)&&(e.activeEmbeddingModels=await Promise.all(t.activeEmbeddingModels.map(async n=>({...n,apiKey:await hCe(n.apiKey||"")})))),e}async function hCe(t){if(!t||t.startsWith(vCe))return t;ltt(t)&&(t=t.replace(Aee,""));try{if(p8()?.isEncryptionAvailable()){let o=p8().encryptString(t);return yCe+o.toString("base64")}let e=await _Ce(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(Tee,e,r);return bCe+kTr(n)}catch(e){return console.error("Encryption failed:",e),t}}async function _o(t){if(!t||FTr(t))return t;if(ltt(t))return t.replace(Aee,"");if(t.startsWith(yCe)){let r=t.replace(yCe,""),n=gCe.Buffer.from(r,"base64");return p8().decryptString(n)}if(t.startsWith(bCe)){let r=t.replace(bCe,""),n=await _Ce(),o=att(r),i=await crypto.subtle.decrypt(Tee,n,o);return new TextDecoder().decode(i)}let e=t.replace(vCe,"");try{if(p8()?.isEncryptionAvailable())try{let i=gCe.Buffer.from(e,"base64");return p8().decryptString(i)}catch{}let r=await _Ce(),n=att(e),o=await crypto.subtle.decrypt(Tee,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function FTr(t){return!t.startsWith(vCe)&&!t.startsWith(Aee)}function ltt(t){return t.startsWith(Aee)}function kTr(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 att(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 gCe,stt,Pee,yCe,bCe,vCe,Aee,LTr,Tee,Aj=b(()=>{gCe=j(Tm()),stt=require("obsidian"),Pee=null;yCe="enc_desk_",bCe="enc_web_",vCe="enc_",Aee="dec_",LTr=new TextEncoder().encode("obsidian-copilot-v1"),Tee={name:"AES-GCM",iv:new Uint8Array(12)}});function ptt(t){Wi.set(Mee,t)}function Nee(){return Wi.get(Mee)}function mtt(t){return Wi.sub(Mee,t)}function QA(){return WB(Mee,{store:Wi})}function Jg(){return Wi.get(Ree)}function Ij(t){Wi.set(Ree,t)}function htt(t){return Wi.sub(Ree,t)}function Ip(){return WB(Ree,{store:Wi})}function Mj(t){Wi.set(Iee,t)}function bu(){return Wi.get(Iee)}function uz(t){return Wi.sub(Iee,()=>{t(Wi.get(Iee))})}function EE(t){Wi.set(ftt,t)}function jee(){return WB(ftt,{store:Wi})}function Rj(){return Jg()==="project"}function xCe(t){Wi.set(wCe,t)}function Nj(){return Wi.get(wCe)}function gtt(t){let e=Nj();xCe([...e,t])}function ytt(t){let e=Nj();xCe(e.filter(r=>r.id!==t))}function btt(){xCe([])}function _tt(){return WB(wCe,{store:Wi})}function vtt(t){Wi.set(m8,t)}function Mv(t,e){Wi.set(m8,r=>({...r,[t]:e(r[t])}))}function Dee(){return WB(m8,{store:Wi})}var ctt,Mee,dtt,Ree,Iee,ftt,m8,wCe,sa=b(()=>{oc();bt();t8();ctt=Ih(null),Mee=Ih(t=>{let e=t(ctt);return e!==null?e:t(KA).defaultModelKey},(t,e,r)=>{e(ctt,r)}),dtt=Ih(null),Ree=Ih(t=>{let e=t(dtt);return e!==null?e:t(KA).defaultChainType},(t,e,r)=>{e(dtt,r)}),Iee=Ih(null),ftt=Ih(!1),m8=Ih({success:[],failed:[],processingFiles:[],total:[]}),wCe=Ih([])});var Itt=x(ua=>{"use strict";function ECe(t,e){var r=t.length;t.push(e);e:for(;0<r;){var n=r-1>>>1,o=t[n];if(0<Lee(o,e))t[n]=e,t[r]=o,r=n;else break e}}function Nb(t){return t.length===0?null:t[0]}function kee(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>Lee(s,r))u<o&&0>Lee(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(u<o&&0>Lee(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function Lee(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(wtt=performance,ua.unstable_now=function(){return wtt.now()}):(SCe=Date,xtt=SCe.now(),ua.unstable_now=function(){return SCe.now()-xtt});var wtt,SCe,xtt,Rv=[],eI=[],$Tr=1,Zg=null,Rf=3,$ee=!1,jj=!1,g8=!1,Ott=typeof setTimeout=="function"?setTimeout:null,Ett=typeof clearTimeout=="function"?clearTimeout:null,Stt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function PCe(t){for(var e=Nb(eI);e!==null;){if(e.callback===null)kee(eI);else if(e.startTime<=t)kee(eI),e.sortIndex=e.expirationTime,ECe(Rv,e);else break;e=Nb(eI)}}function TCe(t){if(g8=!1,PCe(t),!jj)if(Nb(Rv)!==null)jj=!0,ICe(ACe);else{var e=Nb(eI);e!==null&&MCe(TCe,e.startTime-t)}}function ACe(t,e){jj=!1,g8&&(g8=!1,Ett(y8),y8=-1),$ee=!0;var r=Rf;try{for(PCe(e),Zg=Nb(Rv);Zg!==null&&(!(Zg.expirationTime>e)||t&&!Att());){var n=Zg.callback;if(typeof n=="function"){Zg.callback=null,Rf=Zg.priorityLevel;var o=n(Zg.expirationTime<=e);e=ua.unstable_now(),typeof o=="function"?Zg.callback=o:Zg===Nb(Rv)&&kee(Rv),PCe(e)}else kee(Rv);Zg=Nb(Rv)}if(Zg!==null)var i=!0;else{var a=Nb(eI);a!==null&&MCe(TCe,a.startTime-e),i=!1}return i}finally{Zg=null,Rf=r,$ee=!1}}var Bee=!1,Fee=null,y8=-1,Ptt=5,Ttt=-1;function Att(){return!(ua.unstable_now()-Ttt<Ptt)}function CCe(){if(Fee!==null){var t=ua.unstable_now();Ttt=t;var e=!0;try{e=Fee(!0,t)}finally{e?h8():(Bee=!1,Fee=null)}}else Bee=!1}var h8;typeof Stt=="function"?h8=function(){Stt(CCe)}:typeof MessageChannel<"u"?(OCe=new MessageChannel,Ctt=OCe.port2,OCe.port1.onmessage=CCe,h8=function(){Ctt.postMessage(null)}):h8=function(){Ott(CCe,0)};var OCe,Ctt;function ICe(t){Fee=t,Bee||(Bee=!0,h8())}function MCe(t,e){y8=Ott(function(){t(ua.unstable_now())},e)}ua.unstable_IdlePriority=5;ua.unstable_ImmediatePriority=1;ua.unstable_LowPriority=4;ua.unstable_NormalPriority=3;ua.unstable_Profiling=null;ua.unstable_UserBlockingPriority=2;ua.unstable_cancelCallback=function(t){t.callback=null};ua.unstable_continueExecution=function(){jj||$ee||(jj=!0,ICe(ACe))};ua.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"):Ptt=0<t?Math.floor(1e3/t):5};ua.unstable_getCurrentPriorityLevel=function(){return Rf};ua.unstable_getFirstCallbackNode=function(){return Nb(Rv)};ua.unstable_next=function(t){switch(Rf){case 1:case 2:case 3:var e=3;break;default:e=Rf}var r=Rf;Rf=e;try{return t()}finally{Rf=r}};ua.unstable_pauseExecution=function(){};ua.unstable_requestPaint=function(){};ua.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=Rf;Rf=t;try{return e()}finally{Rf=r}};ua.unstable_scheduleCallback=function(t,e,r){var n=ua.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:$Tr++,callback:e,priorityLevel:t,startTime:r,expirationTime:o,sortIndex:-1},r>n?(t.sortIndex=r,ECe(eI,t),Nb(Rv)===null&&t===Nb(eI)&&(g8?(Ett(y8),y8=-1):g8=!0,MCe(TCe,r-n))):(t.sortIndex=o,ECe(Rv,t),jj||$ee||(jj=!0,ICe(ACe))),t};ua.unstable_shouldYield=Att;ua.unstable_wrapCallback=function(t){var e=Rf;return function(){var r=Rf;Rf=e;try{return t.apply(this,arguments)}finally{Rf=r}}}});var Rtt=x((Tso,Mtt)=>{"use strict";Mtt.exports=Itt()});var kot=x(Fh=>{"use strict";var $rt=X(),Dh=Rtt();function We(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 Brt=new Set,$8={};function Kj(t,e){Az(t,e),Az(t+"Capture",e)}function Az(t,e){for($8[t]=e,t=0;t<e.length;t++)Brt.add(e[t])}var RE=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),eOe=Object.prototype.hasOwnProperty,BTr=/^[: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]*$/,Ntt={},jtt={};function zTr(t){return eOe.call(jtt,t)?!0:eOe.call(Ntt,t)?!1:BTr.test(t)?jtt[t]=!0:(Ntt[t]=!0,!1)}function UTr(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 qTr(t,e,r,n){if(e===null||typeof e>"u"||UTr(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 Np(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 Pd={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Pd[t]=new Np(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Pd[e]=new Np(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Pd[t]=new Np(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Pd[t]=new Np(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){Pd[t]=new Np(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Pd[t]=new Np(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Pd[t]=new Np(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Pd[t]=new Np(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Pd[t]=new Np(t,5,!1,t.toLowerCase(),null,!1,!1)});var WOe=/[\-:]([a-z])/g;function KOe(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(WOe,KOe);Pd[e]=new Np(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(WOe,KOe);Pd[e]=new Np(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(WOe,KOe);Pd[e]=new Np(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Pd[t]=new Np(t,1,!1,t.toLowerCase(),null,!1,!1)});Pd.xlinkHref=new Np("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Pd[t]=new Np(t,1,!1,t.toLowerCase(),null,!0,!0)});function GOe(t,e,r,n){var o=Pd.hasOwnProperty(e)?Pd[e]:null;(o!==null?o.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(qTr(e,r,o,n)&&(r=null),n||o===null?zTr(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 LE=$rt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,zee=Symbol.for("react.element"),dz=Symbol.for("react.portal"),fz=Symbol.for("react.fragment"),JOe=Symbol.for("react.strict_mode"),tOe=Symbol.for("react.profiler"),zrt=Symbol.for("react.provider"),Urt=Symbol.for("react.context"),ZOe=Symbol.for("react.forward_ref"),rOe=Symbol.for("react.suspense"),nOe=Symbol.for("react.suspense_list"),YOe=Symbol.for("react.memo"),rI=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var qrt=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var Dtt=Symbol.iterator;function b8(t){return t===null||typeof t!="object"?null:(t=Dtt&&t[Dtt]||t["@@iterator"],typeof t=="function"?t:null)}var ss=Object.assign,RCe;function E8(t){if(RCe===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);RCe=e&&e[1]||""}return`
`+RCe+t}var NCe=!1;function jCe(t,e){if(!t||NCe)return"";NCe=!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{NCe=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?E8(t):""}function HTr(t){switch(t.tag){case 5:return E8(t.type);case 16:return E8("Lazy");case 13:return E8("Suspense");case 19:return E8("SuspenseList");case 0:case 2:case 15:return t=jCe(t.type,!1),t;case 11:return t=jCe(t.type.render,!1),t;case 1:return t=jCe(t.type,!0),t;default:return""}}function oOe(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 fz:return"Fragment";case dz:return"Portal";case tOe:return"Profiler";case JOe:return"StrictMode";case rOe:return"Suspense";case nOe:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Urt:return(t.displayName||"Context")+".Consumer";case zrt:return(t._context.displayName||"Context")+".Provider";case ZOe:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case YOe:return e=t.displayName||null,e!==null?e:oOe(t.type)||"Memo";case rI:e=t._payload,t=t._init;try{return oOe(t(e))}catch{}}return null}function VTr(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 oOe(e);case 8:return e===JOe?"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 gI(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Hrt(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function WTr(t){var e=Hrt(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 Uee(t){t._valueTracker||(t._valueTracker=WTr(t))}function Vrt(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=Hrt(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function gte(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 iOe(t,e){var r=e.checked;return ss({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Ltt(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=gI(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 Wrt(t,e){e=e.checked,e!=null&&GOe(t,"checked",e,!1)}function aOe(t,e){Wrt(t,e);var r=gI(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")?sOe(t,e.type,r):e.hasOwnProperty("defaultValue")&&sOe(t,e.type,gI(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Ftt(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 sOe(t,e,r){(e!=="number"||gte(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var P8=Array.isArray;function Sz(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=""+gI(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 uOe(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(We(91));return ss({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function ktt(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(We(92));if(P8(r)){if(1<r.length)throw Error(We(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:gI(r)}}function Krt(t,e){var r=gI(e.value),n=gI(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 $tt(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Grt(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 lOe(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Grt(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var qee,Jrt=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(qee=qee||document.createElement("div"),qee.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=qee.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function B8(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var I8={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},KTr=["Webkit","ms","Moz","O"];Object.keys(I8).forEach(function(t){KTr.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),I8[e]=I8[t]})});function Zrt(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||I8.hasOwnProperty(t)&&I8[t]?(""+e).trim():e+"px"}function Yrt(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=Zrt(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var GTr=ss({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 cOe(t,e){if(e){if(GTr[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(We(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(We(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(We(61))}if(e.style!=null&&typeof e.style!="object")throw Error(We(62))}}function dOe(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 fOe=null;function XOe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var pOe=null,Cz=null,Oz=null;function Btt(t){if(t=o5(t)){if(typeof pOe!="function")throw Error(We(280));var e=t.stateNode;e&&(e=Hte(e),pOe(t.stateNode,t.type,e))}}function Xrt(t){Cz?Oz?Oz.push(t):Oz=[t]:Cz=t}function Qrt(){if(Cz){var t=Cz,e=Oz;if(Oz=Cz=null,Btt(t),e)for(t=0;t<e.length;t++)Btt(e[t])}}function ent(t,e){return t(e)}function tnt(){}var DCe=!1;function rnt(t,e,r){if(DCe)return t(e,r);DCe=!0;try{return ent(t,e,r)}finally{DCe=!1,(Cz!==null||Oz!==null)&&(tnt(),Qrt())}}function z8(t,e){var r=t.stateNode;if(r===null)return null;var n=Hte(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(We(231,e,typeof r));return r}var mOe=!1;if(RE)try{lz={},Object.defineProperty(lz,"passive",{get:function(){mOe=!0}}),window.addEventListener("test",lz,lz),window.removeEventListener("test",lz,lz)}catch{mOe=!1}var lz;function JTr(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 M8=!1,yte=null,bte=!1,hOe=null,ZTr={onError:function(t){M8=!0,yte=t}};function YTr(t,e,r,n,o,i,a,s,u){M8=!1,yte=null,JTr.apply(ZTr,arguments)}function XTr(t,e,r,n,o,i,a,s,u){if(YTr.apply(this,arguments),M8){if(M8){var l=yte;M8=!1,yte=null}else throw Error(We(198));bte||(bte=!0,hOe=l)}}function Gj(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 nnt(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 ztt(t){if(Gj(t)!==t)throw Error(We(188))}function QTr(t){var e=t.alternate;if(!e){if(e=Gj(t),e===null)throw Error(We(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 ztt(o),t;if(i===n)return ztt(o),e;i=i.sibling}throw Error(We(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(We(189))}}if(r.alternate!==n)throw Error(We(190))}if(r.tag!==3)throw Error(We(188));return r.stateNode.current===r?t:e}function ont(t){return t=QTr(t),t!==null?int(t):null}function int(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=int(t);if(e!==null)return e;t=t.sibling}return null}var ant=Dh.unstable_scheduleCallback,Utt=Dh.unstable_cancelCallback,eAr=Dh.unstable_shouldYield,tAr=Dh.unstable_requestPaint,eu=Dh.unstable_now,rAr=Dh.unstable_getCurrentPriorityLevel,QOe=Dh.unstable_ImmediatePriority,snt=Dh.unstable_UserBlockingPriority,_te=Dh.unstable_NormalPriority,nAr=Dh.unstable_LowPriority,unt=Dh.unstable_IdlePriority,Bte=null,Lv=null;function oAr(t){if(Lv&&typeof Lv.onCommitFiberRoot=="function")try{Lv.onCommitFiberRoot(Bte,t,void 0,(t.current.flags&128)===128)}catch{}}var kb=Math.clz32?Math.clz32:sAr,iAr=Math.log,aAr=Math.LN2;function sAr(t){return t>>>=0,t===0?32:31-(iAr(t)/aAr|0)|0}var Hee=64,Vee=4194304;function T8(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 vte(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=T8(s):(i&=a,i!==0&&(n=T8(i)))}else a=r&~o,a!==0?n=T8(a):i!==0&&(n=T8(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-kb(e),o=1<<r,n|=t[r],e&=~o;return n}function uAr(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 lAr(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var a=31-kb(i),s=1<<a,u=o[a];u===-1?((s&r)===0||(s&n)!==0)&&(o[a]=uAr(s,e)):u<=e&&(t.expiredLanes|=s),i&=~s}}function gOe(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function lnt(){var t=Hee;return Hee<<=1,(Hee&4194240)===0&&(Hee=64),t}function LCe(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function r5(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-kb(e),t[e]=r}function cAr(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-kb(r),i=1<<o;e[o]=0,n[o]=-1,t[o]=-1,r&=~i}}function eEe(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-kb(r),o=1<<n;o&e|t[n]&e&&(t[n]|=e),r&=~o}}var Di=0;function cnt(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var dnt,tEe,fnt,pnt,mnt,yOe=!1,Wee=[],uI=null,lI=null,cI=null,U8=new Map,q8=new Map,oI=[],dAr="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 qtt(t,e){switch(t){case"focusin":case"focusout":uI=null;break;case"dragenter":case"dragleave":lI=null;break;case"mouseover":case"mouseout":cI=null;break;case"pointerover":case"pointerout":U8.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":q8.delete(e.pointerId)}}function _8(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=o5(e),e!==null&&tEe(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function fAr(t,e,r,n,o){switch(e){case"focusin":return uI=_8(uI,t,e,r,n,o),!0;case"dragenter":return lI=_8(lI,t,e,r,n,o),!0;case"mouseover":return cI=_8(cI,t,e,r,n,o),!0;case"pointerover":var i=o.pointerId;return U8.set(i,_8(U8.get(i)||null,t,e,r,n,o)),!0;case"gotpointercapture":return i=o.pointerId,q8.set(i,_8(q8.get(i)||null,t,e,r,n,o)),!0}return!1}function hnt(t){var e=Fj(t.target);if(e!==null){var r=Gj(e);if(r!==null){if(e=r.tag,e===13){if(e=nnt(r),e!==null){t.blockedOn=e,mnt(t.priority,function(){fnt(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 ate(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=bOe(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);fOe=n,r.target.dispatchEvent(n),fOe=null}else return e=o5(r),e!==null&&tEe(e),t.blockedOn=r,!1;e.shift()}return!0}function Htt(t,e,r){ate(t)&&r.delete(e)}function pAr(){yOe=!1,uI!==null&&ate(uI)&&(uI=null),lI!==null&&ate(lI)&&(lI=null),cI!==null&&ate(cI)&&(cI=null),U8.forEach(Htt),q8.forEach(Htt)}function v8(t,e){t.blockedOn===e&&(t.blockedOn=null,yOe||(yOe=!0,Dh.unstable_scheduleCallback(Dh.unstable_NormalPriority,pAr)))}function H8(t){function e(o){return v8(o,t)}if(0<Wee.length){v8(Wee[0],t);for(var r=1;r<Wee.length;r++){var n=Wee[r];n.blockedOn===t&&(n.blockedOn=null)}}for(uI!==null&&v8(uI,t),lI!==null&&v8(lI,t),cI!==null&&v8(cI,t),U8.forEach(e),q8.forEach(e),r=0;r<oI.length;r++)n=oI[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<oI.length&&(r=oI[0],r.blockedOn===null);)hnt(r),r.blockedOn===null&&oI.shift()}var Ez=LE.ReactCurrentBatchConfig,wte=!0;function mAr(t,e,r,n){var o=Di,i=Ez.transition;Ez.transition=null;try{Di=1,rEe(t,e,r,n)}finally{Di=o,Ez.transition=i}}function hAr(t,e,r,n){var o=Di,i=Ez.transition;Ez.transition=null;try{Di=4,rEe(t,e,r,n)}finally{Di=o,Ez.transition=i}}function rEe(t,e,r,n){if(wte){var o=bOe(t,e,r,n);if(o===null)qCe(t,e,n,xte,r),qtt(t,n);else if(fAr(o,t,e,r,n))n.stopPropagation();else if(qtt(t,n),e&4&&-1<dAr.indexOf(t)){for(;o!==null;){var i=o5(o);if(i!==null&&dnt(i),i=bOe(t,e,r,n),i===null&&qCe(t,e,n,xte,r),i===o)break;o=i}o!==null&&n.stopPropagation()}else qCe(t,e,n,null,r)}}var xte=null;function bOe(t,e,r,n){if(xte=null,t=XOe(n),t=Fj(t),t!==null)if(e=Gj(t),e===null)t=null;else if(r=e.tag,r===13){if(t=nnt(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 xte=t,null}function gnt(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(rAr()){case QOe:return 1;case snt:return 4;case _te:case nAr:return 16;case unt:return 536870912;default:return 16}default:return 16}}var aI=null,nEe=null,ste=null;function ynt(){if(ste)return ste;var t,e=nEe,r=e.length,n,o="value"in aI?aI.value:aI.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 ste=o.slice(t,1<n?1-n:void 0)}function ute(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 Kee(){return!0}function Vtt(){return!1}function Lh(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)?Kee:Vtt,this.isPropagationStopped=Vtt,this}return ss(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=Kee)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Kee)},persist:function(){},isPersistent:Kee}),e}var Lz={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},oEe=Lh(Lz),n5=ss({},Lz,{view:0,detail:0}),gAr=Lh(n5),FCe,kCe,w8,zte=ss({},n5,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:iEe,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!==w8&&(w8&&t.type==="mousemove"?(FCe=t.screenX-w8.screenX,kCe=t.screenY-w8.screenY):kCe=FCe=0,w8=t),FCe)},movementY:function(t){return"movementY"in t?t.movementY:kCe}}),Wtt=Lh(zte),yAr=ss({},zte,{dataTransfer:0}),bAr=Lh(yAr),_Ar=ss({},n5,{relatedTarget:0}),$Ce=Lh(_Ar),vAr=ss({},Lz,{animationName:0,elapsedTime:0,pseudoElement:0}),wAr=Lh(vAr),xAr=ss({},Lz,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),SAr=Lh(xAr),CAr=ss({},Lz,{data:0}),Ktt=Lh(CAr),OAr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},EAr={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"},PAr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function TAr(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=PAr[t])?!!e[t]:!1}function iEe(){return TAr}var AAr=ss({},n5,{key:function(t){if(t.key){var e=OAr[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=ute(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?EAr[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:iEe,charCode:function(t){return t.type==="keypress"?ute(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ute(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),IAr=Lh(AAr),MAr=ss({},zte,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Gtt=Lh(MAr),RAr=ss({},n5,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:iEe}),NAr=Lh(RAr),jAr=ss({},Lz,{propertyName:0,elapsedTime:0,pseudoElement:0}),DAr=Lh(jAr),LAr=ss({},zte,{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}),FAr=Lh(LAr),kAr=[9,13,27,32],aEe=RE&&"CompositionEvent"in window,R8=null;RE&&"documentMode"in document&&(R8=document.documentMode);var $Ar=RE&&"TextEvent"in window&&!R8,bnt=RE&&(!aEe||R8&&8<R8&&11>=R8),Jtt=" ",Ztt=!1;function _nt(t,e){switch(t){case"keyup":return kAr.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vnt(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var pz=!1;function BAr(t,e){switch(t){case"compositionend":return vnt(e);case"keypress":return e.which!==32?null:(Ztt=!0,Jtt);case"textInput":return t=e.data,t===Jtt&&Ztt?null:t;default:return null}}function zAr(t,e){if(pz)return t==="compositionend"||!aEe&&_nt(t,e)?(t=ynt(),ste=nEe=aI=null,pz=!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 bnt&&e.locale!=="ko"?null:e.data;default:return null}}var UAr={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 Ytt(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!UAr[t.type]:e==="textarea"}function wnt(t,e,r,n){Xrt(n),e=Ste(e,"onChange"),0<e.length&&(r=new oEe("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var N8=null,V8=null;function qAr(t){Rnt(t,0)}function Ute(t){var e=gz(t);if(Vrt(e))return t}function HAr(t,e){if(t==="change")return e}var xnt=!1;RE&&(RE?(Jee="oninput"in document,Jee||(BCe=document.createElement("div"),BCe.setAttribute("oninput","return;"),Jee=typeof BCe.oninput=="function"),Gee=Jee):Gee=!1,xnt=Gee&&(!document.documentMode||9<document.documentMode));var Gee,Jee,BCe;function Xtt(){N8&&(N8.detachEvent("onpropertychange",Snt),V8=N8=null)}function Snt(t){if(t.propertyName==="value"&&Ute(V8)){var e=[];wnt(e,V8,t,XOe(t)),rnt(qAr,e)}}function VAr(t,e,r){t==="focusin"?(Xtt(),N8=e,V8=r,N8.attachEvent("onpropertychange",Snt)):t==="focusout"&&Xtt()}function WAr(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ute(V8)}function KAr(t,e){if(t==="click")return Ute(e)}function GAr(t,e){if(t==="input"||t==="change")return Ute(e)}function JAr(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Bb=typeof Object.is=="function"?Object.is:JAr;function W8(t,e){if(Bb(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(!eOe.call(e,o)||!Bb(t[o],e[o]))return!1}return!0}function Qtt(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function ert(t,e){var r=Qtt(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=Qtt(r)}}function Cnt(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Cnt(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Ont(){for(var t=window,e=gte();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=gte(t.document)}return e}function sEe(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 ZAr(t){var e=Ont(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&Cnt(r.ownerDocument.documentElement,r)){if(n!==null&&sEe(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=ert(r,i);var a=ert(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 YAr=RE&&"documentMode"in document&&11>=document.documentMode,mz=null,_Oe=null,j8=null,vOe=!1;function trt(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;vOe||mz==null||mz!==gte(n)||(n=mz,"selectionStart"in n&&sEe(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}),j8&&W8(j8,n)||(j8=n,n=Ste(_Oe,"onSelect"),0<n.length&&(e=new oEe("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=mz)))}function Zee(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var hz={animationend:Zee("Animation","AnimationEnd"),animationiteration:Zee("Animation","AnimationIteration"),animationstart:Zee("Animation","AnimationStart"),transitionend:Zee("Transition","TransitionEnd")},zCe={},Ent={};RE&&(Ent=document.createElement("div").style,"AnimationEvent"in window||(delete hz.animationend.animation,delete hz.animationiteration.animation,delete hz.animationstart.animation),"TransitionEvent"in window||delete hz.transitionend.transition);function qte(t){if(zCe[t])return zCe[t];if(!hz[t])return t;var e=hz[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in Ent)return zCe[t]=e[r];return t}var Pnt=qte("animationend"),Tnt=qte("animationiteration"),Ant=qte("animationstart"),Int=qte("transitionend"),Mnt=new Map,rrt="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 bI(t,e){Mnt.set(t,e),Kj(e,[t])}for(Yee=0;Yee<rrt.length;Yee++)Xee=rrt[Yee],nrt=Xee.toLowerCase(),ort=Xee[0].toUpperCase()+Xee.slice(1),bI(nrt,"on"+ort);var Xee,nrt,ort,Yee;bI(Pnt,"onAnimationEnd");bI(Tnt,"onAnimationIteration");bI(Ant,"onAnimationStart");bI("dblclick","onDoubleClick");bI("focusin","onFocus");bI("focusout","onBlur");bI(Int,"onTransitionEnd");Az("onMouseEnter",["mouseout","mouseover"]);Az("onMouseLeave",["mouseout","mouseover"]);Az("onPointerEnter",["pointerout","pointerover"]);Az("onPointerLeave",["pointerout","pointerover"]);Kj("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Kj("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Kj("onBeforeInput",["compositionend","keypress","textInput","paste"]);Kj("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Kj("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Kj("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var A8="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(" "),XAr=new Set("cancel close invalid load scroll toggle".split(" ").concat(A8));function irt(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,XTr(n,e,void 0,t),t.currentTarget=null}function Rnt(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;irt(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;irt(o,s,l),i=u}}}if(bte)throw t=hOe,bte=!1,hOe=null,t}function wa(t,e){var r=e[OOe];r===void 0&&(r=e[OOe]=new Set);var n=t+"__bubble";r.has(n)||(Nnt(e,t,2,!1),r.add(n))}function UCe(t,e,r){var n=0;e&&(n|=4),Nnt(r,t,n,e)}var Qee="_reactListening"+Math.random().toString(36).slice(2);function K8(t){if(!t[Qee]){t[Qee]=!0,Brt.forEach(function(r){r!=="selectionchange"&&(XAr.has(r)||UCe(r,!1,t),UCe(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Qee]||(e[Qee]=!0,UCe("selectionchange",!1,e))}}function Nnt(t,e,r,n){switch(gnt(e)){case 1:var o=mAr;break;case 4:o=hAr;break;default:o=rEe}r=o.bind(null,e,r,t),o=void 0,!mOe||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 qCe(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=Fj(s),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}s=s.parentNode}}n=n.return}rnt(function(){var l=i,c=XOe(r),d=[];e:{var f=Mnt.get(t);if(f!==void 0){var p=oEe,h=t;switch(t){case"keypress":if(ute(r)===0)break e;case"keydown":case"keyup":p=IAr;break;case"focusin":h="focus",p=$Ce;break;case"focusout":h="blur",p=$Ce;break;case"beforeblur":case"afterblur":p=$Ce;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=Wtt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=bAr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=NAr;break;case Pnt:case Tnt:case Ant:p=wAr;break;case Int:p=DAr;break;case"scroll":p=gAr;break;case"wheel":p=FAr;break;case"copy":case"cut":case"paste":p=SAr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Gtt}var m=(e&4)!==0,g=!m&&t==="scroll",y=m?f!==null?f+"Capture":null:f;m=[];for(var _=l,w;_!==null;){w=_;var S=w.stateNode;if(w.tag===5&&S!==null&&(w=S,y!==null&&(S=z8(_,y),S!=null&&m.push(G8(_,S,w)))),g)break;_=_.return}0<m.length&&(f=new p(f,h,null,r,c),d.push({event:f,listeners:m}))}}if((e&7)===0){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&r!==fOe&&(h=r.relatedTarget||r.fromElement)&&(Fj(h)||h[NE]))break e;if((p||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,p?(h=r.relatedTarget||r.toElement,p=l,h=h?Fj(h):null,h!==null&&(g=Gj(h),h!==g||h.tag!==5&&h.tag!==6)&&(h=null)):(p=null,h=l),p!==h)){if(m=Wtt,S="onMouseLeave",y="onMouseEnter",_="mouse",(t==="pointerout"||t==="pointerover")&&(m=Gtt,S="onPointerLeave",y="onPointerEnter",_="pointer"),g=p==null?f:gz(p),w=h==null?f:gz(h),f=new m(S,_+"leave",p,r,c),f.target=g,f.relatedTarget=w,S=null,Fj(c)===l&&(m=new m(y,_+"enter",h,r,c),m.target=w,m.relatedTarget=g,S=m),g=S,p&&h)t:{for(m=p,y=h,_=0,w=m;w;w=cz(w))_++;for(w=0,S=y;S;S=cz(S))w++;for(;0<_-w;)m=cz(m),_--;for(;0<w-_;)y=cz(y),w--;for(;_--;){if(m===y||y!==null&&m===y.alternate)break t;m=cz(m),y=cz(y)}m=null}else m=null;p!==null&&art(d,f,p,m,!1),h!==null&&g!==null&&art(d,g,h,m,!0)}}e:{if(f=l?gz(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var C=HAr;else if(Ytt(f))if(xnt)C=GAr;else{C=WAr;var E=VAr}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(C=KAr);if(C&&(C=C(t,l))){wnt(d,C,r,c);break e}E&&E(t,f,l),t==="focusout"&&(E=f._wrapperState)&&E.controlled&&f.type==="number"&&sOe(f,"number",f.value)}switch(E=l?gz(l):window,t){case"focusin":(Ytt(E)||E.contentEditable==="true")&&(mz=E,_Oe=l,j8=null);break;case"focusout":j8=_Oe=mz=null;break;case"mousedown":vOe=!0;break;case"contextmenu":case"mouseup":case"dragend":vOe=!1,trt(d,r,c);break;case"selectionchange":if(YAr)break;case"keydown":case"keyup":trt(d,r,c)}var P;if(aEe)e:{switch(t){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else pz?_nt(t,r)&&(T="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(T="onCompositionStart");T&&(bnt&&r.locale!=="ko"&&(pz||T!=="onCompositionStart"?T==="onCompositionEnd"&&pz&&(P=ynt()):(aI=c,nEe="value"in aI?aI.value:aI.textContent,pz=!0)),E=Ste(l,T),0<E.length&&(T=new Ktt(T,t,null,r,c),d.push({event:T,listeners:E}),P?T.data=P:(P=vnt(r),P!==null&&(T.data=P)))),(P=$Ar?BAr(t,r):zAr(t,r))&&(l=Ste(l,"onBeforeInput"),0<l.length&&(c=new Ktt("onBeforeInput","beforeinput",null,r,c),d.push({event:c,listeners:l}),c.data=P))}Rnt(d,e)})}function G8(t,e,r){return{instance:t,listener:e,currentTarget:r}}function Ste(t,e){for(var r=e+"Capture",n=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=z8(t,r),i!=null&&n.unshift(G8(t,i,o)),i=z8(t,e),i!=null&&n.push(G8(t,i,o))),t=t.return}return n}function cz(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function art(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=z8(r,i),u!=null&&a.unshift(G8(r,u,s))):o||(u=z8(r,i),u!=null&&a.push(G8(r,u,s)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var QAr=/\r\n?/g,eIr=/\u0000|\uFFFD/g;function srt(t){return(typeof t=="string"?t:""+t).replace(QAr,`
`).replace(eIr,"")}function ete(t,e,r){if(e=srt(e),srt(t)!==e&&r)throw Error(We(425))}function Cte(){}var wOe=null,xOe=null;function SOe(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 COe=typeof setTimeout=="function"?setTimeout:void 0,tIr=typeof clearTimeout=="function"?clearTimeout:void 0,urt=typeof Promise=="function"?Promise:void 0,rIr=typeof queueMicrotask=="function"?queueMicrotask:typeof urt<"u"?function(t){return urt.resolve(null).then(t).catch(nIr)}:COe;function nIr(t){setTimeout(function(){throw t})}function HCe(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),H8(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=o}while(r);H8(e)}function dI(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 lrt(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 Fz=Math.random().toString(36).slice(2),Dv="__reactFiber$"+Fz,J8="__reactProps$"+Fz,NE="__reactContainer$"+Fz,OOe="__reactEvents$"+Fz,oIr="__reactListeners$"+Fz,iIr="__reactHandles$"+Fz;function Fj(t){var e=t[Dv];if(e)return e;for(var r=t.parentNode;r;){if(e=r[NE]||r[Dv]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=lrt(t);t!==null;){if(r=t[Dv])return r;t=lrt(t)}return e}t=r,r=t.parentNode}return null}function o5(t){return t=t[Dv]||t[NE],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function gz(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(We(33))}function Hte(t){return t[J8]||null}var EOe=[],yz=-1;function _I(t){return{current:t}}function xa(t){0>yz||(t.current=EOe[yz],EOe[yz]=null,yz--)}function la(t,e){yz++,EOe[yz]=t.current,t.current=e}var yI={},Lf=_I(yI),Mm=_I(!1),Uj=yI;function Iz(t,e){var r=t.type.contextTypes;if(!r)return yI;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 Rm(t){return t=t.childContextTypes,t!=null}function Ote(){xa(Mm),xa(Lf)}function crt(t,e,r){if(Lf.current!==yI)throw Error(We(168));la(Lf,e),la(Mm,r)}function jnt(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(We(108,VTr(t)||"Unknown",o));return ss({},r,n)}function Ete(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||yI,Uj=Lf.current,la(Lf,t),la(Mm,Mm.current),!0}function drt(t,e,r){var n=t.stateNode;if(!n)throw Error(We(169));r?(t=jnt(t,e,Uj),n.__reactInternalMemoizedMergedChildContext=t,xa(Mm),xa(Lf),la(Lf,t)):xa(Mm),la(Mm,r)}var TE=null,Vte=!1,VCe=!1;function Dnt(t){TE===null?TE=[t]:TE.push(t)}function aIr(t){Vte=!0,Dnt(t)}function vI(){if(!VCe&&TE!==null){VCe=!0;var t=0,e=Di;try{var r=TE;for(Di=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}TE=null,Vte=!1}catch(o){throw TE!==null&&(TE=TE.slice(t+1)),ant(QOe,vI),o}finally{Di=e,VCe=!1}}return null}var bz=[],_z=0,Pte=null,Tte=0,Yg=[],Xg=0,qj=null,AE=1,IE="";function Dj(t,e){bz[_z++]=Tte,bz[_z++]=Pte,Pte=t,Tte=e}function Lnt(t,e,r){Yg[Xg++]=AE,Yg[Xg++]=IE,Yg[Xg++]=qj,qj=t;var n=AE;t=IE;var o=32-kb(n)-1;n&=~(1<<o),r+=1;var i=32-kb(e)+o;if(30<i){var a=o-o%5;i=(n&(1<<a)-1).toString(32),n>>=a,o-=a,AE=1<<32-kb(e)+o|r<<o|n,IE=i+t}else AE=1<<i|r<<o|n,IE=t}function uEe(t){t.return!==null&&(Dj(t,1),Lnt(t,1,0))}function lEe(t){for(;t===Pte;)Pte=bz[--_z],bz[_z]=null,Tte=bz[--_z],bz[_z]=null;for(;t===qj;)qj=Yg[--Xg],Yg[Xg]=null,IE=Yg[--Xg],Yg[Xg]=null,AE=Yg[--Xg],Yg[Xg]=null}var jh=null,Nh=null,$a=!1,Fb=null;function Fnt(t,e){var r=Qg(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 frt(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,jh=t,Nh=dI(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,jh=t,Nh=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=qj!==null?{id:AE,overflow:IE}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=Qg(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,jh=t,Nh=null,!0):!1;default:return!1}}function POe(t){return(t.mode&1)!==0&&(t.flags&128)===0}function TOe(t){if($a){var e=Nh;if(e){var r=e;if(!frt(t,e)){if(POe(t))throw Error(We(418));e=dI(r.nextSibling);var n=jh;e&&frt(t,e)?Fnt(n,r):(t.flags=t.flags&-4097|2,$a=!1,jh=t)}}else{if(POe(t))throw Error(We(418));t.flags=t.flags&-4097|2,$a=!1,jh=t}}}function prt(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;jh=t}function tte(t){if(t!==jh)return!1;if(!$a)return prt(t),$a=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!SOe(t.type,t.memoizedProps)),e&&(e=Nh)){if(POe(t))throw knt(),Error(We(418));for(;e;)Fnt(t,e),e=dI(e.nextSibling)}if(prt(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(We(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){Nh=dI(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}Nh=null}}else Nh=jh?dI(t.stateNode.nextSibling):null;return!0}function knt(){for(var t=Nh;t;)t=dI(t.nextSibling)}function Mz(){Nh=jh=null,$a=!1}function cEe(t){Fb===null?Fb=[t]:Fb.push(t)}var sIr=LE.ReactCurrentBatchConfig;function Db(t,e){if(t&&t.defaultProps){e=ss({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}var Ate=_I(null),Ite=null,vz=null,dEe=null;function fEe(){dEe=vz=Ite=null}function pEe(t){var e=Ate.current;xa(Ate),t._currentValue=e}function AOe(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 Pz(t,e){Ite=t,dEe=vz=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&e)!==0&&(Im=!0),t.firstContext=null)}function ty(t){var e=t._currentValue;if(dEe!==t)if(t={context:t,memoizedValue:e,next:null},vz===null){if(Ite===null)throw Error(We(308));vz=t,Ite.dependencies={lanes:0,firstContext:t}}else vz=vz.next=t;return e}var kj=null;function mEe(t){kj===null?kj=[t]:kj.push(t)}function $nt(t,e,r,n){var o=e.interleaved;return o===null?(r.next=r,mEe(e)):(r.next=o.next,o.next=r),e.interleaved=r,jE(t,n)}function jE(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 nI=!1;function hEe(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Bnt(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 ME(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function fI(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,(Lo&2)!==0){var o=n.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),n.pending=e,jE(t,r)}return o=n.interleaved,o===null?(e.next=e,mEe(n)):(e.next=o.next,o.next=e),n.interleaved=e,jE(t,r)}function lte(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,eEe(t,r)}}function mrt(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 Mte(t,e,r,n){var o=t.updateQueue;nI=!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 h=t,m=s;switch(f=e,p=r,m.tag){case 1:if(h=m.payload,typeof h=="function"){d=h.call(p,d,f);break e}d=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=m.payload,f=typeof h=="function"?h.call(p,d,f):h,f==null)break e;d=ss({},d,f);break e;case 2:nI=!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);Vj|=a,t.lanes=a,t.memoizedState=d}}function hrt(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(We(191,o));o.call(n)}}}var znt=new $rt.Component().refs;function IOe(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:ss({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var Wte={isMounted:function(t){return(t=t._reactInternals)?Gj(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=Rp(),o=mI(t),i=ME(n,o);i.payload=e,r!=null&&(i.callback=r),e=fI(t,i,o),e!==null&&($b(e,t,o,n),lte(e,t,o))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=Rp(),o=mI(t),i=ME(n,o);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=fI(t,i,o),e!==null&&($b(e,t,o,n),lte(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=Rp(),n=mI(t),o=ME(r,n);o.tag=2,e!=null&&(o.callback=e),e=fI(t,o,n),e!==null&&($b(e,t,n,r),lte(e,t,n))}};function grt(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?!W8(r,n)||!W8(o,i):!0}function Unt(t,e,r){var n=!1,o=yI,i=e.contextType;return typeof i=="object"&&i!==null?i=ty(i):(o=Rm(e)?Uj:Lf.current,n=e.contextTypes,i=(n=n!=null)?Iz(t,o):yI),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Wte,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function yrt(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&&Wte.enqueueReplaceState(e,e.state,null)}function MOe(t,e,r,n){var o=t.stateNode;o.props=r,o.state=t.memoizedState,o.refs=znt,hEe(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=ty(i):(i=Rm(e)?Uj:Lf.current,o.context=Iz(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(IOe(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&&Wte.enqueueReplaceState(o,o.state,null),Mte(t,r,o,n),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function x8(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(We(309));var n=r.stateNode}if(!n)throw Error(We(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===znt&&(s=o.refs={}),a===null?delete s[i]:s[i]=a},e._stringRef=i,e)}if(typeof t!="string")throw Error(We(284));if(!r._owner)throw Error(We(290,t))}return t}function rte(t,e){throw t=Object.prototype.toString.call(e),Error(We(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function brt(t){var e=t._init;return e(t._payload)}function qnt(t){function e(y,_){if(t){var w=y.deletions;w===null?(y.deletions=[_],y.flags|=16):w.push(_)}}function r(y,_){if(!t)return null;for(;_!==null;)e(y,_),_=_.sibling;return null}function n(y,_){for(y=new Map;_!==null;)_.key!==null?y.set(_.key,_):y.set(_.index,_),_=_.sibling;return y}function o(y,_){return y=hI(y,_),y.index=0,y.sibling=null,y}function i(y,_,w){return y.index=w,t?(w=y.alternate,w!==null?(w=w.index,w<_?(y.flags|=2,_):w):(y.flags|=2,_)):(y.flags|=1048576,_)}function a(y){return t&&y.alternate===null&&(y.flags|=2),y}function s(y,_,w,S){return _===null||_.tag!==6?(_=XCe(w,y.mode,S),_.return=y,_):(_=o(_,w),_.return=y,_)}function u(y,_,w,S){var C=w.type;return C===fz?c(y,_,w.props.children,S,w.key):_!==null&&(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===rI&&brt(C)===_.type)?(S=o(_,w.props),S.ref=x8(y,_,w),S.return=y,S):(S=hte(w.type,w.key,w.props,null,y.mode,S),S.ref=x8(y,_,w),S.return=y,S)}function l(y,_,w,S){return _===null||_.tag!==4||_.stateNode.containerInfo!==w.containerInfo||_.stateNode.implementation!==w.implementation?(_=QCe(w,y.mode,S),_.return=y,_):(_=o(_,w.children||[]),_.return=y,_)}function c(y,_,w,S,C){return _===null||_.tag!==7?(_=zj(w,y.mode,S,C),_.return=y,_):(_=o(_,w),_.return=y,_)}function d(y,_,w){if(typeof _=="string"&&_!==""||typeof _=="number")return _=XCe(""+_,y.mode,w),_.return=y,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case zee:return w=hte(_.type,_.key,_.props,null,y.mode,w),w.ref=x8(y,null,_),w.return=y,w;case dz:return _=QCe(_,y.mode,w),_.return=y,_;case rI:var S=_._init;return d(y,S(_._payload),w)}if(P8(_)||b8(_))return _=zj(_,y.mode,w,null),_.return=y,_;rte(y,_)}return null}function f(y,_,w,S){var C=_!==null?_.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:s(y,_,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case zee:return w.key===C?u(y,_,w,S):null;case dz:return w.key===C?l(y,_,w,S):null;case rI:return C=w._init,f(y,_,C(w._payload),S)}if(P8(w)||b8(w))return C!==null?null:c(y,_,w,S,null);rte(y,w)}return null}function p(y,_,w,S,C){if(typeof S=="string"&&S!==""||typeof S=="number")return y=y.get(w)||null,s(_,y,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case zee:return y=y.get(S.key===null?w:S.key)||null,u(_,y,S,C);case dz:return y=y.get(S.key===null?w:S.key)||null,l(_,y,S,C);case rI:var E=S._init;return p(y,_,w,E(S._payload),C)}if(P8(S)||b8(S))return y=y.get(w)||null,c(_,y,S,C,null);rte(_,S)}return null}function h(y,_,w,S){for(var C=null,E=null,P=_,T=_=0,I=null;P!==null&&T<w.length;T++){P.index>T?(I=P,P=null):I=P.sibling;var N=f(y,P,w[T],S);if(N===null){P===null&&(P=I);break}t&&P&&N.alternate===null&&e(y,P),_=i(N,_,T),E===null?C=N:E.sibling=N,E=N,P=I}if(T===w.length)return r(y,P),$a&&Dj(y,T),C;if(P===null){for(;T<w.length;T++)P=d(y,w[T],S),P!==null&&(_=i(P,_,T),E===null?C=P:E.sibling=P,E=P);return $a&&Dj(y,T),C}for(P=n(y,P);T<w.length;T++)I=p(P,y,T,w[T],S),I!==null&&(t&&I.alternate!==null&&P.delete(I.key===null?T:I.key),_=i(I,_,T),E===null?C=I:E.sibling=I,E=I);return t&&P.forEach(function(M){return e(y,M)}),$a&&Dj(y,T),C}function m(y,_,w,S){var C=b8(w);if(typeof C!="function")throw Error(We(150));if(w=C.call(w),w==null)throw Error(We(151));for(var E=C=null,P=_,T=_=0,I=null,N=w.next();P!==null&&!N.done;T++,N=w.next()){P.index>T?(I=P,P=null):I=P.sibling;var M=f(y,P,N.value,S);if(M===null){P===null&&(P=I);break}t&&P&&M.alternate===null&&e(y,P),_=i(M,_,T),E===null?C=M:E.sibling=M,E=M,P=I}if(N.done)return r(y,P),$a&&Dj(y,T),C;if(P===null){for(;!N.done;T++,N=w.next())N=d(y,N.value,S),N!==null&&(_=i(N,_,T),E===null?C=N:E.sibling=N,E=N);return $a&&Dj(y,T),C}for(P=n(y,P);!N.done;T++,N=w.next())N=p(P,y,T,N.value,S),N!==null&&(t&&N.alternate!==null&&P.delete(N.key===null?T:N.key),_=i(N,_,T),E===null?C=N:E.sibling=N,E=N);return t&&P.forEach(function(D){return e(y,D)}),$a&&Dj(y,T),C}function g(y,_,w,S){if(typeof w=="object"&&w!==null&&w.type===fz&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case zee:e:{for(var C=w.key,E=_;E!==null;){if(E.key===C){if(C=w.type,C===fz){if(E.tag===7){r(y,E.sibling),_=o(E,w.props.children),_.return=y,y=_;break e}}else if(E.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===rI&&brt(C)===E.type){r(y,E.sibling),_=o(E,w.props),_.ref=x8(y,E,w),_.return=y,y=_;break e}r(y,E);break}else e(y,E);E=E.sibling}w.type===fz?(_=zj(w.props.children,y.mode,S,w.key),_.return=y,y=_):(S=hte(w.type,w.key,w.props,null,y.mode,S),S.ref=x8(y,_,w),S.return=y,y=S)}return a(y);case dz:e:{for(E=w.key;_!==null;){if(_.key===E)if(_.tag===4&&_.stateNode.containerInfo===w.containerInfo&&_.stateNode.implementation===w.implementation){r(y,_.sibling),_=o(_,w.children||[]),_.return=y,y=_;break e}else{r(y,_);break}else e(y,_);_=_.sibling}_=QCe(w,y.mode,S),_.return=y,y=_}return a(y);case rI:return E=w._init,g(y,_,E(w._payload),S)}if(P8(w))return h(y,_,w,S);if(b8(w))return m(y,_,w,S);rte(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,_!==null&&_.tag===6?(r(y,_.sibling),_=o(_,w),_.return=y,y=_):(r(y,_),_=XCe(w,y.mode,S),_.return=y,y=_),a(y)):r(y,_)}return g}var Rz=qnt(!0),Hnt=qnt(!1),i5={},Fv=_I(i5),Z8=_I(i5),Y8=_I(i5);function $j(t){if(t===i5)throw Error(We(174));return t}function gEe(t,e){switch(la(Y8,e),la(Z8,t),la(Fv,i5),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:lOe(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=lOe(e,t)}xa(Fv),la(Fv,e)}function Nz(){xa(Fv),xa(Z8),xa(Y8)}function Vnt(t){$j(Y8.current);var e=$j(Fv.current),r=lOe(e,t.type);e!==r&&(la(Z8,t),la(Fv,r))}function yEe(t){Z8.current===t&&(xa(Fv),xa(Z8))}var is=_I(0);function Rte(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 WCe=[];function bEe(){for(var t=0;t<WCe.length;t++)WCe[t]._workInProgressVersionPrimary=null;WCe.length=0}var cte=LE.ReactCurrentDispatcher,KCe=LE.ReactCurrentBatchConfig,Hj=0,as=null,ic=null,jc=null,Nte=!1,D8=!1,X8=0,uIr=0;function Nf(){throw Error(We(321))}function _Ee(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!Bb(t[r],e[r]))return!1;return!0}function vEe(t,e,r,n,o,i){if(Hj=i,as=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,cte.current=t===null||t.memoizedState===null?fIr:pIr,t=r(n,o),D8){i=0;do{if(D8=!1,X8=0,25<=i)throw Error(We(301));i+=1,jc=ic=null,e.updateQueue=null,cte.current=mIr,t=r(n,o)}while(D8)}if(cte.current=jte,e=ic!==null&&ic.next!==null,Hj=0,jc=ic=as=null,Nte=!1,e)throw Error(We(300));return t}function wEe(){var t=X8!==0;return X8=0,t}function jv(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jc===null?as.memoizedState=jc=t:jc=jc.next=t,jc}function ry(){if(ic===null){var t=as.alternate;t=t!==null?t.memoizedState:null}else t=ic.next;var e=jc===null?as.memoizedState:jc.next;if(e!==null)jc=e,ic=t;else{if(t===null)throw Error(We(310));ic=t,t={memoizedState:ic.memoizedState,baseState:ic.baseState,baseQueue:ic.baseQueue,queue:ic.queue,next:null},jc===null?as.memoizedState=jc=t:jc=jc.next=t}return jc}function Q8(t,e){return typeof e=="function"?e(t):e}function GCe(t){var e=ry(),r=e.queue;if(r===null)throw Error(We(311));r.lastRenderedReducer=t;var n=ic,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((Hj&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,as.lanes|=c,Vj|=c}l=l.next}while(l!==null&&l!==i);u===null?a=n:u.next=s,Bb(n,e.memoizedState)||(Im=!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,as.lanes|=i,Vj|=i,o=o.next;while(o!==t)}else o===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function JCe(t){var e=ry(),r=e.queue;if(r===null)throw Error(We(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);Bb(i,e.memoizedState)||(Im=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function Wnt(){}function Knt(t,e){var r=as,n=ry(),o=e(),i=!Bb(n.memoizedState,o);if(i&&(n.memoizedState=o,Im=!0),n=n.queue,xEe(Znt.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||jc!==null&&jc.memoizedState.tag&1){if(r.flags|=2048,e5(9,Jnt.bind(null,r,n,o,e),void 0,null),Dc===null)throw Error(We(349));(Hj&30)!==0||Gnt(r,e,o)}return o}function Gnt(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=as.updateQueue,e===null?(e={lastEffect:null,stores:null},as.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function Jnt(t,e,r,n){e.value=r,e.getSnapshot=n,Ynt(e)&&Xnt(t)}function Znt(t,e,r){return r(function(){Ynt(e)&&Xnt(t)})}function Ynt(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!Bb(t,r)}catch{return!0}}function Xnt(t){var e=jE(t,1);e!==null&&$b(e,t,1,-1)}function _rt(t){var e=jv();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Q8,lastRenderedState:t},e.queue=t,t=t.dispatch=dIr.bind(null,as,t),[e.memoizedState,t]}function e5(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=as.updateQueue,e===null?(e={lastEffect:null,stores:null},as.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 Qnt(){return ry().memoizedState}function dte(t,e,r,n){var o=jv();as.flags|=t,o.memoizedState=e5(1|e,r,void 0,n===void 0?null:n)}function Kte(t,e,r,n){var o=ry();n=n===void 0?null:n;var i=void 0;if(ic!==null){var a=ic.memoizedState;if(i=a.destroy,n!==null&&_Ee(n,a.deps)){o.memoizedState=e5(e,r,i,n);return}}as.flags|=t,o.memoizedState=e5(1|e,r,i,n)}function vrt(t,e){return dte(8390656,8,t,e)}function xEe(t,e){return Kte(2048,8,t,e)}function eot(t,e){return Kte(4,2,t,e)}function tot(t,e){return Kte(4,4,t,e)}function rot(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 not(t,e,r){return r=r!=null?r.concat([t]):null,Kte(4,4,rot.bind(null,e,t),r)}function SEe(){}function oot(t,e){var r=ry();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&_Ee(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function iot(t,e){var r=ry();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&_Ee(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function aot(t,e,r){return(Hj&21)===0?(t.baseState&&(t.baseState=!1,Im=!0),t.memoizedState=r):(Bb(r,e)||(r=lnt(),as.lanes|=r,Vj|=r,t.baseState=!0),e)}function lIr(t,e){var r=Di;Di=r!==0&&4>r?r:4,t(!0);var n=KCe.transition;KCe.transition={};try{t(!1),e()}finally{Di=r,KCe.transition=n}}function sot(){return ry().memoizedState}function cIr(t,e,r){var n=mI(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},uot(t))lot(e,r);else if(r=$nt(t,e,r,n),r!==null){var o=Rp();$b(r,t,n,o),cot(r,e,n)}}function dIr(t,e,r){var n=mI(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(uot(t))lot(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,Bb(s,a)){var u=e.interleaved;u===null?(o.next=o,mEe(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=$nt(t,e,o,n),r!==null&&(o=Rp(),$b(r,t,n,o),cot(r,e,n))}}function uot(t){var e=t.alternate;return t===as||e!==null&&e===as}function lot(t,e){D8=Nte=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function cot(t,e,r){if((r&4194240)!==0){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,eEe(t,r)}}var jte={readContext:ty,useCallback:Nf,useContext:Nf,useEffect:Nf,useImperativeHandle:Nf,useInsertionEffect:Nf,useLayoutEffect:Nf,useMemo:Nf,useReducer:Nf,useRef:Nf,useState:Nf,useDebugValue:Nf,useDeferredValue:Nf,useTransition:Nf,useMutableSource:Nf,useSyncExternalStore:Nf,useId:Nf,unstable_isNewReconciler:!1},fIr={readContext:ty,useCallback:function(t,e){return jv().memoizedState=[t,e===void 0?null:e],t},useContext:ty,useEffect:vrt,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,dte(4194308,4,rot.bind(null,e,t),r)},useLayoutEffect:function(t,e){return dte(4194308,4,t,e)},useInsertionEffect:function(t,e){return dte(4,2,t,e)},useMemo:function(t,e){var r=jv();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=jv();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=cIr.bind(null,as,t),[n.memoizedState,t]},useRef:function(t){var e=jv();return t={current:t},e.memoizedState=t},useState:_rt,useDebugValue:SEe,useDeferredValue:function(t){return jv().memoizedState=t},useTransition:function(){var t=_rt(!1),e=t[0];return t=lIr.bind(null,t[1]),jv().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=as,o=jv();if($a){if(r===void 0)throw Error(We(407));r=r()}else{if(r=e(),Dc===null)throw Error(We(349));(Hj&30)!==0||Gnt(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,vrt(Znt.bind(null,n,i,t),[t]),n.flags|=2048,e5(9,Jnt.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=jv(),e=Dc.identifierPrefix;if($a){var r=IE,n=AE;r=(n&~(1<<32-kb(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=X8++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=uIr++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},pIr={readContext:ty,useCallback:oot,useContext:ty,useEffect:xEe,useImperativeHandle:not,useInsertionEffect:eot,useLayoutEffect:tot,useMemo:iot,useReducer:GCe,useRef:Qnt,useState:function(){return GCe(Q8)},useDebugValue:SEe,useDeferredValue:function(t){var e=ry();return aot(e,ic.memoizedState,t)},useTransition:function(){var t=GCe(Q8)[0],e=ry().memoizedState;return[t,e]},useMutableSource:Wnt,useSyncExternalStore:Knt,useId:sot,unstable_isNewReconciler:!1},mIr={readContext:ty,useCallback:oot,useContext:ty,useEffect:xEe,useImperativeHandle:not,useInsertionEffect:eot,useLayoutEffect:tot,useMemo:iot,useReducer:JCe,useRef:Qnt,useState:function(){return JCe(Q8)},useDebugValue:SEe,useDeferredValue:function(t){var e=ry();return ic===null?e.memoizedState=t:aot(e,ic.memoizedState,t)},useTransition:function(){var t=JCe(Q8)[0],e=ry().memoizedState;return[t,e]},useMutableSource:Wnt,useSyncExternalStore:Knt,useId:sot,unstable_isNewReconciler:!1};function jz(t,e){try{var r="",n=e;do r+=HTr(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 ZCe(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function ROe(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var hIr=typeof WeakMap=="function"?WeakMap:Map;function dot(t,e,r){r=ME(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){Lte||(Lte=!0,UOe=n),ROe(t,e)},r}function fot(t,e,r){r=ME(-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(){ROe(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){ROe(t,e),typeof n!="function"&&(pI===null?pI=new Set([this]):pI.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function wrt(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new hIr;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=AIr.bind(null,t,e,r),e.then(t,t))}function xrt(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 Srt(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=ME(-1,1),e.tag=2,fI(r,e,1))),r.lanes|=1),t):(t.flags|=65536,t.lanes=o,t)}var gIr=LE.ReactCurrentOwner,Im=!1;function Mp(t,e,r,n){e.child=t===null?Hnt(e,null,r,n):Rz(e,t.child,r,n)}function Crt(t,e,r,n,o){r=r.render;var i=e.ref;return Pz(e,o),n=vEe(t,e,r,n,i,o),r=wEe(),t!==null&&!Im?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,DE(t,e,o)):($a&&r&&uEe(e),e.flags|=1,Mp(t,e,n,o),e.child)}function Ort(t,e,r,n,o){if(t===null){var i=r.type;return typeof i=="function"&&!MEe(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,pot(t,e,i,n,o)):(t=hte(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:W8,r(a,n)&&t.ref===e.ref)return DE(t,e,o)}return e.flags|=1,t=hI(i,n),t.ref=e.ref,t.return=e,e.child=t}function pot(t,e,r,n,o){if(t!==null){var i=t.memoizedProps;if(W8(i,n)&&t.ref===e.ref)if(Im=!1,e.pendingProps=n=i,(t.lanes&o)!==0)(t.flags&131072)!==0&&(Im=!0);else return e.lanes=t.lanes,DE(t,e,o)}return NOe(t,e,r,n,o)}function mot(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},la(xz,Rh),Rh|=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,la(xz,Rh),Rh|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,la(xz,Rh),Rh|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,la(xz,Rh),Rh|=n;return Mp(t,e,o,r),e.child}function hot(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function NOe(t,e,r,n,o){var i=Rm(r)?Uj:Lf.current;return i=Iz(e,i),Pz(e,o),r=vEe(t,e,r,n,i,o),n=wEe(),t!==null&&!Im?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,DE(t,e,o)):($a&&n&&uEe(e),e.flags|=1,Mp(t,e,r,o),e.child)}function Ert(t,e,r,n,o){if(Rm(r)){var i=!0;Ete(e)}else i=!1;if(Pz(e,o),e.stateNode===null)fte(t,e),Unt(e,r,n),MOe(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=ty(l):(l=Rm(r)?Uj:Lf.current,l=Iz(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)&&yrt(e,a,n,l),nI=!1;var f=e.memoizedState;a.state=f,Mte(e,n,a,o),u=e.memoizedState,s!==n||f!==u||Mm.current||nI?(typeof c=="function"&&(IOe(e,r,c,n),u=e.memoizedState),(s=nI||grt(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,Bnt(t,e),s=e.memoizedProps,l=e.type===e.elementType?s:Db(e.type,s),a.props=l,d=e.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=ty(u):(u=Rm(r)?Uj:Lf.current,u=Iz(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)&&yrt(e,a,n,u),nI=!1,f=e.memoizedState,a.state=f,Mte(e,n,a,o);var h=e.memoizedState;s!==d||f!==h||Mm.current||nI?(typeof p=="function"&&(IOe(e,r,p,n),h=e.memoizedState),(l=nI||grt(e,r,l,n,f,h,u)||!1)?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,h,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,h,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=h),a.props=n,a.state=h,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 jOe(t,e,r,n,i,o)}function jOe(t,e,r,n,o,i){hot(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return o&&drt(e,r,!1),DE(t,e,i);n=e.stateNode,gIr.current=e;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=Rz(e,t.child,null,i),e.child=Rz(e,null,s,i)):Mp(t,e,s,i),e.memoizedState=n.state,o&&drt(e,r,!0),e.child}function got(t){var e=t.stateNode;e.pendingContext?crt(t,e.pendingContext,e.pendingContext!==e.context):e.context&&crt(t,e.context,!1),gEe(t,e.containerInfo)}function Prt(t,e,r,n,o){return Mz(),cEe(o),e.flags|=256,Mp(t,e,r,n),e.child}var DOe={dehydrated:null,treeContext:null,retryLane:0};function LOe(t){return{baseLanes:t,cachePool:null,transitions:null}}function yot(t,e,r){var n=e.pendingProps,o=is.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),la(is,o&1),t===null)return TOe(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=Zte(a,n,0,null),t=zj(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=LOe(r),e.memoizedState=DOe,t):CEe(e,a));if(o=t.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return yIr(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=hI(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=hI(s,i):(i=zj(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?LOe(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~r,e.memoizedState=DOe,n}return i=t.child,t=i.sibling,n=hI(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 CEe(t,e){return e=Zte({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function nte(t,e,r,n){return n!==null&&cEe(n),Rz(e,t.child,null,r),t=CEe(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function yIr(t,e,r,n,o,i,a){if(r)return e.flags&256?(e.flags&=-257,n=ZCe(Error(We(422))),nte(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,o=e.mode,n=Zte({mode:"visible",children:n.children},o,0,null),i=zj(i,o,a,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,(e.mode&1)!==0&&Rz(e,t.child,null,a),e.child.memoizedState=LOe(a),e.memoizedState=DOe,i);if((e.mode&1)===0)return nte(t,e,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(We(419)),n=ZCe(i,n,void 0),nte(t,e,a,n)}if(s=(a&t.childLanes)!==0,Im||s){if(n=Dc,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,jE(t,o),$b(n,t,o,-1))}return IEe(),n=ZCe(Error(We(421))),nte(t,e,a,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=IIr.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,Nh=dI(o.nextSibling),jh=e,$a=!0,Fb=null,t!==null&&(Yg[Xg++]=AE,Yg[Xg++]=IE,Yg[Xg++]=qj,AE=t.id,IE=t.overflow,qj=e),e=CEe(e,n.children),e.flags|=4096,e)}function Trt(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),AOe(t.return,e,r)}function YCe(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 bot(t,e,r){var n=e.pendingProps,o=n.revealOrder,i=n.tail;if(Mp(t,e,n.children,r),n=is.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&&Trt(t,r,e);else if(t.tag===19)Trt(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(la(is,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&&Rte(t)===null&&(o=r),r=r.sibling;r=o,r===null?(o=e.child,e.child=null):(o=r.sibling,r.sibling=null),YCe(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&&Rte(t)===null){e.child=o;break}t=o.sibling,o.sibling=r,r=o,o=t}YCe(e,!0,r,null,i);break;case"together":YCe(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function fte(t,e){(e.mode&1)===0&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function DE(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),Vj|=e.lanes,(r&e.childLanes)===0)return null;if(t!==null&&e.child!==t.child)throw Error(We(153));if(e.child!==null){for(t=e.child,r=hI(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=hI(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function bIr(t,e,r){switch(e.tag){case 3:got(e),Mz();break;case 5:Vnt(e);break;case 1:Rm(e.type)&&Ete(e);break;case 4:gEe(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;la(Ate,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(la(is,is.current&1),e.flags|=128,null):(r&e.child.childLanes)!==0?yot(t,e,r):(la(is,is.current&1),t=DE(t,e,r),t!==null?t.sibling:null);la(is,is.current&1);break;case 19:if(n=(r&e.childLanes)!==0,(t.flags&128)!==0){if(n)return bot(t,e,r);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),la(is,is.current),n)break;return null;case 22:case 23:return e.lanes=0,mot(t,e,r)}return DE(t,e,r)}var _ot,FOe,vot,wot;_ot=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}};FOe=function(){};vot=function(t,e,r,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,$j(Fv.current);var i=null;switch(r){case"input":o=iOe(t,o),n=iOe(t,n),i=[];break;case"select":o=ss({},o,{value:void 0}),n=ss({},n,{value:void 0}),i=[];break;case"textarea":o=uOe(t,o),n=uOe(t,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=Cte)}cOe(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"&&($8.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"&&($8.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&wa("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)}};wot=function(t,e,r,n){r!==n&&(e.flags|=4)};function S8(t,e){if(!$a)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 jf(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 _Ir(t,e,r){var n=e.pendingProps;switch(lEe(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jf(e),null;case 1:return Rm(e.type)&&Ote(),jf(e),null;case 3:return n=e.stateNode,Nz(),xa(Mm),xa(Lf),bEe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(tte(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,Fb!==null&&(VOe(Fb),Fb=null))),FOe(t,e),jf(e),null;case 5:yEe(e);var o=$j(Y8.current);if(r=e.type,t!==null&&e.stateNode!=null)vot(t,e,r,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(We(166));return jf(e),null}if(t=$j(Fv.current),tte(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[Dv]=e,n[J8]=i,t=(e.mode&1)!==0,r){case"dialog":wa("cancel",n),wa("close",n);break;case"iframe":case"object":case"embed":wa("load",n);break;case"video":case"audio":for(o=0;o<A8.length;o++)wa(A8[o],n);break;case"source":wa("error",n);break;case"img":case"image":case"link":wa("error",n),wa("load",n);break;case"details":wa("toggle",n);break;case"input":Ltt(n,i),wa("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},wa("invalid",n);break;case"textarea":ktt(n,i),wa("invalid",n)}cOe(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&&ete(n.textContent,s,t),o=["children",s]):typeof s=="number"&&n.textContent!==""+s&&(i.suppressHydrationWarning!==!0&&ete(n.textContent,s,t),o=["children",""+s]):$8.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&wa("scroll",n)}switch(r){case"input":Uee(n),Ftt(n,i,!0);break;case"textarea":Uee(n),$tt(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=Cte)}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=Grt(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[Dv]=e,t[J8]=n,_ot(t,e,!1,!1),e.stateNode=t;e:{switch(a=dOe(r,n),r){case"dialog":wa("cancel",t),wa("close",t),o=n;break;case"iframe":case"object":case"embed":wa("load",t),o=n;break;case"video":case"audio":for(o=0;o<A8.length;o++)wa(A8[o],t);o=n;break;case"source":wa("error",t),o=n;break;case"img":case"image":case"link":wa("error",t),wa("load",t),o=n;break;case"details":wa("toggle",t),o=n;break;case"input":Ltt(t,n),o=iOe(t,n),wa("invalid",t);break;case"option":o=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=ss({},n,{value:void 0}),wa("invalid",t);break;case"textarea":ktt(t,n),o=uOe(t,n),wa("invalid",t);break;default:o=n}cOe(r,o),s=o;for(i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="style"?Yrt(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Jrt(t,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&B8(t,u):typeof u=="number"&&B8(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&($8.hasOwnProperty(i)?u!=null&&i==="onScroll"&&wa("scroll",t):u!=null&&GOe(t,i,u,a))}switch(r){case"input":Uee(t),Ftt(t,n,!1);break;case"textarea":Uee(t),$tt(t);break;case"option":n.value!=null&&t.setAttribute("value",""+gI(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?Sz(t,!!n.multiple,i,!1):n.defaultValue!=null&&Sz(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=Cte)}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 jf(e),null;case 6:if(t&&e.stateNode!=null)wot(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(We(166));if(r=$j(Y8.current),$j(Fv.current),tte(e)){if(n=e.stateNode,r=e.memoizedProps,n[Dv]=e,(i=n.nodeValue!==r)&&(t=jh,t!==null))switch(t.tag){case 3:ete(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&ete(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Dv]=e,e.stateNode=n}return jf(e),null;case 13:if(xa(is),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if($a&&Nh!==null&&(e.mode&1)!==0&&(e.flags&128)===0)knt(),Mz(),e.flags|=98560,i=!1;else if(i=tte(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(We(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(We(317));i[Dv]=e}else Mz(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;jf(e),i=!1}else Fb!==null&&(VOe(Fb),Fb=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||(is.current&1)!==0?ac===0&&(ac=3):IEe())),e.updateQueue!==null&&(e.flags|=4),jf(e),null);case 4:return Nz(),FOe(t,e),t===null&&K8(e.stateNode.containerInfo),jf(e),null;case 10:return pEe(e.type._context),jf(e),null;case 17:return Rm(e.type)&&Ote(),jf(e),null;case 19:if(xa(is),i=e.memoizedState,i===null)return jf(e),null;if(n=(e.flags&128)!==0,a=i.rendering,a===null)if(n)S8(i,!1);else{if(ac!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(a=Rte(t),a!==null){for(e.flags|=128,S8(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 la(is,is.current&1|2),e.child}t=t.sibling}i.tail!==null&&eu()>Dz&&(e.flags|=128,n=!0,S8(i,!1),e.lanes=4194304)}else{if(!n)if(t=Rte(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),S8(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!$a)return jf(e),null}else 2*eu()-i.renderingStartTime>Dz&&r!==1073741824&&(e.flags|=128,n=!0,S8(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=eu(),e.sibling=null,r=is.current,la(is,n?r&1|2:r&1),e):(jf(e),null);case 22:case 23:return AEe(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&(e.mode&1)!==0?(Rh&1073741824)!==0&&(jf(e),e.subtreeFlags&6&&(e.flags|=8192)):jf(e),null;case 24:return null;case 25:return null}throw Error(We(156,e.tag))}function vIr(t,e){switch(lEe(e),e.tag){case 1:return Rm(e.type)&&Ote(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Nz(),xa(Mm),xa(Lf),bEe(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return yEe(e),null;case 13:if(xa(is),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(We(340));Mz()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return xa(is),null;case 4:return Nz(),null;case 10:return pEe(e.type._context),null;case 22:case 23:return AEe(),null;case 24:return null;default:return null}}var ote=!1,Df=!1,wIr=typeof WeakSet=="function"?WeakSet:Set,It=null;function wz(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Rs(t,e,n)}else r.current=null}function kOe(t,e,r){try{r()}catch(n){Rs(t,e,n)}}var Art=!1;function xIr(t,e){if(wOe=wte,t=Ont(),sEe(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(xOe={focusedElem:t,selectionRange:r},wte=!1,It=e;It!==null;)if(e=It,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,It=t;else for(;It!==null;){e=It;try{var h=e.alternate;if((e.flags&1024)!==0)switch(e.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var m=h.memoizedProps,g=h.memoizedState,y=e.stateNode,_=y.getSnapshotBeforeUpdate(e.elementType===e.type?m:Db(e.type,m),g);y.__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(We(163))}}catch(S){Rs(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,It=t;break}It=e.return}return h=Art,Art=!1,h}function L8(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&&kOe(e,r,i)}o=o.next}while(o!==n)}}function Gte(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 $Oe(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 xot(t){var e=t.alternate;e!==null&&(t.alternate=null,xot(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Dv],delete e[J8],delete e[OOe],delete e[oIr],delete e[iIr])),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 Sot(t){return t.tag===5||t.tag===3||t.tag===4}function Irt(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Sot(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 BOe(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=Cte));else if(n!==4&&(t=t.child,t!==null))for(BOe(t,e,r),t=t.sibling;t!==null;)BOe(t,e,r),t=t.sibling}function zOe(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(zOe(t,e,r),t=t.sibling;t!==null;)zOe(t,e,r),t=t.sibling}var Od=null,Lb=!1;function tI(t,e,r){for(r=r.child;r!==null;)Cot(t,e,r),r=r.sibling}function Cot(t,e,r){if(Lv&&typeof Lv.onCommitFiberUnmount=="function")try{Lv.onCommitFiberUnmount(Bte,r)}catch{}switch(r.tag){case 5:Df||wz(r,e);case 6:var n=Od,o=Lb;Od=null,tI(t,e,r),Od=n,Lb=o,Od!==null&&(Lb?(t=Od,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Od.removeChild(r.stateNode));break;case 18:Od!==null&&(Lb?(t=Od,r=r.stateNode,t.nodeType===8?HCe(t.parentNode,r):t.nodeType===1&&HCe(t,r),H8(t)):HCe(Od,r.stateNode));break;case 4:n=Od,o=Lb,Od=r.stateNode.containerInfo,Lb=!0,tI(t,e,r),Od=n,Lb=o;break;case 0:case 11:case 14:case 15:if(!Df&&(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)&&kOe(r,e,a),o=o.next}while(o!==n)}tI(t,e,r);break;case 1:if(!Df&&(wz(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Rs(r,e,s)}tI(t,e,r);break;case 21:tI(t,e,r);break;case 22:r.mode&1?(Df=(n=Df)||r.memoizedState!==null,tI(t,e,r),Df=n):tI(t,e,r);break;default:tI(t,e,r)}}function Mrt(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new wIr),e.forEach(function(n){var o=MIr.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function jb(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:Od=s.stateNode,Lb=!1;break e;case 3:Od=s.stateNode.containerInfo,Lb=!0;break e;case 4:Od=s.stateNode.containerInfo,Lb=!0;break e}s=s.return}if(Od===null)throw Error(We(160));Cot(i,a,o),Od=null,Lb=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){Rs(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Oot(e,t),e=e.sibling}function Oot(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(jb(e,t),Nv(t),n&4){try{L8(3,t,t.return),Gte(3,t)}catch(m){Rs(t,t.return,m)}try{L8(5,t,t.return)}catch(m){Rs(t,t.return,m)}}break;case 1:jb(e,t),Nv(t),n&512&&r!==null&&wz(r,r.return);break;case 5:if(jb(e,t),Nv(t),n&512&&r!==null&&wz(r,r.return),t.flags&32){var o=t.stateNode;try{B8(o,"")}catch(m){Rs(t,t.return,m)}}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&&Wrt(o,i),dOe(s,a);var l=dOe(s,i);for(a=0;a<u.length;a+=2){var c=u[a],d=u[a+1];c==="style"?Yrt(o,d):c==="dangerouslySetInnerHTML"?Jrt(o,d):c==="children"?B8(o,d):GOe(o,c,d,l)}switch(s){case"input":aOe(o,i);break;case"textarea":Krt(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Sz(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?Sz(o,!!i.multiple,i.defaultValue,!0):Sz(o,!!i.multiple,i.multiple?[]:"",!1))}o[J8]=i}catch(m){Rs(t,t.return,m)}}break;case 6:if(jb(e,t),Nv(t),n&4){if(t.stateNode===null)throw Error(We(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(m){Rs(t,t.return,m)}}break;case 3:if(jb(e,t),Nv(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{H8(e.containerInfo)}catch(m){Rs(t,t.return,m)}break;case 4:jb(e,t),Nv(t);break;case 13:jb(e,t),Nv(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(PEe=eu())),n&4&&Mrt(t);break;case 22:if(c=r!==null&&r.memoizedState!==null,t.mode&1?(Df=(l=Df)||c,jb(e,t),Df=l):jb(e,t),Nv(t),n&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&(t.mode&1)!==0)for(It=t,c=t.child;c!==null;){for(d=It=c;It!==null;){switch(f=It,p=f.child,f.tag){case 0:case 11:case 14:case 15:L8(4,f,f.return);break;case 1:wz(f,f.return);var h=f.stateNode;if(typeof h.componentWillUnmount=="function"){n=f,r=f.return;try{e=n,h.props=e.memoizedProps,h.state=e.memoizedState,h.componentWillUnmount()}catch(m){Rs(n,r,m)}}break;case 5:wz(f,f.return);break;case 22:if(f.memoizedState!==null){Nrt(d);continue}}p!==null?(p.return=f,It=p):Nrt(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=Zrt("display",a))}catch(m){Rs(t,t.return,m)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(m){Rs(t,t.return,m)}}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:jb(e,t),Nv(t),n&4&&Mrt(t);break;case 21:break;default:jb(e,t),Nv(t)}}function Nv(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(Sot(r)){var n=r;break e}r=r.return}throw Error(We(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(B8(o,""),n.flags&=-33);var i=Irt(t);zOe(t,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,s=Irt(t);BOe(t,s,a);break;default:throw Error(We(161))}}catch(u){Rs(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function SIr(t,e,r){It=t,Eot(t,e,r)}function Eot(t,e,r){for(var n=(t.mode&1)!==0;It!==null;){var o=It,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||ote;if(!a){var s=o.alternate,u=s!==null&&s.memoizedState!==null||Df;s=ote;var l=Df;if(ote=a,(Df=u)&&!l)for(It=o;It!==null;)a=It,u=a.child,a.tag===22&&a.memoizedState!==null?jrt(o):u!==null?(u.return=a,It=u):jrt(o);for(;i!==null;)It=i,Eot(i,e,r),i=i.sibling;It=o,ote=s,Df=l}Rrt(t,e,r)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,It=i):Rrt(t,e,r)}}function Rrt(t){for(;It!==null;){var e=It;if((e.flags&8772)!==0){var r=e.alternate;try{if((e.flags&8772)!==0)switch(e.tag){case 0:case 11:case 15:Df||Gte(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!Df)if(r===null)n.componentDidMount();else{var o=e.elementType===e.type?r.memoizedProps:Db(e.type,r.memoizedProps);n.componentDidUpdate(o,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&hrt(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}hrt(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&&H8(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(We(163))}Df||e.flags&512&&$Oe(e)}catch(f){Rs(e,e.return,f)}}if(e===t){It=null;break}if(r=e.sibling,r!==null){r.return=e.return,It=r;break}It=e.return}}function Nrt(t){for(;It!==null;){var e=It;if(e===t){It=null;break}var r=e.sibling;if(r!==null){r.return=e.return,It=r;break}It=e.return}}function jrt(t){for(;It!==null;){var e=It;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{Gte(4,e)}catch(u){Rs(e,r,u)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var o=e.return;try{n.componentDidMount()}catch(u){Rs(e,o,u)}}var i=e.return;try{$Oe(e)}catch(u){Rs(e,i,u)}break;case 5:var a=e.return;try{$Oe(e)}catch(u){Rs(e,a,u)}}}catch(u){Rs(e,e.return,u)}if(e===t){It=null;break}var s=e.sibling;if(s!==null){s.return=e.return,It=s;break}It=e.return}}var CIr=Math.ceil,Dte=LE.ReactCurrentDispatcher,OEe=LE.ReactCurrentOwner,ey=LE.ReactCurrentBatchConfig,Lo=0,Dc=null,_u=null,Ed=0,Rh=0,xz=_I(0),ac=0,t5=null,Vj=0,Jte=0,EEe=0,F8=null,Am=null,PEe=0,Dz=1/0,PE=null,Lte=!1,UOe=null,pI=null,ite=!1,sI=null,Fte=0,k8=0,qOe=null,pte=-1,mte=0;function Rp(){return(Lo&6)!==0?eu():pte!==-1?pte:pte=eu()}function mI(t){return(t.mode&1)===0?1:(Lo&2)!==0&&Ed!==0?Ed&-Ed:sIr.transition!==null?(mte===0&&(mte=lnt()),mte):(t=Di,t!==0||(t=window.event,t=t===void 0?16:gnt(t.type)),t)}function $b(t,e,r,n){if(50<k8)throw k8=0,qOe=null,Error(We(185));r5(t,r,n),((Lo&2)===0||t!==Dc)&&(t===Dc&&((Lo&2)===0&&(Jte|=r),ac===4&&iI(t,Ed)),Nm(t,n),r===1&&Lo===0&&(e.mode&1)===0&&(Dz=eu()+500,Vte&&vI()))}function Nm(t,e){var r=t.callbackNode;lAr(t,e);var n=vte(t,t===Dc?Ed:0);if(n===0)r!==null&&Utt(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&Utt(r),e===1)t.tag===0?aIr(Drt.bind(null,t)):Dnt(Drt.bind(null,t)),rIr(function(){(Lo&6)===0&&vI()}),r=null;else{switch(cnt(n)){case 1:r=QOe;break;case 4:r=snt;break;case 16:r=_te;break;case 536870912:r=unt;break;default:r=_te}r=jot(r,Pot.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function Pot(t,e){if(pte=-1,mte=0,(Lo&6)!==0)throw Error(We(327));var r=t.callbackNode;if(Tz()&&t.callbackNode!==r)return null;var n=vte(t,t===Dc?Ed:0);if(n===0)return null;if((n&30)!==0||(n&t.expiredLanes)!==0||e)e=kte(t,n);else{e=n;var o=Lo;Lo|=2;var i=Aot();(Dc!==t||Ed!==e)&&(PE=null,Dz=eu()+500,Bj(t,e));do try{PIr();break}catch(s){Tot(t,s)}while(!0);fEe(),Dte.current=i,Lo=o,_u!==null?e=0:(Dc=null,Ed=0,e=ac)}if(e!==0){if(e===2&&(o=gOe(t),o!==0&&(n=o,e=HOe(t,o))),e===1)throw r=t5,Bj(t,0),iI(t,n),Nm(t,eu()),r;if(e===6)iI(t,n);else{if(o=t.current.alternate,(n&30)===0&&!OIr(o)&&(e=kte(t,n),e===2&&(i=gOe(t),i!==0&&(n=i,e=HOe(t,i))),e===1))throw r=t5,Bj(t,0),iI(t,n),Nm(t,eu()),r;switch(t.finishedWork=o,t.finishedLanes=n,e){case 0:case 1:throw Error(We(345));case 2:Lj(t,Am,PE);break;case 3:if(iI(t,n),(n&130023424)===n&&(e=PEe+500-eu(),10<e)){if(vte(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){Rp(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=COe(Lj.bind(null,t,Am,PE),e);break}Lj(t,Am,PE);break;case 4:if(iI(t,n),(n&4194240)===n)break;for(e=t.eventTimes,o=-1;0<n;){var a=31-kb(n);i=1<<a,a=e[a],a>o&&(o=a),n&=~i}if(n=o,n=eu()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*CIr(n/1960))-n,10<n){t.timeoutHandle=COe(Lj.bind(null,t,Am,PE),n);break}Lj(t,Am,PE);break;case 5:Lj(t,Am,PE);break;default:throw Error(We(329))}}}return Nm(t,eu()),t.callbackNode===r?Pot.bind(null,t):null}function HOe(t,e){var r=F8;return t.current.memoizedState.isDehydrated&&(Bj(t,e).flags|=256),t=kte(t,e),t!==2&&(e=Am,Am=r,e!==null&&VOe(e)),t}function VOe(t){Am===null?Am=t:Am.push.apply(Am,t)}function OIr(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(!Bb(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 iI(t,e){for(e&=~EEe,e&=~Jte,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-kb(e),n=1<<r;t[r]=-1,e&=~n}}function Drt(t){if((Lo&6)!==0)throw Error(We(327));Tz();var e=vte(t,0);if((e&1)===0)return Nm(t,eu()),null;var r=kte(t,e);if(t.tag!==0&&r===2){var n=gOe(t);n!==0&&(e=n,r=HOe(t,n))}if(r===1)throw r=t5,Bj(t,0),iI(t,e),Nm(t,eu()),r;if(r===6)throw Error(We(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Lj(t,Am,PE),Nm(t,eu()),null}function TEe(t,e){var r=Lo;Lo|=1;try{return t(e)}finally{Lo=r,Lo===0&&(Dz=eu()+500,Vte&&vI())}}function Wj(t){sI!==null&&sI.tag===0&&(Lo&6)===0&&Tz();var e=Lo;Lo|=1;var r=ey.transition,n=Di;try{if(ey.transition=null,Di=1,t)return t()}finally{Di=n,ey.transition=r,Lo=e,(Lo&6)===0&&vI()}}function AEe(){Rh=xz.current,xa(xz)}function Bj(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,tIr(r)),_u!==null)for(r=_u.return;r!==null;){var n=r;switch(lEe(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Ote();break;case 3:Nz(),xa(Mm),xa(Lf),bEe();break;case 5:yEe(n);break;case 4:Nz();break;case 13:xa(is);break;case 19:xa(is);break;case 10:pEe(n.type._context);break;case 22:case 23:AEe()}r=r.return}if(Dc=t,_u=t=hI(t.current,null),Ed=Rh=e,ac=0,t5=null,EEe=Jte=Vj=0,Am=F8=null,kj!==null){for(e=0;e<kj.length;e++)if(r=kj[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}kj=null}return t}function Tot(t,e){do{var r=_u;try{if(fEe(),cte.current=jte,Nte){for(var n=as.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}Nte=!1}if(Hj=0,jc=ic=as=null,D8=!1,X8=0,OEe.current=null,r===null||r.return===null){ac=1,t5=e,_u=null;break}e:{var i=t,a=r.return,s=r,u=e;if(e=Ed,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=xrt(a);if(p!==null){p.flags&=-257,Srt(p,a,s,i,e),p.mode&1&&wrt(i,l,e),e=p,u=l;var h=e.updateQueue;if(h===null){var m=new Set;m.add(u),e.updateQueue=m}else h.add(u);break e}else{if((e&1)===0){wrt(i,l,e),IEe();break e}u=Error(We(426))}}else if($a&&s.mode&1){var g=xrt(a);if(g!==null){(g.flags&65536)===0&&(g.flags|=256),Srt(g,a,s,i,e),cEe(jz(u,s));break e}}i=u=jz(u,s),ac!==4&&(ac=2),F8===null?F8=[i]:F8.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var y=dot(i,u,e);mrt(i,y);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"&&(pI===null||!pI.has(w)))){i.flags|=65536,e&=-e,i.lanes|=e;var S=fot(i,s,e);mrt(i,S);break e}}i=i.return}while(i!==null)}Mot(r)}catch(C){e=C,_u===r&&r!==null&&(_u=r=r.return);continue}break}while(!0)}function Aot(){var t=Dte.current;return Dte.current=jte,t===null?jte:t}function IEe(){(ac===0||ac===3||ac===2)&&(ac=4),Dc===null||(Vj&268435455)===0&&(Jte&268435455)===0||iI(Dc,Ed)}function kte(t,e){var r=Lo;Lo|=2;var n=Aot();(Dc!==t||Ed!==e)&&(PE=null,Bj(t,e));do try{EIr();break}catch(o){Tot(t,o)}while(!0);if(fEe(),Lo=r,Dte.current=n,_u!==null)throw Error(We(261));return Dc=null,Ed=0,ac}function EIr(){for(;_u!==null;)Iot(_u)}function PIr(){for(;_u!==null&&!eAr();)Iot(_u)}function Iot(t){var e=Not(t.alternate,t,Rh);t.memoizedProps=t.pendingProps,e===null?Mot(t):_u=e,OEe.current=null}function Mot(t){var e=t;do{var r=e.alternate;if(t=e.return,(e.flags&32768)===0){if(r=_Ir(r,e,Rh),r!==null){_u=r;return}}else{if(r=vIr(r,e),r!==null){r.flags&=32767,_u=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{ac=6,_u=null;return}}if(e=e.sibling,e!==null){_u=e;return}_u=e=t}while(e!==null);ac===0&&(ac=5)}function Lj(t,e,r){var n=Di,o=ey.transition;try{ey.transition=null,Di=1,TIr(t,e,r,n)}finally{ey.transition=o,Di=n}return null}function TIr(t,e,r,n){do Tz();while(sI!==null);if((Lo&6)!==0)throw Error(We(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(We(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(cAr(t,i),t===Dc&&(_u=Dc=null,Ed=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||ite||(ite=!0,jot(_te,function(){return Tz(),null})),i=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||i){i=ey.transition,ey.transition=null;var a=Di;Di=1;var s=Lo;Lo|=4,OEe.current=null,xIr(t,r),Oot(r,t),ZAr(xOe),wte=!!wOe,xOe=wOe=null,t.current=r,SIr(r,t,o),tAr(),Lo=s,Di=a,ey.transition=i}else t.current=r;if(ite&&(ite=!1,sI=t,Fte=o),i=t.pendingLanes,i===0&&(pI=null),oAr(r.stateNode,n),Nm(t,eu()),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(Lte)throw Lte=!1,t=UOe,UOe=null,t;return(Fte&1)!==0&&t.tag!==0&&Tz(),i=t.pendingLanes,(i&1)!==0?t===qOe?k8++:(k8=0,qOe=t):k8=0,vI(),null}function Tz(){if(sI!==null){var t=cnt(Fte),e=ey.transition,r=Di;try{if(ey.transition=null,Di=16>t?16:t,sI===null)var n=!1;else{if(t=sI,sI=null,Fte=0,(Lo&6)!==0)throw Error(We(331));var o=Lo;for(Lo|=4,It=t.current;It!==null;){var i=It,a=i.child;if((It.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;u<s.length;u++){var l=s[u];for(It=l;It!==null;){var c=It;switch(c.tag){case 0:case 11:case 15:L8(8,c,i)}var d=c.child;if(d!==null)d.return=c,It=d;else for(;It!==null;){c=It;var f=c.sibling,p=c.return;if(xot(c),c===l){It=null;break}if(f!==null){f.return=p,It=f;break}It=p}}}var h=i.alternate;if(h!==null){var m=h.child;if(m!==null){h.child=null;do{var g=m.sibling;m.sibling=null,m=g}while(m!==null)}}It=i}}if((i.subtreeFlags&2064)!==0&&a!==null)a.return=i,It=a;else e:for(;It!==null;){if(i=It,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:L8(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,It=y;break e}It=i.return}}var _=t.current;for(It=_;It!==null;){a=It;var w=a.child;if((a.subtreeFlags&2064)!==0&&w!==null)w.return=a,It=w;else e:for(a=_;It!==null;){if(s=It,(s.flags&2048)!==0)try{switch(s.tag){case 0:case 11:case 15:Gte(9,s)}}catch(C){Rs(s,s.return,C)}if(s===a){It=null;break e}var S=s.sibling;if(S!==null){S.return=s.return,It=S;break e}It=s.return}}if(Lo=o,vI(),Lv&&typeof Lv.onPostCommitFiberRoot=="function")try{Lv.onPostCommitFiberRoot(Bte,t)}catch{}n=!0}return n}finally{Di=r,ey.transition=e}}return!1}function Lrt(t,e,r){e=jz(r,e),e=dot(t,e,1),t=fI(t,e,1),e=Rp(),t!==null&&(r5(t,1,e),Nm(t,e))}function Rs(t,e,r){if(t.tag===3)Lrt(t,t,r);else for(;e!==null;){if(e.tag===3){Lrt(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(pI===null||!pI.has(n))){t=jz(r,t),t=fot(e,t,1),e=fI(e,t,1),t=Rp(),e!==null&&(r5(e,1,t),Nm(e,t));break}}e=e.return}}function AIr(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=Rp(),t.pingedLanes|=t.suspendedLanes&r,Dc===t&&(Ed&r)===r&&(ac===4||ac===3&&(Ed&130023424)===Ed&&500>eu()-PEe?Bj(t,0):EEe|=r),Nm(t,e)}function Rot(t,e){e===0&&((t.mode&1)===0?e=1:(e=Vee,Vee<<=1,(Vee&130023424)===0&&(Vee=4194304)));var r=Rp();t=jE(t,e),t!==null&&(r5(t,e,r),Nm(t,r))}function IIr(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),Rot(t,r)}function MIr(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(We(314))}n!==null&&n.delete(e),Rot(t,r)}var Not;Not=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Mm.current)Im=!0;else{if((t.lanes&r)===0&&(e.flags&128)===0)return Im=!1,bIr(t,e,r);Im=(t.flags&131072)!==0}else Im=!1,$a&&(e.flags&1048576)!==0&&Lnt(e,Tte,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;fte(t,e),t=e.pendingProps;var o=Iz(e,Lf.current);Pz(e,r),o=vEe(null,e,n,t,o,r);var i=wEe();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,Rm(n)?(i=!0,Ete(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,hEe(e),o.updater=Wte,e.stateNode=o,o._reactInternals=e,MOe(e,n,t,r),e=jOe(null,e,n,!0,i,r)):(e.tag=0,$a&&i&&uEe(e),Mp(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(fte(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=NIr(n),t=Db(n,t),o){case 0:e=NOe(null,e,n,t,r);break e;case 1:e=Ert(null,e,n,t,r);break e;case 11:e=Crt(null,e,n,t,r);break e;case 14:e=Ort(null,e,n,Db(n.type,t),r);break e}throw Error(We(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:Db(n,o),NOe(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:Db(n,o),Ert(t,e,n,o,r);case 3:e:{if(got(e),t===null)throw Error(We(387));n=e.pendingProps,i=e.memoizedState,o=i.element,Bnt(t,e),Mte(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=jz(Error(We(423)),e),e=Prt(t,e,n,r,o);break e}else if(n!==o){o=jz(Error(We(424)),e),e=Prt(t,e,n,r,o);break e}else for(Nh=dI(e.stateNode.containerInfo.firstChild),jh=e,$a=!0,Fb=null,r=Hnt(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Mz(),n===o){e=DE(t,e,r);break e}Mp(t,e,n,r)}e=e.child}return e;case 5:return Vnt(e),t===null&&TOe(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,SOe(n,o)?a=null:i!==null&&SOe(n,i)&&(e.flags|=32),hot(t,e),Mp(t,e,a,r),e.child;case 6:return t===null&&TOe(e),null;case 13:return yot(t,e,r);case 4:return gEe(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Rz(e,null,n,r):Mp(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:Db(n,o),Crt(t,e,n,o,r);case 7:return Mp(t,e,e.pendingProps,r),e.child;case 8:return Mp(t,e,e.pendingProps.children,r),e.child;case 12:return Mp(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,la(Ate,n._currentValue),n._currentValue=a,i!==null)if(Bb(i.value,a)){if(i.children===o.children&&!Mm.current){e=DE(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=ME(-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),AOe(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(We(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),AOe(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}Mp(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,Pz(e,r),o=ty(o),n=n(o),e.flags|=1,Mp(t,e,n,r),e.child;case 14:return n=e.type,o=Db(n,e.pendingProps),o=Db(n.type,o),Ort(t,e,n,o,r);case 15:return pot(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:Db(n,o),fte(t,e),e.tag=1,Rm(n)?(t=!0,Ete(e)):t=!1,Pz(e,r),Unt(e,n,o),MOe(e,n,o,r),jOe(null,e,n,!0,t,r);case 19:return bot(t,e,r);case 22:return mot(t,e,r)}throw Error(We(156,e.tag))};function jot(t,e){return ant(t,e)}function RIr(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 Qg(t,e,r,n){return new RIr(t,e,r,n)}function MEe(t){return t=t.prototype,!(!t||!t.isReactComponent)}function NIr(t){if(typeof t=="function")return MEe(t)?1:0;if(t!=null){if(t=t.$$typeof,t===ZOe)return 11;if(t===YOe)return 14}return 2}function hI(t,e){var r=t.alternate;return r===null?(r=Qg(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 hte(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")MEe(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case fz:return zj(r.children,o,i,e);case JOe:a=8,o|=8;break;case tOe:return t=Qg(12,r,e,o|2),t.elementType=tOe,t.lanes=i,t;case rOe:return t=Qg(13,r,e,o),t.elementType=rOe,t.lanes=i,t;case nOe:return t=Qg(19,r,e,o),t.elementType=nOe,t.lanes=i,t;case qrt:return Zte(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case zrt:a=10;break e;case Urt:a=9;break e;case ZOe:a=11;break e;case YOe:a=14;break e;case rI:a=16,n=null;break e}throw Error(We(130,t==null?t:typeof t,""))}return e=Qg(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function zj(t,e,r,n){return t=Qg(7,t,n,e),t.lanes=r,t}function Zte(t,e,r,n){return t=Qg(22,t,n,e),t.elementType=qrt,t.lanes=r,t.stateNode={isHidden:!1},t}function XCe(t,e,r){return t=Qg(6,t,null,e),t.lanes=r,t}function QCe(t,e,r){return e=Qg(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function jIr(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=LCe(0),this.expirationTimes=LCe(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=LCe(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function REe(t,e,r,n,o,i,a,s,u){return t=new jIr(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Qg(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},hEe(i),t}function DIr(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:dz,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function Dot(t){if(!t)return yI;t=t._reactInternals;e:{if(Gj(t)!==t||t.tag!==1)throw Error(We(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Rm(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(We(171))}if(t.tag===1){var r=t.type;if(Rm(r))return jnt(t,r,e)}return e}function Lot(t,e,r,n,o,i,a,s,u){return t=REe(r,n,!0,t,o,i,a,s,u),t.context=Dot(null),r=t.current,n=Rp(),o=mI(r),i=ME(n,o),i.callback=e??null,fI(r,i,o),t.current.lanes=o,r5(t,o,n),Nm(t,n),t}function Yte(t,e,r,n){var o=e.current,i=Rp(),a=mI(o);return r=Dot(r),e.context===null?e.context=r:e.pendingContext=r,e=ME(i,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=fI(o,e,a),t!==null&&($b(t,o,a,i),lte(t,o,a)),a}function $te(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 Frt(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function NEe(t,e){Frt(t,e),(t=t.alternate)&&Frt(t,e)}function LIr(){return null}var Fot=typeof reportError=="function"?reportError:function(t){console.error(t)};function jEe(t){this._internalRoot=t}Xte.prototype.render=jEe.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(We(409));Yte(t,e,null,null)};Xte.prototype.unmount=jEe.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Wj(function(){Yte(null,t,null,null)}),e[NE]=null}};function Xte(t){this._internalRoot=t}Xte.prototype.unstable_scheduleHydration=function(t){if(t){var e=pnt();t={blockedOn:null,target:t,priority:e};for(var r=0;r<oI.length&&e!==0&&e<oI[r].priority;r++);oI.splice(r,0,t),r===0&&hnt(t)}};function DEe(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Qte(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function krt(){}function FIr(t,e,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var l=$te(a);i.call(l)}}var a=Lot(e,n,t,0,null,!1,!1,"",krt);return t._reactRootContainer=a,t[NE]=a.current,K8(t.nodeType===8?t.parentNode:t),Wj(),a}for(;o=t.lastChild;)t.removeChild(o);if(typeof n=="function"){var s=n;n=function(){var l=$te(u);s.call(l)}}var u=REe(t,0,!1,null,null,!1,!1,"",krt);return t._reactRootContainer=u,t[NE]=u.current,K8(t.nodeType===8?t.parentNode:t),Wj(function(){Yte(e,u,r,n)}),u}function ere(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=$te(a);s.call(u)}}Yte(e,a,t,o)}else a=FIr(r,e,t,o,n);return $te(a)}dnt=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=T8(e.pendingLanes);r!==0&&(eEe(e,r|1),Nm(e,eu()),(Lo&6)===0&&(Dz=eu()+500,vI()))}break;case 13:Wj(function(){var n=jE(t,1);if(n!==null){var o=Rp();$b(n,t,1,o)}}),NEe(t,1)}};tEe=function(t){if(t.tag===13){var e=jE(t,134217728);if(e!==null){var r=Rp();$b(e,t,134217728,r)}NEe(t,134217728)}};fnt=function(t){if(t.tag===13){var e=mI(t),r=jE(t,e);if(r!==null){var n=Rp();$b(r,t,e,n)}NEe(t,e)}};pnt=function(){return Di};mnt=function(t,e){var r=Di;try{return Di=t,e()}finally{Di=r}};pOe=function(t,e,r){switch(e){case"input":if(aOe(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=Hte(n);if(!o)throw Error(We(90));Vrt(n),aOe(n,o)}}}break;case"textarea":Krt(t,r);break;case"select":e=r.value,e!=null&&Sz(t,!!r.multiple,e,!1)}};ent=TEe;tnt=Wj;var kIr={usingClientEntryPoint:!1,Events:[o5,gz,Hte,Xrt,Qrt,TEe]},C8={findFiberByHostInstance:Fj,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},$Ir={bundleType:C8.bundleType,version:C8.version,rendererPackageName:C8.rendererPackageName,rendererConfig:C8.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:LE.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=ont(t),t===null?null:t.stateNode},findFiberByHostInstance:C8.findFiberByHostInstance||LIr,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(O8=__REACT_DEVTOOLS_GLOBAL_HOOK__,!O8.isDisabled&&O8.supportsFiber))try{Bte=O8.inject($Ir),Lv=O8}catch{}var O8;Fh.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=kIr;Fh.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!DEe(e))throw Error(We(200));return DIr(t,e,null,r)};Fh.createRoot=function(t,e){if(!DEe(t))throw Error(We(299));var r=!1,n="",o=Fot;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=REe(t,1,!1,null,null,r,!1,n,o),t[NE]=e.current,K8(t.nodeType===8?t.parentNode:t),new jEe(e)};Fh.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(We(188)):(t=Object.keys(t).join(","),Error(We(268,t)));return t=ont(e),t=t===null?null:t.stateNode,t};Fh.flushSync=function(t){return Wj(t)};Fh.hydrate=function(t,e,r){if(!Qte(e))throw Error(We(200));return ere(null,t,e,!0,r)};Fh.hydrateRoot=function(t,e,r){if(!DEe(t))throw Error(We(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=Fot;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=Lot(e,null,t,1,r??null,o,!1,i,a),t[NE]=e.current,K8(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 Xte(e)};Fh.render=function(t,e,r){if(!Qte(e))throw Error(We(200));return ere(null,t,e,!1,r)};Fh.unmountComponentAtNode=function(t){if(!Qte(t))throw Error(We(40));return t._reactRootContainer?(Wj(function(){ere(null,null,t,!1,function(){t._reactRootContainer=null,t[NE]=null})}),!0):!1};Fh.unstable_batchedUpdates=TEe;Fh.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!Qte(r))throw Error(We(200));if(t==null||t._reactInternals===void 0)throw Error(We(38));return ere(t,e,r,!1,n)};Fh.version="18.2.0-next-9e3b772b8-20220608"});var Ba=x((Iso,Bot)=>{"use strict";function $ot(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($ot)}catch(t){console.error(t)}}$ot(),Bot.exports=kot()});var Lc=x(LEe=>{"use strict";var zot=Ba();LEe.createRoot=zot.createRoot,LEe.hydrateRoot=zot.hydrateRoot;var Mso});function Uot(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function qot(...t){return e=>{let r=!1,n=t.map(o=>{let i=Uot(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():Uot(t[o],null)}}}}var BIr,Hot=b(()=>{BIr=j(X(),1)});var Wot=x(tre=>{"use strict";var zIr=X(),UIr=Symbol.for("react.element"),qIr=Symbol.for("react.fragment"),HIr=Object.prototype.hasOwnProperty,VIr=zIr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,WIr={key:!0,ref:!0,__self:!0,__source:!0};function Vot(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)HIr.call(e,n)&&!WIr.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:UIr,type:t,key:i,ref:a,props:o,_owner:VIr.current}}tre.Fragment=qIr;tre.jsx=Vot;tre.jsxs=Vot});var ut=x((Dso,Kot)=>{"use strict";Kot.exports=Wot()});function Ff(t){let e=KIr(t),r=sc.forwardRef((n,o)=>{let{children:i,...a}=n,s=sc.Children.toArray(i),u=s.find(GIr);if(u){let l=u.props.children,c=s.map(d=>d===u?sc.Children.count(l)>1?sc.Children.only(null):sc.isValidElement(l)?l.props.children:null:d);return(0,kz.jsx)(e,{...a,ref:o,children:sc.isValidElement(l)?sc.cloneElement(l,void 0,c):null})}return(0,kz.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function KIr(t){let e=sc.forwardRef((r,n)=>{let{children:o,...i}=r;if(sc.isValidElement(o)){let a=ZIr(o),s=JIr(i,o.props);return o.type!==sc.Fragment&&(s.ref=n?qot(n,a):a),sc.cloneElement(o,s)}return sc.Children.count(o)>1?sc.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}function Zot(t){let e=({children:r})=>(0,kz.jsx)(kz.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=Jot,e}function GIr(t){return sc.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Jot}function JIr(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)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function ZIr(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 sc,kz,Got,Jot,kv=b(()=>{sc=j(X(),1);Hot();kz=j(ut(),1);Got=Ff("Slot");Jot=Symbol("radix.slottable")});function Yot(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=Yot(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function rre(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=Yot(t))&&(n&&(n+=" "),n+=e);return n}var FEe=b(()=>{});var Xot,Qot,$z,nre=b(()=>{FEe();Xot=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Qot=rre,$z=(t,e)=>r=>{var n;if(e?.variants==null)return Qot(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=Xot(c)||Xot(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(h=>{let[m,g]=h;return Array.isArray(g)?g.includes({...i,...s}[m]):{...i,...s}[m]===g})?[...l,d,f]:l},[]);return Qot(t,a,u,r?.class,r?.className)}});function uMr(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=ait(e))&&(n&&(n+=" "),n+=r);return n}function rit(t,...e){let r,n,o,i=a;function a(u){let l=e.reduce((c,d)=>d(c),t());return r=iMr(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=sMr(u,r);return o(u,c),c}return function(){return i(uMr.apply(null,arguments))}}var BEe,YIr,oit,eit,XIr,QIr,$Ee,tit,eMr,tMr,rMr,iit,nMr,oMr,iMr,aMr,sMr,ait,Sa,sit,lMr,cMr,dMr,fMr,pMr,mMr,hMr,FE,wI,Bz,kEe,a5,gMr,vn,xI,yMr,bMr,_Mr,vMr,wMr,xMr,s5,zz,SMr,uit,CMr,OMr,nit,EMr,u5,PMr,TMr,lit,cit=b(()=>{BEe="-",YIr=t=>{let e=QIr(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(BEe);return s[0]===""&&s.length!==1&&s.shift(),oit(s,e)||XIr(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},oit=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?oit(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(BEe);return e.validators.find(({validator:a})=>a(i))?.classGroupId},eit=/^\[(.+)\]$/,XIr=t=>{if(eit.test(t)){let e=eit.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},QIr=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return tMr(Object.entries(t.classGroups),r).forEach(([i,a])=>{$Ee(a,n,i,e)}),n},$Ee=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:tit(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(eMr(o)){$Ee(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{$Ee(a,tit(e,i),r,n)})})},tit=(t,e)=>{let r=t;return e.split(BEe).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},eMr=t=>t.isThemeGetter,tMr=(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,rMr=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)}}},iit="!",nMr=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 g=0;g<s.length;g++){let y=s[g];if(l===0){if(y===o&&(n||s.slice(g,g+i)===e)){u.push(s.slice(c,g)),c=g+i;continue}if(y==="/"){d=g;continue}}y==="["?l++:y==="]"&&l--}let f=u.length===0?s:s.substring(c),p=f.startsWith(iit),h=p?f.substring(1):f,m=d&&d>c?d-c:void 0;return{modifiers:u,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:m}};return r?s=>r({className:s,parseClassName:a}):a},oMr=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},iMr=t=>({cache:rMr(t.cacheSize),parseClassName:nMr(t),...YIr(t)}),aMr=/\s+/,sMr=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split(aMr),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),h=!!p,m=n(h?f.substring(0,p):f);if(!m){if(!h){s=l+(s.length>0?" "+s:s);continue}if(m=n(f),!m){s=l+(s.length>0?" "+s:s);continue}h=!1}let g=oMr(c).join(":"),y=d?g+iit:g,_=y+m;if(i.includes(_))continue;i.push(_);let w=o(m,h);for(let S=0;S<w.length;++S){let C=w[S];i.push(y+C)}s=l+(s.length>0?" "+s:s)}return s};ait=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=ait(t[n]))&&(r&&(r+=" "),r+=e);return r};Sa=t=>{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},sit=/^\[(?:([a-z-]+):)?(.+)\]$/i,lMr=/^\d+\/\d+$/,cMr=new Set(["px","full","screen"]),dMr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fMr=/\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$/,pMr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,mMr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hMr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,FE=t=>Bz(t)||cMr.has(t)||lMr.test(t),wI=t=>zz(t,"length",SMr),Bz=t=>!!t&&!Number.isNaN(Number(t)),kEe=t=>zz(t,"number",Bz),a5=t=>!!t&&Number.isInteger(Number(t)),gMr=t=>t.endsWith("%")&&Bz(t.slice(0,-1)),vn=t=>sit.test(t),xI=t=>dMr.test(t),yMr=new Set(["length","size","percentage"]),bMr=t=>zz(t,yMr,uit),_Mr=t=>zz(t,"position",uit),vMr=new Set(["image","url"]),wMr=t=>zz(t,vMr,OMr),xMr=t=>zz(t,"",CMr),s5=()=>!0,zz=(t,e,r)=>{let n=sit.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},SMr=t=>fMr.test(t)&&!pMr.test(t),uit=()=>!1,CMr=t=>mMr.test(t),OMr=t=>hMr.test(t),nit=()=>{let t=Sa("colors"),e=Sa("spacing"),r=Sa("blur"),n=Sa("brightness"),o=Sa("borderColor"),i=Sa("borderRadius"),a=Sa("borderSpacing"),s=Sa("borderWidth"),u=Sa("contrast"),l=Sa("grayscale"),c=Sa("hueRotate"),d=Sa("invert"),f=Sa("gap"),p=Sa("gradientColorStops"),h=Sa("gradientColorStopPositions"),m=Sa("inset"),g=Sa("margin"),y=Sa("opacity"),_=Sa("padding"),w=Sa("saturate"),S=Sa("scale"),C=Sa("sepia"),E=Sa("skew"),P=Sa("space"),T=Sa("translate"),I=()=>["auto","contain","none"],N=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto",vn,e],D=()=>[vn,e],k=()=>["",FE,wI],F=()=>["auto",Bz,vn],K=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",vn],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>[Bz,vn];return{cacheSize:500,separator:":",theme:{colors:[s5],spacing:[FE,wI],blur:["none","",xI,vn],brightness:z(),borderColor:[t],borderRadius:["none","","full",xI,vn],borderSpacing:D(),borderWidth:k(),contrast:z(),grayscale:L(),hueRotate:z(),invert:L(),gap:D(),gradientColorStops:[t],gradientColorStopPositions:[gMr,wI],inset:M(),margin:M(),opacity:z(),padding:D(),saturate:z(),scale:z(),sepia:L(),skew:z(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",vn]}],container:["container"],columns:[{columns:[xI]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"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:[...K(),vn]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",a5,vn]}],basis:[{basis:M()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",vn]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",a5,vn]}],"grid-cols":[{"grid-cols":[s5]}],"col-start-end":[{col:["auto",{span:["full",a5,vn]},vn]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[s5]}],"row-start-end":[{row:["auto",{span:[a5,vn]},vn]}],"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",vn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",vn]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...ee()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ee(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ee(),"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:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",vn,e]}],"min-w":[{"min-w":[vn,e,"min","max","fit"]}],"max-w":[{"max-w":[vn,e,"none","full","min","max","fit","prose",{screen:[xI]},xI]}],h:[{h:[vn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[vn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[vn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[vn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",xI,wI]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",kEe]}],"font-family":[{font:[s5]}],"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",vn]}],"line-clamp":[{"line-clamp":["none",Bz,kEe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",FE,vn]}],"list-image":[{"list-image":["none",vn]}],"list-style-type":[{list:["none","disc","decimal",vn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",FE,wI]}],"underline-offset":[{"underline-offset":["auto",FE,vn]}],"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:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",vn]}],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",vn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...K(),_Mr]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",bMr]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},wMr]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"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":[y]}],"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":[y]}],"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":[FE,vn]}],"outline-w":[{outline:[FE,wI]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:k()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[FE,wI]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",xI,xMr]}],"shadow-color":[{shadow:[s5]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...Y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Y()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",xI,vn]}],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":[y]}],"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",vn]}],duration:[{duration:z()}],ease:[{ease:["linear","in","out","in-out",vn]}],delay:[{delay:z()}],animate:[{animate:["none","spin","ping","pulse","bounce",vn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[a5,vn]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",vn]}],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",vn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"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",vn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[FE,wI,kEe]}],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"]}}},EMr=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{u5(t,"cacheSize",e),u5(t,"prefix",r),u5(t,"separator",n),u5(t,"experimentalParseClassName",o);for(let s in a)PMr(t[s],a[s]);for(let s in i)TMr(t[s],i[s]);return t},u5=(t,e,r)=>{r!==void 0&&(t[e]=r)},PMr=(t,e)=>{if(e)for(let r in e)u5(t,r,e[r])},TMr=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},lit=(t,...e)=>typeof t=="function"?rit(nit,t,...e):rit(()=>EMr(nit(),t),...e)});function me(...t){return AMr(rre(t))}var AMr,wn=b(()=>{FEe();cit();AMr=lit({prefix:"tw-",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"]}}})});var ore,IMr,he,vo=b(()=>{ore=j(X());kv();nre();wn();IMr=$z("tw-inline-flex tw-items-center tw-justify-center tw-gap-1 tw-whitespace-nowrap tw-rounded-md tw-text-sm tw-font-medium tw-transition-colors focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring disabled:tw-pointer-events-none disabled:tw-opacity-50 [&_svg]:tw-shrink-0",{variants:{variant:{default:"mod-cta tw-bg-interactive-accent tw-text-on-accent tw-shadow hover:tw-bg-interactive-accent-hover",destructive:"clickable-icon tw-bg-modifier-error tw-text-on-accent hover:tw-bg-modifier-error hover:tw-text-on-accent",secondary:"tw-bg-secondary tw-text-normal tw-shadow-sm hover:tw-bg-interactive-hover",ghost:"clickable-icon tw-bg-transparent hover:tw-bg-interactive-accent hover:tw-text-on-accent",link:"tw-text-accent tw-underline-offset-4 hover:tw-underline",success:"clickable-icon tw-bg-modifier-success tw-text-on-accent hover:tw-bg-modifier-success hover:tw-text-on-accent",ghost2:"clickable-icon tw-bg-transparent tw-text-faint tw-outline-none hover:tw-bg-transparent hover:tw-bg-opacity-100 hover:tw-text-normal focus-visible:tw-text-normal focus-visible:tw-outline-none focus-visible:tw-ring-0"},size:{default:"tw-h-9 tw-px-4 tw-py-2",sm:"tw-h-6 tw-rounded-md tw-px-3 tw-text-xs",lg:"tw-h-10 tw-rounded-md tw-px-8",icon:"tw-size-7",fit:"tw-gap-1 tw-px-1 tw-text-xs"}},defaultVariants:{variant:"default",size:"default"}}),he=ore.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>ore.createElement(n?Got:"button",{className:me(IMr({variant:e,size:r,className:t})),ref:i,...o}));he.displayName="Button"});var dit,ire,zEe=b(()=>{dit=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ire=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim()});var fit,pit=b(()=>{fit={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 l5,mit,hit=b(()=>{l5=j(X());pit();zEe();mit=(0,l5.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,l5.createElement)("svg",{ref:u,...fit,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:ire("lucide",o),...s},[...a.map(([l,c])=>(0,l5.createElement)(l,c)),...Array.isArray(i)?i:[i]]))});var are,ge,_t=b(()=>{are=j(X());zEe();hit();ge=(t,e)=>{let r=(0,are.forwardRef)(({className:n,...o},i)=>(0,are.createElement)(mit,{ref:i,iconNode:e,className:ire(`lucide-${dit(t)}`,n),...o}));return r.displayName=`${t}`,r}});var Uz,git=b(()=>{_t();Uz=ge("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]])});var c5,yit=b(()=>{_t();c5=ge("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])});var Jj,bit=b(()=>{_t();Jj=ge("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 d5,_it=b(()=>{_t();d5=ge("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]])});var Fc,vit=b(()=>{_t();Fc=ge("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])});var Li,wit=b(()=>{_t();Li=ge("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])});var jm,xit=b(()=>{_t();jm=ge("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])});var zb,Sit=b(()=>{_t();zb=ge("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])});var $v,Cit=b(()=>{_t();$v=ge("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])});var SI,Oit=b(()=>{_t();SI=ge("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])});var f5,Eit=b(()=>{_t();f5=ge("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]])});var Fi,Pit=b(()=>{_t();Fi=ge("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 kh,Tit=b(()=>{_t();kh=ge("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])});var CI,Ait=b(()=>{_t();CI=ge("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]])});var OI,Iit=b(()=>{_t();OI=ge("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])});var p5,Mit=b(()=>{_t();p5=ge("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])});var m5,Rit=b(()=>{_t();m5=ge("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 EI,Nit=b(()=>{_t();EI=ge("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 $h,jit=b(()=>{_t();$h=ge("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 Ub,Dit=b(()=>{_t();Ub=ge("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]])});var h5,Lit=b(()=>{_t();h5=ge("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 Zj,Fit=b(()=>{_t();Zj=ge("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 g5,kit=b(()=>{_t();g5=ge("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 kE,$it=b(()=>{_t();kE=ge("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 PI,Bit=b(()=>{_t();PI=ge("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 Yj,zit=b(()=>{_t();Yj=ge("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 y5,Uit=b(()=>{_t();y5=ge("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 $E,qit=b(()=>{_t();$E=ge("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 b5,Hit=b(()=>{_t();b5=ge("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]])});var _5,Vit=b(()=>{_t();_5=ge("FileImage",[["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"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]])});var v5,Wit=b(()=>{_t();v5=ge("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 w5,Kit=b(()=>{_t();w5=ge("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 Dm,Git=b(()=>{_t();Dm=ge("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 x5,Jit=b(()=>{_t();x5=ge("FileVideo",[["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 11 5 3-5 3v-6Z",key:"7ntvm4"}]])});var S5,Zit=b(()=>{_t();S5=ge("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 ny,Yit=b(()=>{_t();ny=ge("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 BE,Xit=b(()=>{_t();BE=ge("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 Bv,Qit=b(()=>{_t();Bv=ge("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 C5,eat=b(()=>{_t();C5=ge("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])});var O5,tat=b(()=>{_t();O5=ge("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 zv,rat=b(()=>{_t();zv=ge("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 E5,nat=b(()=>{_t();E5=ge("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 Xj,oat=b(()=>{_t();Xj=ge("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 zE,iat=b(()=>{_t();zE=ge("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 tu,aat=b(()=>{_t();tu=ge("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])});var P5,sat=b(()=>{_t();P5=ge("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 qz,uat=b(()=>{_t();qz=ge("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])});var Uv,lat=b(()=>{_t();Uv=ge("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 qb,cat=b(()=>{_t();qb=ge("Pen",[["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"}]])});var Hz,dat=b(()=>{_t();Hz=ge("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 Vz,fat=b(()=>{_t();Vz=ge("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 Bh,pat=b(()=>{_t();Bh=ge("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])});var T5,mat=b(()=>{_t();T5=ge("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 qv,hat=b(()=>{_t();qv=ge("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 A5,gat=b(()=>{_t();A5=ge("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])});var I5,yat=b(()=>{_t();I5=ge("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 Qj,bat=b(()=>{_t();Qj=ge("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])});var Lm,_at=b(()=>{_t();Lm=ge("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 UE,vat=b(()=>{_t();UE=ge("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 Fm,wat=b(()=>{_t();Fm=ge("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 TI,xat=b(()=>{_t();TI=ge("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 M5,Sat=b(()=>{_t();M5=ge("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 zh,Cat=b(()=>{_t();zh=ge("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 jp,Oat=b(()=>{_t();jp=ge("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 R5,Eat=b(()=>{_t();R5=ge("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 eD,Pat=b(()=>{_t();eD=ge("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 bi,Tat=b(()=>{_t();bi=ge("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])});var N5,Aat=b(()=>{_t();N5=ge("ZapOff",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])});var j5,Iat=b(()=>{_t();j5=ge("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])});var fn=b(()=>{Cit();Oit();Pit();Tit();Ait();Iit();$it();Bit();aat();lat();cat();_at();vat();wat();Oat();git();yit();bit();_it();vit();wit();xit();Sit();Eit();Mit();Rit();Nit();jit();Dit();Lit();Fit();kit();zit();Uit();qit();Hit();Vit();Wit();Kit();Git();Jit();Zit();Yit();Xit();Qit();eat();tat();rat();nat();oat();iat();sat();uat();dat();fat();pat();mat();hat();gat();yat();bat();xat();Sat();Cat();Eat();Pat();Tat();Aat();Iat();});function MMr({onCancel:t}){let e=oe(),r=UEe(e.defaultModelKey)&&UEe(e.embeddingModelKey);return Hv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Hv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Hv.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&Hv.default.createElement("div",{className:"tw-text-sm tw-text-warning"},"The Copilot Plus exclusive models will stop working. You can switch to the default models in the Settings.")),Hv.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},Hv.default.createElement(he,{variant:"ghost",onClick:t},"Close"),Hv.default.createElement(he,{variant:"default",onClick:()=>{tD(CE.EXPIRED_MODAL)}},"Renew Now ",Hv.default.createElement(Yj,{className:"tw-size-4"}))))}var Hv,Mat,Rat,sre,Nat=b(()=>{Hv=j(X()),Mat=require("obsidian"),Rat=j(Lc());vo();oy();nr();fn();bt();sre=class extends Mat.Modal{constructor(e){super(e),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:e}=this;this.root=(0,Rat.createRoot)(e);let r=()=>{this.close()};this.root.render(Hv.default.createElement(MMr,{onCancel:r}))}onClose(){this.root.unmount()}}});var jat=x(ure=>{"use strict";Object.defineProperty(ure,"__esModule",{value:!0});ure.V2ChatStreamRequestCitationMode=void 0;ure.V2ChatStreamRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var Dat=x(lre=>{"use strict";Object.defineProperty(lre,"__esModule",{value:!0});lre.V2ChatRequestCitationMode=void 0;lre.V2ChatRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var Fat=x(Lat=>{"use strict";Object.defineProperty(Lat,"__esModule",{value:!0})});var $at=x(kat=>{"use strict";Object.defineProperty(kat,"__esModule",{value:!0})});var zat=x(Bat=>{"use strict";Object.defineProperty(Bat,"__esModule",{value:!0})});var qat=x(Uat=>{"use strict";Object.defineProperty(Uat,"__esModule",{value:!0})});var Vat=x(Hat=>{"use strict";Object.defineProperty(Hat,"__esModule",{value:!0})});var Kat=x(Wat=>{"use strict";Object.defineProperty(Wat,"__esModule",{value:!0})});var Jat=x(Gat=>{"use strict";Object.defineProperty(Gat,"__esModule",{value:!0})});var Yat=x(Zat=>{"use strict";Object.defineProperty(Zat,"__esModule",{value:!0})});var Qat=x(Xat=>{"use strict";Object.defineProperty(Xat,"__esModule",{value:!0})});var tst=x(est=>{"use strict";Object.defineProperty(est,"__esModule",{value:!0})});var nst=x(rst=>{"use strict";Object.defineProperty(rst,"__esModule",{value:!0})});var ist=x(ost=>{"use strict";Object.defineProperty(ost,"__esModule",{value:!0})});var sst=x(ast=>{"use strict";Object.defineProperty(ast,"__esModule",{value:!0})});var lst=x(ust=>{"use strict";Object.defineProperty(ust,"__esModule",{value:!0})});var dst=x(cst=>{"use strict";Object.defineProperty(cst,"__esModule",{value:!0})});var pst=x(fst=>{"use strict";Object.defineProperty(fst,"__esModule",{value:!0})});var hst=x(mst=>{"use strict";Object.defineProperty(mst,"__esModule",{value:!0})});var yst=x(gst=>{"use strict";Object.defineProperty(gst,"__esModule",{value:!0})});var _st=x(bst=>{"use strict";Object.defineProperty(bst,"__esModule",{value:!0})});var wst=x(vst=>{"use strict";Object.defineProperty(vst,"__esModule",{value:!0})});var Sst=x(xst=>{"use strict";Object.defineProperty(xst,"__esModule",{value:!0})});var Ost=x(Cst=>{"use strict";Object.defineProperty(Cst,"__esModule",{value:!0})});var Pst=x(Est=>{"use strict";Object.defineProperty(Est,"__esModule",{value:!0})});var Tst=x(cre=>{"use strict";Object.defineProperty(cre,"__esModule",{value:!0});cre.ChatFinishReason=void 0;cre.ChatFinishReason={Complete:"complete",StopSequence:"stop_sequence",MaxTokens:"max_tokens",ToolCall:"tool_call",Error:"error",ContentBlocked:"content_blocked",ErrorLimit:"error_limit"}});var Ist=x(Ast=>{"use strict";Object.defineProperty(Ast,"__esModule",{value:!0})});var Rst=x(Mst=>{"use strict";Object.defineProperty(Mst,"__esModule",{value:!0})});var jst=x(Nst=>{"use strict";Object.defineProperty(Nst,"__esModule",{value:!0})});var Lst=x(Dst=>{"use strict";Object.defineProperty(Dst,"__esModule",{value:!0})});var kst=x(Fst=>{"use strict";Object.defineProperty(Fst,"__esModule",{value:!0})});var Bst=x($st=>{"use strict";Object.defineProperty($st,"__esModule",{value:!0})});var Ust=x(zst=>{"use strict";Object.defineProperty(zst,"__esModule",{value:!0})});var Hst=x(qst=>{"use strict";Object.defineProperty(qst,"__esModule",{value:!0})});var Wst=x(Vst=>{"use strict";Object.defineProperty(Vst,"__esModule",{value:!0})});var Gst=x(Kst=>{"use strict";Object.defineProperty(Kst,"__esModule",{value:!0})});var Zst=x(Jst=>{"use strict";Object.defineProperty(Jst,"__esModule",{value:!0})});var Xst=x(Yst=>{"use strict";Object.defineProperty(Yst,"__esModule",{value:!0})});var eut=x(Qst=>{"use strict";Object.defineProperty(Qst,"__esModule",{value:!0})});var rut=x(tut=>{"use strict";Object.defineProperty(tut,"__esModule",{value:!0})});var out=x(nut=>{"use strict";Object.defineProperty(nut,"__esModule",{value:!0})});var aut=x(iut=>{"use strict";Object.defineProperty(iut,"__esModule",{value:!0})});var uut=x(sut=>{"use strict";Object.defineProperty(sut,"__esModule",{value:!0})});var cut=x(lut=>{"use strict";Object.defineProperty(lut,"__esModule",{value:!0})});var fut=x(dut=>{"use strict";Object.defineProperty(dut,"__esModule",{value:!0})});var mut=x(put=>{"use strict";Object.defineProperty(put,"__esModule",{value:!0})});var gut=x(hut=>{"use strict";Object.defineProperty(hut,"__esModule",{value:!0})});var but=x(yut=>{"use strict";Object.defineProperty(yut,"__esModule",{value:!0})});var vut=x(_ut=>{"use strict";Object.defineProperty(_ut,"__esModule",{value:!0})});var xut=x(wut=>{"use strict";Object.defineProperty(wut,"__esModule",{value:!0})});var Cut=x(Sut=>{"use strict";Object.defineProperty(Sut,"__esModule",{value:!0})});var Eut=x(Out=>{"use strict";Object.defineProperty(Out,"__esModule",{value:!0})});var Tut=x(Put=>{"use strict";Object.defineProperty(Put,"__esModule",{value:!0})});var Iut=x(Aut=>{"use strict";Object.defineProperty(Aut,"__esModule",{value:!0})});var Rut=x(Mut=>{"use strict";Object.defineProperty(Mut,"__esModule",{value:!0})});var jut=x(Nut=>{"use strict";Object.defineProperty(Nut,"__esModule",{value:!0})});var Lut=x(Dut=>{"use strict";Object.defineProperty(Dut,"__esModule",{value:!0})});var kut=x(Fut=>{"use strict";Object.defineProperty(Fut,"__esModule",{value:!0})});var But=x($ut=>{"use strict";Object.defineProperty($ut,"__esModule",{value:!0})});var qEe=x(jt=>{"use strict";var RMr=jt&&jt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jt=jt&&jt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&RMr(e,t,r)};Object.defineProperty(jt,"__esModule",{value:!0});Jt(jat(),jt);Jt(Dat(),jt);Jt(Fat(),jt);Jt($at(),jt);Jt(zat(),jt);Jt(qat(),jt);Jt(Vat(),jt);Jt(Kat(),jt);Jt(Jat(),jt);Jt(Yat(),jt);Jt(Qat(),jt);Jt(tst(),jt);Jt(nst(),jt);Jt(ist(),jt);Jt(sst(),jt);Jt(lst(),jt);Jt(dst(),jt);Jt(pst(),jt);Jt(hst(),jt);Jt(yst(),jt);Jt(_st(),jt);Jt(wst(),jt);Jt(Sst(),jt);Jt(Ost(),jt);Jt(Pst(),jt);Jt(Tst(),jt);Jt(Ist(),jt);Jt(Rst(),jt);Jt(jst(),jt);Jt(Lst(),jt);Jt(kst(),jt);Jt(Bst(),jt);Jt(Ust(),jt);Jt(Hst(),jt);Jt(Wst(),jt);Jt(Gst(),jt);Jt(Zst(),jt);Jt(Xst(),jt);Jt(eut(),jt);Jt(rut(),jt);Jt(out(),jt);Jt(aut(),jt);Jt(uut(),jt);Jt(cut(),jt);Jt(fut(),jt);Jt(mut(),jt);Jt(gut(),jt);Jt(but(),jt);Jt(vut(),jt);Jt(xut(),jt);Jt(Cut(),jt);Jt(Eut(),jt);Jt(Tut(),jt);Jt(Iut(),jt);Jt(Rut(),jt);Jt(jut(),jt);Jt(Lut(),jt);Jt(kut(),jt);Jt(But(),jt)});var HEe=x(zut=>{"use strict";Object.defineProperty(zut,"__esModule",{value:!0})});var Uut=x(rD=>{"use strict";var NMr=rD&&rD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=rD&&rD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&NMr(e,t,r)};Object.defineProperty(rD,"__esModule",{value:!0});jMr(HEe(),rD)});var Hut=x(AI=>{"use strict";var DMr=AI&&AI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qut=AI&&AI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DMr(e,t,r)};Object.defineProperty(AI,"__esModule",{value:!0});qut(qEe(),AI);qut(Uut(),AI)});var Vut=x(dre=>{"use strict";Object.defineProperty(dre,"__esModule",{value:!0});dre.CreateEmbedJobRequestTruncate=void 0;dre.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var VEe=x(nD=>{"use strict";var LMr=nD&&nD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FMr=nD&&nD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&LMr(e,t,r)};Object.defineProperty(nD,"__esModule",{value:!0});FMr(Vut(),nD)});var WEe=x(Wut=>{"use strict";Object.defineProperty(Wut,"__esModule",{value:!0})});var Kut=x(oD=>{"use strict";var kMr=oD&&oD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Mr=oD&&oD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kMr(e,t,r)};Object.defineProperty(oD,"__esModule",{value:!0});$Mr(WEe(),oD)});var Jut=x(II=>{"use strict";var BMr=II&&II.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gut=II&&II.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BMr(e,t,r)};Object.defineProperty(II,"__esModule",{value:!0});Gut(VEe(),II);Gut(Kut(),II)});var Yut=x(Zut=>{"use strict";Object.defineProperty(Zut,"__esModule",{value:!0})});var Qut=x(Xut=>{"use strict";Object.defineProperty(Xut,"__esModule",{value:!0})});var tlt=x(elt=>{"use strict";Object.defineProperty(elt,"__esModule",{value:!0})});var nlt=x(rlt=>{"use strict";Object.defineProperty(rlt,"__esModule",{value:!0})});var ilt=x(olt=>{"use strict";Object.defineProperty(olt,"__esModule",{value:!0})});var KEe=x(Hb=>{"use strict";var zMr=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]}),D5=Hb&&Hb.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zMr(e,t,r)};Object.defineProperty(Hb,"__esModule",{value:!0});D5(Yut(),Hb);D5(Qut(),Hb);D5(tlt(),Hb);D5(nlt(),Hb);D5(ilt(),Hb)});var GEe=x(alt=>{"use strict";Object.defineProperty(alt,"__esModule",{value:!0})});var slt=x(iD=>{"use strict";var UMr=iD&&iD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qMr=iD&&iD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UMr(e,t,r)};Object.defineProperty(iD,"__esModule",{value:!0});qMr(GEe(),iD)});var llt=x(MI=>{"use strict";var HMr=MI&&MI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ult=MI&&MI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&HMr(e,t,r)};Object.defineProperty(MI,"__esModule",{value:!0});ult(KEe(),MI);ult(slt(),MI)});var clt=x(fre=>{"use strict";Object.defineProperty(fre,"__esModule",{value:!0});fre.BaseType=void 0;fre.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var dlt=x(pre=>{"use strict";Object.defineProperty(pre,"__esModule",{value:!0});pre.Strategy=void 0;pre.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var plt=x(flt=>{"use strict";Object.defineProperty(flt,"__esModule",{value:!0})});var hlt=x(mlt=>{"use strict";Object.defineProperty(mlt,"__esModule",{value:!0})});var ylt=x(glt=>{"use strict";Object.defineProperty(glt,"__esModule",{value:!0})});var _lt=x(blt=>{"use strict";Object.defineProperty(blt,"__esModule",{value:!0})});var vlt=x(mre=>{"use strict";Object.defineProperty(mre,"__esModule",{value:!0});mre.Status=void 0;mre.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 xlt=x(wlt=>{"use strict";Object.defineProperty(wlt,"__esModule",{value:!0})});var Clt=x(Slt=>{"use strict";Object.defineProperty(Slt,"__esModule",{value:!0})});var Elt=x(Olt=>{"use strict";Object.defineProperty(Olt,"__esModule",{value:!0})});var Tlt=x(Plt=>{"use strict";Object.defineProperty(Plt,"__esModule",{value:!0})});var Ilt=x(Alt=>{"use strict";Object.defineProperty(Alt,"__esModule",{value:!0})});var Rlt=x(Mlt=>{"use strict";Object.defineProperty(Mlt,"__esModule",{value:!0})});var jlt=x(Nlt=>{"use strict";Object.defineProperty(Nlt,"__esModule",{value:!0})});var Llt=x(Dlt=>{"use strict";Object.defineProperty(Dlt,"__esModule",{value:!0})});var klt=x(Flt=>{"use strict";Object.defineProperty(Flt,"__esModule",{value:!0})});var Blt=x($lt=>{"use strict";Object.defineProperty($lt,"__esModule",{value:!0})});var JEe=x(us=>{"use strict";var VMr=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]}),Td=us&&us.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&VMr(e,t,r)};Object.defineProperty(us,"__esModule",{value:!0});Td(clt(),us);Td(dlt(),us);Td(plt(),us);Td(hlt(),us);Td(ylt(),us);Td(_lt(),us);Td(vlt(),us);Td(xlt(),us);Td(Clt(),us);Td(Elt(),us);Td(Tlt(),us);Td(Ilt(),us);Td(Rlt(),us);Td(jlt(),us);Td(Llt(),us);Td(klt(),us);Td(Blt(),us)});var zlt=x(aD=>{"use strict";var WMr=aD&&aD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KMr=aD&&aD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&WMr(e,t,r)};Object.defineProperty(aD,"__esModule",{value:!0});KMr(JEe(),aD)});var qlt=x(Uh=>{"use strict";var Ult=Uh&&Uh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GMr=Uh&&Uh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JMr=Uh&&Uh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ult(e,t,r);return GMr(e,t),e},ZMr=Uh&&Uh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ult(e,t,r)};Object.defineProperty(Uh,"__esModule",{value:!0});Uh.finetuning=void 0;Uh.finetuning=JMr(zlt());ZMr(JEe(),Uh)});var ZEe=x(Hlt=>{"use strict";Object.defineProperty(Hlt,"__esModule",{value:!0})});var Vlt=x(sD=>{"use strict";var YMr=sD&&sD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=sD&&sD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&YMr(e,t,r)};Object.defineProperty(sD,"__esModule",{value:!0});XMr(ZEe(),sD)});var Klt=x(RI=>{"use strict";var QMr=RI&&RI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wlt=RI&&RI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&QMr(e,t,r)};Object.defineProperty(RI,"__esModule",{value:!0});Wlt(qlt(),RI);Wlt(Vlt(),RI)});var YEe=x(Glt=>{"use strict";Object.defineProperty(Glt,"__esModule",{value:!0})});var Jlt=x(uD=>{"use strict";var eRr=uD&&uD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tRr=uD&&uD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eRr(e,t,r)};Object.defineProperty(uD,"__esModule",{value:!0});tRr(YEe(),uD)});var Zlt=x(lD=>{"use strict";var rRr=lD&&lD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=lD&&lD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rRr(e,t,r)};Object.defineProperty(lD,"__esModule",{value:!0});nRr(Jlt(),lD)});var XEe=x(Ylt=>{"use strict";Object.defineProperty(Ylt,"__esModule",{value:!0})});var Xlt=x(cD=>{"use strict";var oRr=cD&&cD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iRr=cD&&cD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oRr(e,t,r)};Object.defineProperty(cD,"__esModule",{value:!0});iRr(XEe(),cD)});var Qlt=x(dD=>{"use strict";var aRr=dD&&dD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sRr=dD&&dD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&aRr(e,t,r)};Object.defineProperty(dD,"__esModule",{value:!0});sRr(Xlt(),dD)});var tct=x(_i=>{"use strict";var ect=_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]}),uRr=_i&&_i.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wz=_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)&&ect(e,t,r);return uRr(e,t),e},qE=_i&&_i.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ect(e,t,r)};Object.defineProperty(_i,"__esModule",{value:!0});_i.models=_i.connectors=_i.finetuning=_i.datasets=_i.embedJobs=_i.v2=void 0;_i.v2=Wz(Hut());qE(qEe(),_i);_i.embedJobs=Wz(Jut());qE(VEe(),_i);_i.datasets=Wz(llt());qE(KEe(),_i);_i.finetuning=Wz(Klt());_i.connectors=Wz(Zlt());_i.models=Wz(Qlt());qE(HEe(),_i);qE(WEe(),_i);qE(GEe(),_i);qE(YEe(),_i);qE(XEe(),_i);qE(ZEe(),_i)});var rct=x(hre=>{"use strict";Object.defineProperty(hre,"__esModule",{value:!0});hre.ChatStreamRequestPromptTruncation=void 0;hre.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var nct=x(gre=>{"use strict";Object.defineProperty(gre,"__esModule",{value:!0});gre.ChatStreamRequestCitationQuality=void 0;gre.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var ict=x(oct=>{"use strict";Object.defineProperty(oct,"__esModule",{value:!0})});var act=x(yre=>{"use strict";Object.defineProperty(yre,"__esModule",{value:!0});yre.ChatStreamRequestSafetyMode=void 0;yre.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var uct=x(sct=>{"use strict";Object.defineProperty(sct,"__esModule",{value:!0})});var cct=x(lct=>{"use strict";Object.defineProperty(lct,"__esModule",{value:!0})});var fct=x(dct=>{"use strict";Object.defineProperty(dct,"__esModule",{value:!0})});var mct=x(pct=>{"use strict";Object.defineProperty(pct,"__esModule",{value:!0})});var gct=x(hct=>{"use strict";Object.defineProperty(hct,"__esModule",{value:!0})});var yct=x(bre=>{"use strict";Object.defineProperty(bre,"__esModule",{value:!0});bre.ChatRequestPromptTruncation=void 0;bre.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var bct=x(_re=>{"use strict";Object.defineProperty(_re,"__esModule",{value:!0});_re.ChatRequestCitationQuality=void 0;_re.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var vct=x(_ct=>{"use strict";Object.defineProperty(_ct,"__esModule",{value:!0})});var wct=x(vre=>{"use strict";Object.defineProperty(vre,"__esModule",{value:!0});vre.ChatRequestSafetyMode=void 0;vre.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var xct=x(wre=>{"use strict";Object.defineProperty(wre,"__esModule",{value:!0});wre.GenerateStreamRequestTruncate=void 0;wre.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var Sct=x(xre=>{"use strict";Object.defineProperty(xre,"__esModule",{value:!0});xre.GenerateStreamRequestReturnLikelihoods=void 0;xre.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var Cct=x(Sre=>{"use strict";Object.defineProperty(Sre,"__esModule",{value:!0});Sre.GenerateRequestTruncate=void 0;Sre.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var Oct=x(Cre=>{"use strict";Object.defineProperty(Cre,"__esModule",{value:!0});Cre.GenerateRequestReturnLikelihoods=void 0;Cre.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var Ect=x(Ore=>{"use strict";Object.defineProperty(Ore,"__esModule",{value:!0});Ore.EmbedRequestTruncate=void 0;Ore.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var Tct=x(Pct=>{"use strict";Object.defineProperty(Pct,"__esModule",{value:!0})});var Ict=x(Act=>{"use strict";Object.defineProperty(Act,"__esModule",{value:!0})});var Rct=x(Mct=>{"use strict";Object.defineProperty(Mct,"__esModule",{value:!0})});var jct=x(Nct=>{"use strict";Object.defineProperty(Nct,"__esModule",{value:!0})});var Lct=x(Dct=>{"use strict";Object.defineProperty(Dct,"__esModule",{value:!0})});var Fct=x(Ere=>{"use strict";Object.defineProperty(Ere,"__esModule",{value:!0});Ere.ClassifyRequestTruncate=void 0;Ere.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var $ct=x(kct=>{"use strict";Object.defineProperty(kct,"__esModule",{value:!0})});var Bct=x(Pre=>{"use strict";Object.defineProperty(Pre,"__esModule",{value:!0});Pre.ClassifyResponseClassificationsItemClassificationType=void 0;Pre.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var Uct=x(zct=>{"use strict";Object.defineProperty(zct,"__esModule",{value:!0})});var Hct=x(qct=>{"use strict";Object.defineProperty(qct,"__esModule",{value:!0})});var Vct=x(Tre=>{"use strict";Object.defineProperty(Tre,"__esModule",{value:!0});Tre.SummarizeRequestLength=void 0;Tre.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var Wct=x(Are=>{"use strict";Object.defineProperty(Are,"__esModule",{value:!0});Are.SummarizeRequestFormat=void 0;Are.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var Kct=x(Ire=>{"use strict";Object.defineProperty(Ire,"__esModule",{value:!0});Ire.SummarizeRequestExtractiveness=void 0;Ire.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var Jct=x(Gct=>{"use strict";Object.defineProperty(Gct,"__esModule",{value:!0})});var Yct=x(Zct=>{"use strict";Object.defineProperty(Zct,"__esModule",{value:!0})});var Qct=x(Xct=>{"use strict";Object.defineProperty(Xct,"__esModule",{value:!0})});var tdt=x(edt=>{"use strict";Object.defineProperty(edt,"__esModule",{value:!0})});var ndt=x(rdt=>{"use strict";Object.defineProperty(rdt,"__esModule",{value:!0})});var idt=x(odt=>{"use strict";Object.defineProperty(odt,"__esModule",{value:!0})});var sdt=x(adt=>{"use strict";Object.defineProperty(adt,"__esModule",{value:!0})});var ldt=x(udt=>{"use strict";Object.defineProperty(udt,"__esModule",{value:!0})});var ddt=x(cdt=>{"use strict";Object.defineProperty(cdt,"__esModule",{value:!0})});var pdt=x(fdt=>{"use strict";Object.defineProperty(fdt,"__esModule",{value:!0})});var hdt=x(mdt=>{"use strict";Object.defineProperty(mdt,"__esModule",{value:!0})});var ydt=x(gdt=>{"use strict";Object.defineProperty(gdt,"__esModule",{value:!0})});var _dt=x(bdt=>{"use strict";Object.defineProperty(bdt,"__esModule",{value:!0})});var wdt=x(vdt=>{"use strict";Object.defineProperty(vdt,"__esModule",{value:!0})});var Sdt=x(xdt=>{"use strict";Object.defineProperty(xdt,"__esModule",{value:!0})});var Odt=x(Cdt=>{"use strict";Object.defineProperty(Cdt,"__esModule",{value:!0})});var Pdt=x(Edt=>{"use strict";Object.defineProperty(Edt,"__esModule",{value:!0})});var Adt=x(Tdt=>{"use strict";Object.defineProperty(Tdt,"__esModule",{value:!0})});var Mdt=x(Idt=>{"use strict";Object.defineProperty(Idt,"__esModule",{value:!0})});var Ndt=x(Rdt=>{"use strict";Object.defineProperty(Rdt,"__esModule",{value:!0})});var jdt=x(Mre=>{"use strict";Object.defineProperty(Mre,"__esModule",{value:!0});Mre.FinishReason=void 0;Mre.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var Ldt=x(Ddt=>{"use strict";Object.defineProperty(Ddt,"__esModule",{value:!0})});var kdt=x(Fdt=>{"use strict";Object.defineProperty(Fdt,"__esModule",{value:!0})});var Bdt=x($dt=>{"use strict";Object.defineProperty($dt,"__esModule",{value:!0})});var Udt=x(zdt=>{"use strict";Object.defineProperty(zdt,"__esModule",{value:!0})});var Hdt=x(qdt=>{"use strict";Object.defineProperty(qdt,"__esModule",{value:!0})});var Wdt=x(Vdt=>{"use strict";Object.defineProperty(Vdt,"__esModule",{value:!0})});var Gdt=x(Kdt=>{"use strict";Object.defineProperty(Kdt,"__esModule",{value:!0})});var Zdt=x(Jdt=>{"use strict";Object.defineProperty(Jdt,"__esModule",{value:!0})});var Xdt=x(Ydt=>{"use strict";Object.defineProperty(Ydt,"__esModule",{value:!0})});var eft=x(Qdt=>{"use strict";Object.defineProperty(Qdt,"__esModule",{value:!0})});var rft=x(tft=>{"use strict";Object.defineProperty(tft,"__esModule",{value:!0})});var oft=x(nft=>{"use strict";Object.defineProperty(nft,"__esModule",{value:!0})});var ift=x(Rre=>{"use strict";Object.defineProperty(Rre,"__esModule",{value:!0});Rre.ChatStreamEndEventFinishReason=void 0;Rre.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});var sft=x(aft=>{"use strict";Object.defineProperty(aft,"__esModule",{value:!0})});var lft=x(uft=>{"use strict";Object.defineProperty(uft,"__esModule",{value:!0})});var dft=x(cft=>{"use strict";Object.defineProperty(cft,"__esModule",{value:!0})});var pft=x(fft=>{"use strict";Object.defineProperty(fft,"__esModule",{value:!0})});var hft=x(mft=>{"use strict";Object.defineProperty(mft,"__esModule",{value:!0})});var yft=x(gft=>{"use strict";Object.defineProperty(gft,"__esModule",{value:!0})});var _ft=x(bft=>{"use strict";Object.defineProperty(bft,"__esModule",{value:!0})});var wft=x(vft=>{"use strict";Object.defineProperty(vft,"__esModule",{value:!0})});var Sft=x(xft=>{"use strict";Object.defineProperty(xft,"__esModule",{value:!0})});var Oft=x(Cft=>{"use strict";Object.defineProperty(Cft,"__esModule",{value:!0})});var Pft=x(Eft=>{"use strict";Object.defineProperty(Eft,"__esModule",{value:!0})});var Aft=x(Tft=>{"use strict";Object.defineProperty(Tft,"__esModule",{value:!0})});var Mft=x(Ift=>{"use strict";Object.defineProperty(Ift,"__esModule",{value:!0})});var Nft=x(Rft=>{"use strict";Object.defineProperty(Rft,"__esModule",{value:!0})});var Dft=x(jft=>{"use strict";Object.defineProperty(jft,"__esModule",{value:!0})});var Fft=x(Lft=>{"use strict";Object.defineProperty(Lft,"__esModule",{value:!0})});var $ft=x(kft=>{"use strict";Object.defineProperty(kft,"__esModule",{value:!0})});var zft=x(Bft=>{"use strict";Object.defineProperty(Bft,"__esModule",{value:!0})});var qft=x(Uft=>{"use strict";Object.defineProperty(Uft,"__esModule",{value:!0})});var Vft=x(Hft=>{"use strict";Object.defineProperty(Hft,"__esModule",{value:!0})});var Wft=x(Nre=>{"use strict";Object.defineProperty(Nre,"__esModule",{value:!0});Nre.EmbedInputType=void 0;Nre.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering"}});var Kft=x(jre=>{"use strict";Object.defineProperty(jre,"__esModule",{value:!0});jre.EmbeddingType=void 0;jre.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"}});var Jft=x(Gft=>{"use strict";Object.defineProperty(Gft,"__esModule",{value:!0})});var Yft=x(Zft=>{"use strict";Object.defineProperty(Zft,"__esModule",{value:!0})});var Qft=x(Xft=>{"use strict";Object.defineProperty(Xft,"__esModule",{value:!0})});var ept=x(Dre=>{"use strict";Object.defineProperty(Dre,"__esModule",{value:!0});Dre.EmbedJobStatus=void 0;Dre.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var tpt=x(Lre=>{"use strict";Object.defineProperty(Lre,"__esModule",{value:!0});Lre.EmbedJobTruncate=void 0;Lre.EmbedJobTruncate={Start:"START",End:"END"}});var npt=x(rpt=>{"use strict";Object.defineProperty(rpt,"__esModule",{value:!0})});var ipt=x(opt=>{"use strict";Object.defineProperty(opt,"__esModule",{value:!0})});var spt=x(apt=>{"use strict";Object.defineProperty(apt,"__esModule",{value:!0})});var lpt=x(upt=>{"use strict";Object.defineProperty(upt,"__esModule",{value:!0})});var dpt=x(cpt=>{"use strict";Object.defineProperty(cpt,"__esModule",{value:!0})});var fpt=x(Fre=>{"use strict";Object.defineProperty(Fre,"__esModule",{value:!0});Fre.DatasetValidationStatus=void 0;Fre.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var ppt=x(kre=>{"use strict";Object.defineProperty(kre,"__esModule",{value:!0});kre.DatasetType=void 0;kre.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 hpt=x(mpt=>{"use strict";Object.defineProperty(mpt,"__esModule",{value:!0})});var ypt=x(gpt=>{"use strict";Object.defineProperty(gpt,"__esModule",{value:!0})});var _pt=x(bpt=>{"use strict";Object.defineProperty(bpt,"__esModule",{value:!0})});var wpt=x(vpt=>{"use strict";Object.defineProperty(vpt,"__esModule",{value:!0})});var Spt=x(xpt=>{"use strict";Object.defineProperty(xpt,"__esModule",{value:!0})});var Opt=x(Cpt=>{"use strict";Object.defineProperty(Cpt,"__esModule",{value:!0})});var Ppt=x(Ept=>{"use strict";Object.defineProperty(Ept,"__esModule",{value:!0})});var Apt=x(Tpt=>{"use strict";Object.defineProperty(Tpt,"__esModule",{value:!0})});var Mpt=x(Ipt=>{"use strict";Object.defineProperty(Ipt,"__esModule",{value:!0})});var Npt=x(Rpt=>{"use strict";Object.defineProperty(Rpt,"__esModule",{value:!0})});var Dpt=x(jpt=>{"use strict";Object.defineProperty(jpt,"__esModule",{value:!0})});var Fpt=x(Lpt=>{"use strict";Object.defineProperty(Lpt,"__esModule",{value:!0})});var kpt=x($re=>{"use strict";Object.defineProperty($re,"__esModule",{value:!0});$re.ConnectorAuthStatus=void 0;$re.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var Bpt=x($pt=>{"use strict";Object.defineProperty($pt,"__esModule",{value:!0})});var Upt=x(zpt=>{"use strict";Object.defineProperty(zpt,"__esModule",{value:!0})});var Hpt=x(qpt=>{"use strict";Object.defineProperty(qpt,"__esModule",{value:!0})});var Vpt=x(Bre=>{"use strict";Object.defineProperty(Bre,"__esModule",{value:!0});Bre.AuthTokenType=void 0;Bre.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var Kpt=x(Wpt=>{"use strict";Object.defineProperty(Wpt,"__esModule",{value:!0})});var Jpt=x(Gpt=>{"use strict";Object.defineProperty(Gpt,"__esModule",{value:!0})});var Ypt=x(Zpt=>{"use strict";Object.defineProperty(Zpt,"__esModule",{value:!0})});var Qpt=x(Xpt=>{"use strict";Object.defineProperty(Xpt,"__esModule",{value:!0})});var tmt=x(emt=>{"use strict";Object.defineProperty(emt,"__esModule",{value:!0})});var nmt=x(rmt=>{"use strict";Object.defineProperty(rmt,"__esModule",{value:!0})});var omt=x(zre=>{"use strict";Object.defineProperty(zre,"__esModule",{value:!0});zre.CompatibleEndpoint=void 0;zre.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var amt=x(imt=>{"use strict";Object.defineProperty(imt,"__esModule",{value:!0})});var umt=x(smt=>{"use strict";Object.defineProperty(smt,"__esModule",{value:!0})});var lmt=x(_e=>{"use strict";var lRr=_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]}),Oe=_e&&_e.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&lRr(e,t,r)};Object.defineProperty(_e,"__esModule",{value:!0});Oe(rct(),_e);Oe(nct(),_e);Oe(ict(),_e);Oe(act(),_e);Oe(uct(),_e);Oe(cct(),_e);Oe(fct(),_e);Oe(mct(),_e);Oe(gct(),_e);Oe(yct(),_e);Oe(bct(),_e);Oe(vct(),_e);Oe(wct(),_e);Oe(xct(),_e);Oe(Sct(),_e);Oe(Cct(),_e);Oe(Oct(),_e);Oe(Ect(),_e);Oe(Tct(),_e);Oe(Ict(),_e);Oe(Rct(),_e);Oe(jct(),_e);Oe(Lct(),_e);Oe(Fct(),_e);Oe($ct(),_e);Oe(Bct(),_e);Oe(Uct(),_e);Oe(Hct(),_e);Oe(Vct(),_e);Oe(Wct(),_e);Oe(Kct(),_e);Oe(Jct(),_e);Oe(Yct(),_e);Oe(Qct(),_e);Oe(tdt(),_e);Oe(ndt(),_e);Oe(idt(),_e);Oe(sdt(),_e);Oe(ldt(),_e);Oe(ddt(),_e);Oe(pdt(),_e);Oe(hdt(),_e);Oe(ydt(),_e);Oe(_dt(),_e);Oe(wdt(),_e);Oe(Sdt(),_e);Oe(Odt(),_e);Oe(Pdt(),_e);Oe(Adt(),_e);Oe(Mdt(),_e);Oe(Ndt(),_e);Oe(jdt(),_e);Oe(Ldt(),_e);Oe(kdt(),_e);Oe(Bdt(),_e);Oe(Udt(),_e);Oe(Hdt(),_e);Oe(Wdt(),_e);Oe(Gdt(),_e);Oe(Zdt(),_e);Oe(Xdt(),_e);Oe(eft(),_e);Oe(rft(),_e);Oe(oft(),_e);Oe(ift(),_e);Oe(sft(),_e);Oe(lft(),_e);Oe(dft(),_e);Oe(pft(),_e);Oe(hft(),_e);Oe(yft(),_e);Oe(_ft(),_e);Oe(wft(),_e);Oe(Sft(),_e);Oe(Oft(),_e);Oe(Pft(),_e);Oe(Aft(),_e);Oe(Mft(),_e);Oe(Nft(),_e);Oe(Dft(),_e);Oe(Fft(),_e);Oe($ft(),_e);Oe(zft(),_e);Oe(qft(),_e);Oe(Vft(),_e);Oe(Wft(),_e);Oe(Kft(),_e);Oe(Jft(),_e);Oe(Yft(),_e);Oe(Qft(),_e);Oe(ept(),_e);Oe(tpt(),_e);Oe(npt(),_e);Oe(ipt(),_e);Oe(spt(),_e);Oe(lpt(),_e);Oe(dpt(),_e);Oe(fpt(),_e);Oe(ppt(),_e);Oe(hpt(),_e);Oe(ypt(),_e);Oe(_pt(),_e);Oe(wpt(),_e);Oe(Spt(),_e);Oe(Opt(),_e);Oe(Ppt(),_e);Oe(Apt(),_e);Oe(Mpt(),_e);Oe(Npt(),_e);Oe(Dpt(),_e);Oe(Fpt(),_e);Oe(kpt(),_e);Oe(Bpt(),_e);Oe(Upt(),_e);Oe(Hpt(),_e);Oe(Vpt(),_e);Oe(Kpt(),_e);Oe(Jpt(),_e);Oe(Ypt(),_e);Oe(Qpt(),_e);Oe(tmt(),_e);Oe(nmt(),_e);Oe(omt(),_e);Oe(amt(),_e);Oe(umt(),_e)});var cmt=x(Ure=>{"use strict";Object.defineProperty(Ure,"__esModule",{value:!0});Ure.CohereError=void 0;var QEe=class t extends Error{constructor({message:e,statusCode:r,body:n}){super(cRr({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,t.prototype),r!=null&&(this.statusCode=r),n!==void 0&&(this.body=n)}};Ure.CohereError=QEe;function cRr({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 dmt=x(qre=>{"use strict";Object.defineProperty(qre,"__esModule",{value:!0});qre.CohereTimeoutError=void 0;var ePe=class t extends Error{constructor(){super("Timeout"),Object.setPrototypeOf(this,t.prototype)}};qre.CohereTimeoutError=ePe});var ru=x(Kz=>{"use strict";Object.defineProperty(Kz,"__esModule",{value:!0});Kz.CohereTimeoutError=Kz.CohereError=void 0;var dRr=cmt();Object.defineProperty(Kz,"CohereError",{enumerable:!0,get:function(){return dRr.CohereError}});var fRr=dmt();Object.defineProperty(Kz,"CohereTimeoutError",{enumerable:!0,get:function(){return fRr.CohereTimeoutError}})});var fmt=x(Vv=>{"use strict";var pRr=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]}),mRr=Vv&&Vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hRr=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)&&pRr(e,t,r);return mRr(e,t),e};Object.defineProperty(Vv,"__esModule",{value:!0});Vv.BadRequestError=void 0;var gRr=hRr(ru()),tPe=class t extends gRr.CohereError{constructor(e){super({message:"BadRequestError",statusCode:400,body:e}),Object.setPrototypeOf(this,t.prototype)}};Vv.BadRequestError=tPe});var pmt=x(Wv=>{"use strict";var yRr=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]}),bRr=Wv&&Wv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Rr=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)&&yRr(e,t,r);return bRr(e,t),e};Object.defineProperty(Wv,"__esModule",{value:!0});Wv.UnauthorizedError=void 0;var vRr=_Rr(ru()),rPe=class t extends vRr.CohereError{constructor(e){super({message:"UnauthorizedError",statusCode:401,body:e}),Object.setPrototypeOf(this,t.prototype)}};Wv.UnauthorizedError=rPe});var mmt=x(Kv=>{"use strict";var wRr=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]}),xRr=Kv&&Kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SRr=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)&&wRr(e,t,r);return xRr(e,t),e};Object.defineProperty(Kv,"__esModule",{value:!0});Kv.ForbiddenError=void 0;var CRr=SRr(ru()),nPe=class t extends CRr.CohereError{constructor(e){super({message:"ForbiddenError",statusCode:403,body:e}),Object.setPrototypeOf(this,t.prototype)}};Kv.ForbiddenError=nPe});var hmt=x(Gv=>{"use strict";var ORr=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]}),ERr=Gv&&Gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PRr=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)&&ORr(e,t,r);return ERr(e,t),e};Object.defineProperty(Gv,"__esModule",{value:!0});Gv.NotFoundError=void 0;var TRr=PRr(ru()),oPe=class t extends TRr.CohereError{constructor(e){super({message:"NotFoundError",statusCode:404,body:e}),Object.setPrototypeOf(this,t.prototype)}};Gv.NotFoundError=oPe});var gmt=x(Jv=>{"use strict";var ARr=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]}),IRr=Jv&&Jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MRr=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)&&ARr(e,t,r);return IRr(e,t),e};Object.defineProperty(Jv,"__esModule",{value:!0});Jv.UnprocessableEntityError=void 0;var RRr=MRr(ru()),iPe=class t extends RRr.CohereError{constructor(e){super({message:"UnprocessableEntityError",statusCode:422,body:e}),Object.setPrototypeOf(this,t.prototype)}};Jv.UnprocessableEntityError=iPe});var ymt=x(Zv=>{"use strict";var NRr=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]}),jRr=Zv&&Zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DRr=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)&&NRr(e,t,r);return jRr(e,t),e};Object.defineProperty(Zv,"__esModule",{value:!0});Zv.TooManyRequestsError=void 0;var LRr=DRr(ru()),aPe=class t extends LRr.CohereError{constructor(e){super({message:"TooManyRequestsError",statusCode:429,body:e}),Object.setPrototypeOf(this,t.prototype)}};Zv.TooManyRequestsError=aPe});var bmt=x(Yv=>{"use strict";var FRr=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]}),kRr=Yv&&Yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Rr=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)&&FRr(e,t,r);return kRr(e,t),e};Object.defineProperty(Yv,"__esModule",{value:!0});Yv.ClientClosedRequestError=void 0;var BRr=$Rr(ru()),sPe=class t extends BRr.CohereError{constructor(e){super({message:"ClientClosedRequestError",statusCode:499,body:e}),Object.setPrototypeOf(this,t.prototype)}};Yv.ClientClosedRequestError=sPe});var _mt=x(Xv=>{"use strict";var zRr=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]}),URr=Xv&&Xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qRr=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)&&zRr(e,t,r);return URr(e,t),e};Object.defineProperty(Xv,"__esModule",{value:!0});Xv.InternalServerError=void 0;var HRr=qRr(ru()),uPe=class t extends HRr.CohereError{constructor(e){super({message:"InternalServerError",statusCode:500,body:e}),Object.setPrototypeOf(this,t.prototype)}};Xv.InternalServerError=uPe});var vmt=x(Qv=>{"use strict";var VRr=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]}),WRr=Qv&&Qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KRr=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)&&VRr(e,t,r);return WRr(e,t),e};Object.defineProperty(Qv,"__esModule",{value:!0});Qv.NotImplementedError=void 0;var GRr=KRr(ru()),lPe=class t extends GRr.CohereError{constructor(e){super({message:"NotImplementedError",statusCode:501,body:e}),Object.setPrototypeOf(this,t.prototype)}};Qv.NotImplementedError=lPe});var wmt=x(ew=>{"use strict";var JRr=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]}),ZRr=ew&&ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YRr=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)&&JRr(e,t,r);return ZRr(e,t),e};Object.defineProperty(ew,"__esModule",{value:!0});ew.ServiceUnavailableError=void 0;var XRr=YRr(ru()),cPe=class t extends XRr.CohereError{constructor(e){super({message:"ServiceUnavailableError",statusCode:503,body:e}),Object.setPrototypeOf(this,t.prototype)}};ew.ServiceUnavailableError=cPe});var xmt=x(tw=>{"use strict";var QRr=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]}),e1r=tw&&tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t1r=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)&&QRr(e,t,r);return e1r(e,t),e};Object.defineProperty(tw,"__esModule",{value:!0});tw.GatewayTimeoutError=void 0;var r1r=t1r(ru()),dPe=class t extends r1r.CohereError{constructor(e){super({message:"GatewayTimeoutError",statusCode:504,body:e}),Object.setPrototypeOf(this,t.prototype)}};tw.GatewayTimeoutError=dPe});var Smt=x(Ad=>{"use strict";var n1r=Ad&&Ad.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Vb=Ad&&Ad.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&n1r(e,t,r)};Object.defineProperty(Ad,"__esModule",{value:!0});Vb(fmt(),Ad);Vb(pmt(),Ad);Vb(mmt(),Ad);Vb(hmt(),Ad);Vb(gmt(),Ad);Vb(ymt(),Ad);Vb(bmt(),Ad);Vb(_mt(),Ad);Vb(vmt(),Ad);Vb(wmt(),Ad);Vb(xmt(),Ad)});var Omt=x(Cmt=>{"use strict";Object.defineProperty(Cmt,"__esModule",{value:!0})});var Emt=x(fD=>{"use strict";var o1r=fD&&fD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=fD&&fD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&o1r(e,t,r)};Object.defineProperty(fD,"__esModule",{value:!0});i1r(Omt(),fD)});var HE=x(rw=>{"use strict";var a1r=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]}),Hre=rw&&rw.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&a1r(e,t,r)};Object.defineProperty(rw,"__esModule",{value:!0});Hre(tct(),rw);Hre(lmt(),rw);Hre(Smt(),rw);Hre(Emt(),rw)});var mPe={};ns(mPe,{__addDisposableResource:()=>Kmt,__assign:()=>Vre,__asyncDelegator:()=>$mt,__asyncGenerator:()=>kmt,__asyncValues:()=>Bmt,__await:()=>Gz,__awaiter:()=>Rmt,__classPrivateFieldGet:()=>Hmt,__classPrivateFieldIn:()=>Wmt,__classPrivateFieldSet:()=>Vmt,__createBinding:()=>Kre,__decorate:()=>Amt,__disposeResources:()=>Gmt,__esDecorate:()=>s1r,__exportStar:()=>jmt,__extends:()=>Pmt,__generator:()=>Nmt,__importDefault:()=>qmt,__importStar:()=>Umt,__makeTemplateObject:()=>zmt,__metadata:()=>Mmt,__param:()=>Imt,__propKey:()=>l1r,__read:()=>pPe,__rest:()=>Tmt,__runInitializers:()=>u1r,__setFunctionName:()=>c1r,__spread:()=>Dmt,__spreadArray:()=>Fmt,__spreadArrays:()=>Lmt,__values:()=>Wre,default:()=>p1r});function Pmt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");fPe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Tmt(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 Amt(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 Imt(t,e){return function(r,n){e(r,n,t)}}function s1r(t,e,r,n,o,i){function a(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}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 h={};for(var m in n)h[m]=m==="access"?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(y){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(y||null))};var g=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],h);if(s==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(d=a(g.get))&&(c.get=d),(d=a(g.set))&&(c.set=d),(d=a(g.init))&&o.unshift(d)}else(d=a(g))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function u1r(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 l1r(t){return typeof t=="symbol"?t:"".concat(t)}function c1r(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 Mmt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Rmt(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 Nmt(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 jmt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Kre(e,t,r)}function Wre(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 pPe(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 Dmt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(pPe(arguments[e]));return t}function Lmt(){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 Fmt(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 Gz(t){return this instanceof Gz?(this.v=t,this):new Gz(t)}function kmt(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(h){return Promise.resolve(h).then(p,d)}}function s(p,h){n[p]&&(o[p]=function(m){return new Promise(function(g,y){i.push([p,m,g,y])>1||u(p,m)})},h&&(o[p]=h(o[p])))}function u(p,h){try{l(n[p](h))}catch(m){f(i[0][3],m)}}function l(p){p.value instanceof Gz?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,h){p(h),i.shift(),i.length&&u(i[0][0],i[0][1])}}function $mt(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:Gz(t[o](a)),done:!1}:i?i(a):a}:i}}function Bmt(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 Wre=="function"?Wre(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 zmt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Umt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Kre(e,t,r);return d1r(e,t),e}function qmt(t){return t&&t.__esModule?t:{default:t}}function Hmt(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 Vmt(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 Wmt(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 Kmt(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 Gmt(t){function e(i){t.error=t.hasError?new f1r(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 fPe,Vre,Kre,d1r,f1r,p1r,hPe=b(()=>{fPe=function(t,e){return fPe=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])},fPe(t,e)};Vre=function(){return Vre=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},Vre.apply(this,arguments)};Kre=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};d1r=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};f1r=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};p1r={__extends:Pmt,__assign:Vre,__rest:Tmt,__decorate:Amt,__param:Imt,__metadata:Mmt,__awaiter:Rmt,__generator:Nmt,__createBinding:Kre,__exportStar:jmt,__values:Wre,__read:pPe,__spread:Dmt,__spreadArrays:Lmt,__spreadArray:Fmt,__await:Gz,__asyncGenerator:kmt,__asyncDelegator:$mt,__asyncValues:Bmt,__makeTemplateObject:zmt,__importStar:Umt,__importDefault:qmt,__classPrivateFieldGet:Hmt,__classPrivateFieldSet:Vmt,__classPrivateFieldIn:Wmt,__addDisposableResource:Kmt,__disposeResources:Gmt}});var gPe=x(iy=>{"use strict";Object.defineProperty(iy,"__esModule",{value:!0});iy.MAX_HASHABLE_LENGTH=iy.INIT=iy.KEY=iy.DIGEST_LENGTH=iy.BLOCK_SIZE=void 0;iy.BLOCK_SIZE=64;iy.DIGEST_LENGTH=32;iy.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]);iy.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];iy.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var Jmt=x(Gre=>{"use strict";Object.defineProperty(Gre,"__esModule",{value:!0});Gre.RawSha256=void 0;var ay=gPe(),m1r=function(){function t(){this.state=Int32Array.from(ay.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>ay.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===ay.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%ay.BLOCK_SIZE>=ay.BLOCK_SIZE-8){for(var o=this.bufferLength;o<ay.BLOCK_SIZE;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<ay.BLOCK_SIZE-8;o++)r.setUint8(o,0);r.setUint32(ay.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),r.setUint32(ay.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(ay.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<ay.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],h=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var m=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(m+this.temp[f-16]|0)}var g=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&c)|0)+(d+(ay.KEY[f]+this.temp[f]|0)|0)|0,y=((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+g|0,s=a,a=i,i=o,o=g+y|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}();Gre.RawSha256=m1r});var Xmt=x(($go,Ymt)=>{var Jre=Object.defineProperty,h1r=Object.getOwnPropertyDescriptor,g1r=Object.getOwnPropertyNames,y1r=Object.prototype.hasOwnProperty,b1r=(t,e)=>Jre(t,"name",{value:e,configurable:!0}),_1r=(t,e)=>{for(var r in e)Jre(t,r,{get:e[r],enumerable:!0})},v1r=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of g1r(e))!y1r.call(t,o)&&o!==r&&Jre(t,o,{get:()=>e[o],enumerable:!(n=h1r(e,o))||n.enumerable});return t},w1r=t=>v1r(Jre({},"__esModule",{value:!0}),t),Zmt={};_1r(Zmt,{isArrayBuffer:()=>x1r});Ymt.exports=w1r(Zmt);var x1r=b1r(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var rht=x((Bgo,tht)=>{var Zre=Object.defineProperty,S1r=Object.getOwnPropertyDescriptor,C1r=Object.getOwnPropertyNames,O1r=Object.prototype.hasOwnProperty,Qmt=(t,e)=>Zre(t,"name",{value:e,configurable:!0}),E1r=(t,e)=>{for(var r in e)Zre(t,r,{get:e[r],enumerable:!0})},P1r=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of C1r(e))!O1r.call(t,o)&&o!==r&&Zre(t,o,{get:()=>e[o],enumerable:!(n=S1r(e,o))||n.enumerable});return t},T1r=t=>P1r(Zre({},"__esModule",{value:!0}),t),eht={};E1r(eht,{fromArrayBuffer:()=>I1r,fromString:()=>M1r});tht.exports=T1r(eht);var A1r=Xmt(),yPe=Tm(),I1r=Qmt((t,e=0,r=t.byteLength-e)=>{if(!(0,A1r.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return yPe.Buffer.from(t,e,r)},"fromArrayBuffer"),M1r=Qmt((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?yPe.Buffer.from(t,e):yPe.Buffer.from(t)},"fromString")});var sht=x((zgo,aht)=>{var Yre=Object.defineProperty,R1r=Object.getOwnPropertyDescriptor,N1r=Object.getOwnPropertyNames,j1r=Object.prototype.hasOwnProperty,bPe=(t,e)=>Yre(t,"name",{value:e,configurable:!0}),D1r=(t,e)=>{for(var r in e)Yre(t,r,{get:e[r],enumerable:!0})},L1r=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of N1r(e))!j1r.call(t,o)&&o!==r&&Yre(t,o,{get:()=>e[o],enumerable:!(n=R1r(e,o))||n.enumerable});return t},F1r=t=>L1r(Yre({},"__esModule",{value:!0}),t),nht={};D1r(nht,{fromUtf8:()=>iht,toUint8Array:()=>k1r,toUtf8:()=>$1r});aht.exports=F1r(nht);var oht=rht(),iht=bPe(t=>{let e=(0,oht.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),k1r=bPe(t=>typeof t=="string"?iht(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),$1r=bPe(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,oht.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var uht=x(Xre=>{"use strict";Object.defineProperty(Xre,"__esModule",{value:!0});Xre.convertToBuffer=void 0;var B1r=sht(),z1r=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:B1r.fromUtf8;function U1r(t){return t instanceof Uint8Array?t:typeof t=="string"?z1r(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}Xre.convertToBuffer=U1r});var lht=x(Qre=>{"use strict";Object.defineProperty(Qre,"__esModule",{value:!0});Qre.isEmptyData=void 0;function q1r(t){return typeof t=="string"?t.length===0:t.byteLength===0}Qre.isEmptyData=q1r});var cht=x(ene=>{"use strict";Object.defineProperty(ene,"__esModule",{value:!0});ene.numToUint8=void 0;function H1r(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}ene.numToUint8=H1r});var dht=x(tne=>{"use strict";Object.defineProperty(tne,"__esModule",{value:!0});tne.uint32ArrayFrom=void 0;function V1r(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)}tne.uint32ArrayFrom=V1r});var rne=x(nw=>{"use strict";Object.defineProperty(nw,"__esModule",{value:!0});nw.uint32ArrayFrom=nw.numToUint8=nw.isEmptyData=nw.convertToBuffer=void 0;var W1r=uht();Object.defineProperty(nw,"convertToBuffer",{enumerable:!0,get:function(){return W1r.convertToBuffer}});var K1r=lht();Object.defineProperty(nw,"isEmptyData",{enumerable:!0,get:function(){return K1r.isEmptyData}});var G1r=cht();Object.defineProperty(nw,"numToUint8",{enumerable:!0,get:function(){return G1r.numToUint8}});var J1r=dht();Object.defineProperty(nw,"uint32ArrayFrom",{enumerable:!0,get:function(){return J1r.uint32ArrayFrom}})});var pht=x(ine=>{"use strict";Object.defineProperty(ine,"__esModule",{value:!0});ine.Sha256=void 0;var fht=(hPe(),Mc(mPe)),one=gPe(),nne=Jmt(),_Pe=rne(),Z1r=function(){function t(e){this.secret=e,this.hash=new nne.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,_Pe.isEmptyData)(e)||this.error))try{this.hash.update((0,_Pe.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 fht.__awaiter(this,void 0,void 0,function(){return fht.__generator(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new nne.RawSha256,this.secret){this.outer=new nne.RawSha256;var e=Y1r(this.secret),r=new Uint8Array(one.BLOCK_SIZE);r.set(e);for(var n=0;n<one.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}();ine.Sha256=Z1r;function Y1r(t){var e=(0,_Pe.convertToBuffer)(t);if(e.byteLength>one.BLOCK_SIZE){var r=new nne.RawSha256;r.update(e),e=r.digest()}var n=new Uint8Array(one.BLOCK_SIZE);return n.set(e),n}});var wPe=x(vPe=>{"use strict";Object.defineProperty(vPe,"__esModule",{value:!0});var X1r=(hPe(),Mc(mPe));X1r.__exportStar(pht(),vPe)});var mht=b(()=>{});var hht=b(()=>{});var ght=b(()=>{});var pD,L5=b(()=>{pD=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 uc,yht=b(()=>{L5();uc=class t extends pD{constructor(e,r=!0){super(e,r),this.name="CredentialsProviderError",Object.setPrototypeOf(this,t.prototype)}}});var bht=b(()=>{L5()});var _ht=b(()=>{L5()});var vht=b(()=>{});var wht,xht=b(()=>{wht=(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 VE=b(()=>{yht();L5();bht();_ht();vht();xht()});function ane(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 xPe=b(()=>{});var Sht=b(()=>{});var Cht=b(()=>{Sht()});var Oht=b(()=>{});var Eht,Pht=b(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(Eht||(Eht={}))});var SPe,Tht=b(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(SPe||(SPe={}))});var Aht=b(()=>{});var Iht=b(()=>{});var Mht=b(()=>{});var Rht=b(()=>{});var Nht=b(()=>{Pht();Tht();Aht();Iht();Mht();Rht()});var jht=b(()=>{});var Dht=b(()=>{});var Lht=b(()=>{});var Fht=b(()=>{});var kht=b(()=>{});var $ht=b(()=>{});var Bht=b(()=>{});var zht=b(()=>{kht();$ht();Bht()});var Uht=b(()=>{});var qht=b(()=>{});var Jz,Hht=b(()=>{(function(t){t.HTTP="http",t.HTTPS="https"})(Jz||(Jz={}))});var Vht=b(()=>{});var Wht=b(()=>{});var Kht=b(()=>{});var Ght=b(()=>{});var Jht=b(()=>{});var Zht=b(()=>{Vht();Wht();Kht();Ght();Jht()});var Yht=b(()=>{});var Zz,CPe=b(()=>{(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(Zz||(Zz={}))});var Xht=b(()=>{CPe()});var Qht=b(()=>{});var egt=b(()=>{Xht();Qht();CPe()});var qh,tgt=b(()=>{(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(qh||(qh={}))});var rgt=b(()=>{});var ngt=b(()=>{});var ogt=b(()=>{});var igt=b(()=>{});var agt=b(()=>{});var sgt=b(()=>{ngt();ogt();igt();agt()});var ugt=b(()=>{});var Yz,lgt=b(()=>{Yz="__smithy_context"});var cgt=b(()=>{});var dgt,fgt=b(()=>{(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(dgt||(dgt={}))});var pgt=b(()=>{});var mgt=b(()=>{});var hgt=b(()=>{});var ggt=b(()=>{});var ygt=b(()=>{});var bgt=b(()=>{});var _gt=b(()=>{});var vgt=b(()=>{});var wgt=b(()=>{});var xgt,Sgt=b(()=>{(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(xgt||(xgt={}))});var Cgt=b(()=>{});var Ogt=b(()=>{});var Egt=b(()=>{});var Pgt=b(()=>{});var Tgt=b(()=>{});var Agt=b(()=>{});var vu=b(()=>{Oht();Nht();jht();Dht();Lht();Fht();zht();Uht();qht();Hht();Zht();Yht();egt();tgt();rgt();sgt();ugt();lgt();cgt();fgt();pgt();mgt();hgt();ggt();ygt();bgt();_gt();vgt();wgt();Sgt();Cgt();Ogt();Egt();Pgt();Tgt();Agt()});var Igt=b(()=>{vu()});var Mgt=b(()=>{});var Rgt=b(()=>{});function Q1r(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var sne,Ngt=b(()=>{sne=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=Q1r(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 jgt=b(()=>{});var Dgt=b(()=>{});var Lgt=b(()=>{});var Fgt=b(()=>{Cht();Igt();Mgt();Rgt();Ngt();jgt();Dgt();Lgt()});var eNr,tNr,une,OPe=b(()=>{Fgt();eNr=t=>e=>async r=>{if(!sne.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)},tNr={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},une=t=>({applyToStack:e=>{e.add(eNr(t),tNr)}})});var rNr,nNr,lne,kgt=b(()=>{rNr=()=>(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}},nNr={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},lne=t=>({applyToStack:e=>{e.add(rNr(),nNr)}})});var EPe=b(()=>{kgt()});var $gt=b(()=>{});var Bgt=b(()=>{$gt()});var zgt=b(()=>{vu()});var Ugt=b(()=>{});var qgt=b(()=>{});function oNr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var cne,Hgt=b(()=>{cne=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=oNr(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 Vgt=b(()=>{});var Wgt=b(()=>{});var Kgt=b(()=>{});var Ggt=b(()=>{Bgt();zgt();Ugt();qgt();Hgt();Vgt();Wgt();Kgt()});var Jgt,iNr,aNr,sNr,uNr,dne,PPe=b(()=>{Ggt();Jgt="X-Amzn-Trace-Id",iNr="AWS_LAMBDA_FUNCTION_NAME",aNr="_X_AMZN_TRACE_ID",sNr=t=>e=>async r=>{let{request:n}=r;if(!cne.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(Jgt))return e(r);let o=process.env[iNr],i=process.env[aNr],a=s=>typeof s=="string"&&s.length>0;return a(o)&&a(i)&&(n.headers[Jgt]=i),e({...r,request:n})},uNr={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},dne=t=>({applyToStack:e=>{e.add(sNr(t),uNr)}})});function fne(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}var Zgt=b(()=>{});var lNr,F5,TPe=b(()=>{lNr=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}$"),F5=t=>lNr.test(t)||t.startsWith("[")&&t.endsWith("]")});var cNr,k5,APe=b(()=>{cNr=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),k5=(t,e=!1)=>{if(!e)return cNr.test(t);let r=t.split(".");for(let n of r)if(!k5(n))return!1;return!0}});var WE,pne=b(()=>{WE={}});var KE,Ygt=b(()=>{KE="endpoints"});function sy(t){return typeof t!="object"||t==null?t:"ref"in t?`$${sy(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(sy).join(", ")})`:JSON.stringify(t,null,2)}var Xgt=b(()=>{});var $5=b(()=>{Ygt();Xgt()});var ca,Qgt=b(()=>{ca=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var eyt=b(()=>{});var tyt=b(()=>{});var ryt=b(()=>{});var nyt=b(()=>{});var oyt=b(()=>{});var iyt=b(()=>{});var uy=b(()=>{Qgt();eyt();tyt();ryt();nyt();oyt();iyt()});var ayt,syt=b(()=>{ayt=(t,e)=>t===e});var uyt,lyt=b(()=>{uy();uyt=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 ca(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new ca(`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 mne,cyt=b(()=>{uy();lyt();mne=(t,e)=>uyt(e).reduce((r,n)=>{if(typeof r!="object")throw new ca(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var dyt,fyt=b(()=>{dyt=t=>t!=null});var pyt,myt=b(()=>{pyt=t=>!t});var IPe,hyt,gyt=b(()=>{vu();TPe();IPe={[Jz.HTTP]:80,[Jz.HTTPS]:443},hyt=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:f,port:p,protocol:h="",path:m="",query:g={}}=t,y=new URL(`${h}//${f}${p?`:${p}`:""}${m}`);return y.search=Object.entries(g).map(([_,w])=>`${_}=${w}`).join("&"),y}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(Jz).includes(u))return null;let l=F5(o),c=r.includes(`${n}:${IPe[u]}`)||typeof t=="string"&&t.includes(`${n}:${IPe[u]}`),d=`${n}${c?`:${IPe[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var yyt,byt=b(()=>{yyt=(t,e)=>t===e});var _yt,vyt=b(()=>{_yt=(t,e,r,n)=>e>=r||t.length<r?null:n?t.substring(t.length-r,t.length-e):t.substring(e,r)});var wyt,xyt=b(()=>{wyt=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var MPe=b(()=>{syt();cyt();fyt();APe();myt();gyt();byt();vyt();xyt()});var Syt,Cyt=b(()=>{MPe();Syt={booleanEquals:ayt,getAttr:mne,isSet:dyt,isValidHostLabel:k5,not:pyt,parseURL:hyt,stringEquals:yyt,substring:_yt,uriEncode:wyt}});var hne,RPe=b(()=>{MPe();hne=(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(mne(n[u],l))}else r.push(n[s]);o=a+1}return r.join("")}});var Oyt,Eyt=b(()=>{Oyt=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var NI,B5=b(()=>{uy();NPe();RPe();Eyt();NI=(t,e,r)=>{if(typeof t=="string")return hne(t,r);if(t.fn)return gne(t,r);if(t.ref)return Oyt(t,r);throw new ca(`'${e}': ${String(t)} is not a string, function or reference.`)}});var gne,NPe=b(()=>{pne();Cyt();B5();gne=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:NI(i,"arg",r)),o=t.split(".");return o[0]in WE&&o[1]!=null?WE[o[0]][o[1]](...n):Syt[t](...n)}});var Pyt,Tyt=b(()=>{$5();uy();NPe();Pyt=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new ca(`'${t}' is already defined in Reference Record.`);let n=gne(e,r);return r.logger?.debug?.(`${KE} evaluateCondition: ${sy(e)} = ${sy(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var Xz,yne=b(()=>{$5();Tyt();Xz=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=Pyt(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${KE} assign: ${i.name} := ${sy(i.value)}`))}return{result:!0,referenceRecord:r}}});var Ayt,Iyt=b(()=>{uy();B5();Ayt=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=NI(i,"Header value entry",e);if(typeof a!="string")throw new ca(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var jPe,Myt=b(()=>{uy();RPe();DPe();jPe=(t,e)=>{if(Array.isArray(t))return t.map(r=>jPe(r,e));switch(typeof t){case"string":return hne(t,e);case"object":if(t===null)throw new ca(`Unexpected endpoint property: ${t}`);return bne(t,e);case"boolean":return t;default:throw new ca(`Unexpected endpoint property type: ${typeof t}`)}}});var bne,DPe=b(()=>{Myt();bne=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:jPe(o,e)}),{})});var Ryt,Nyt=b(()=>{uy();B5();Ryt=(t,e)=>{let r=NI(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 ca(`Endpoint URL must be a string, got ${typeof r}`)}});var jyt,Dyt=b(()=>{$5();yne();Iyt();DPe();Nyt();jyt=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=Xz(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${KE} Resolving endpoint from template: ${sy(n)}`),{...l!=null&&{headers:Ayt(l,a)},...u!=null&&{properties:bne(u,a)},url:Ryt(s,a)}}});var Lyt,Fyt=b(()=>{uy();yne();B5();Lyt=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=Xz(r,e);if(o)throw new ca(NI(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var kyt,$yt=b(()=>{yne();LPe();kyt=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=Xz(r,e);if(o)return _ne(n,{...e,referenceRecord:{...e.referenceRecord,...i}})}});var _ne,LPe=b(()=>{uy();Dyt();Fyt();$yt();_ne=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=jyt(r,e);if(n)return n}else if(r.type==="error")Lyt(r,e);else if(r.type==="tree"){let n=kyt(r,e);if(n)return n}else throw new ca(`Unknown endpoint rule: ${r}`);throw new ca("Rules evaluation failed")}});var Byt=b(()=>{pne();LPe()});var z5,zyt=b(()=>{$5();uy();Byt();z5=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${KE} Initial EndpointParams: ${sy(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 ca(`Missing required parameter: '${l}'`);let u=_ne(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?.(`${KE} Resolved endpoint: ${sy(u)}`),u}});var jI=b(()=>{TPe();APe();pne();zyt();uy()});var FPe=b(()=>{jI()});var kPe,Uyt=b(()=>{jI();FPe();kPe=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!kPe(r))return!1;return!0}return!(!k5(t)||t.length<3||t.length>63||t!==t.toLowerCase()||F5(t))}});var qyt,dNr,Hyt,Vyt=b(()=>{qyt=":",dNr="/",Hyt=t=>{let e=t.split(qyt);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join(qyt)==="")return null;let u=s.map(l=>l.split(dNr)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var Kyt,Wyt=b(()=>{Kyt={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 pNr,mNr,Gyt,Jyt,$Pe=b(()=>{Wyt();pNr=Kyt,mNr="",Gyt=t=>{let{partitions:e}=pNr;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}},Jyt=()=>mNr});var U5,Zyt=b(()=>{jI();Uyt();Vyt();$Pe();U5={isVirtualHostableS3Bucket:kPe,parseArn:Hyt,partition:Gyt};WE.aws=U5});var Yyt=b(()=>{jI()});var Xyt=b(()=>{jI()});var Qyt=b(()=>{});var ebt=b(()=>{});var tbt=b(()=>{});var rbt=b(()=>{});var nbt=b(()=>{});var obt=b(()=>{Xyt();Qyt();ebt();tbt();rbt();nbt()});var vne=b(()=>{Zyt();$Pe();FPe();Yyt();obt()});var ibt=b(()=>{});var abt=b(()=>{ibt()});var sbt=b(()=>{vu()});var ubt=b(()=>{});var lbt=b(()=>{});function hNr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var wne,cbt=b(()=>{wne=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=hNr(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 dbt=b(()=>{});var fbt=b(()=>{});var pbt=b(()=>{});var mbt=b(()=>{abt();sbt();ubt();lbt();cbt();dbt();fbt();pbt()});var BPe,xne,zPe,Sne,hbt,gbt,UPe,ybt=b(()=>{BPe="user-agent",xne="x-amz-user-agent",zPe=" ",Sne="/",hbt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,gbt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,UPe="-"});var gNr,qPe,yNr,Cne,bbt=b(()=>{vne();mbt();ybt();gNr=t=>(e,r)=>async n=>{let{request:o}=n;if(!wne.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map(qPe)||[],s=(await t.defaultUserAgentProvider()).map(qPe),u=t?.customUserAgent?.map(qPe)||[],l=Jyt(),c=(l?[l]:[]).concat([...s,...a,...u]).join(zPe),d=[...s.filter(f=>f.startsWith("aws-sdk-")),...u].join(zPe);return t.runtime!=="browser"?(d&&(i[xne]=i[xne]?`${i[BPe]} ${d}`:d),i[BPe]=c):i[xne]=c,e({...n,request:o})},qPe=t=>{let e=t[0].split(Sne).map(a=>a.replace(hbt,UPe)).join(Sne),r=t[1]?.replace(gbt,UPe),n=e.indexOf(Sne),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}`}},"")},yNr={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Cne=t=>({applyToStack:e=>{e.add(gNr(t),yNr)}})});var HPe=b(()=>{Zgt();bbt()});var _bt=b(()=>{});var vbt=b(()=>{});var One,wbt=b(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(One||(One={}))});var VPe=b(()=>{_bt();vbt();wbt()});var Ene,xbt=b(()=>{VPe();Ene=!1});var Pne,Sbt=b(()=>{VPe();Pne=!1});var ow,Cbt=b(()=>{vu();ow=t=>t[Yz]||(t[Yz]={})});var kf,Obt=b(()=>{kf=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var Wb=b(()=>{Cbt();Obt()});var Ebt=b(()=>{Wb()});var Pbt=b(()=>{});var Tbt=b(()=>{Wb();Pbt()});var Abt=b(()=>{xbt();Sbt();Ebt();Tbt()});var Ibt=b(()=>{});var Tne,WPe=b(()=>{Tne=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var KPe,Mbt=b(()=>{WPe();KPe=t=>Tne(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var Ane,Rbt=b(()=>{Mbt();WPe();Ane=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return KPe(e);let n=await e();return KPe(n)},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return Tne(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}}});var Nbt=b(()=>{Ibt();Rbt()});var jbt=b(()=>{});var Dbt=b(()=>{});var Lbt=b(()=>{});var Fbt=b(()=>{});var kbt=b(()=>{});var $bt=b(()=>{});var Bbt=b(()=>{Lbt();Fbt();kbt();$bt()});var zbt=b(()=>{jbt();Dbt();Bbt()});var q5=b(()=>{Abt();Nbt();zbt()});function _Nr(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var GPe,Ine=b(()=>{vu();Wb();GPe=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=_Nr(t.httpAuthSchemes),s=ow(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 Ubt,vNr,wNr,xNr,SNr,CNr,qbt=b(()=>{Ubt=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),CNr(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!SNr(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},vNr=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,wNr=/(\d+\.){3}\d+/,xNr=/\.\./,SNr=t=>vNr.test(t)&&!wNr.test(t)&&!xNr.test(t),CNr=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 Hbt=b(()=>{qbt()});var Vbt,Wbt=b(()=>{Vbt=(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 Kbt,Gbt=b(()=>{Kbt=async t=>{}});function Jbt(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 Zbt=b(()=>{});var DI,Mne=b(()=>{Zbt();DI=t=>{if(typeof t=="string")return DI(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=Jbt(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var Rne,Nne=b(()=>{Mne();Rne=t=>typeof t=="object"?"url"in t?DI(t.url):t:DI(t)});var Ybt,ONr,JPe=b(()=>{Hbt();Wbt();Gbt();Nne();Ybt=async(t,e,r,n)=>{if(!r.endpoint){let a=await Kbt(r.serviceId||"");a&&(r.endpoint=()=>Promise.resolve(Rne(a)))}let o=await ONr(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},ONr=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 Vbt(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 Ubt(n),n}});var Xbt=b(()=>{JPe();Nne()});var Qbt,ZPe=b(()=>{Wb();JPe();Qbt=({config:t,instructions:e})=>(r,n)=>async o=>{let i=await Ybt(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=ow(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 e_t,YPe=b(()=>{e_t=(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 t_t,XPe=b(()=>{t_t=(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 Bt(t,e,r){return{applyToStack:n=>{n.add(e_t(t,r),ENr),n.add(t_t(t,e),H5)}}}var ENr,H5,r_t=b(()=>{YPe();XPe();ENr={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},H5={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var wo=b(()=>{YPe();r_t();XPe()});var QPe,zt,n_t=b(()=>{wo();ZPe();QPe={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:H5.name},zt=(t,e)=>({applyToStack:r=>{r.addRelativeTo(Qbt({config:t,instructions:e}),QPe)}})});var jne,o_t=b(()=>{Wb();Nne();jne=t=>{let e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>Rne(await kf(r)()):void 0;return{...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:kf(t.useDualstackEndpoint??!1),useFipsEndpoint:kf(t.useFipsEndpoint??!1)}}});var i_t=b(()=>{});var lo=b(()=>{Xbt();ZPe();n_t();o_t();i_t()});var PNr,Dne,a_t=b(()=>{lo();Ine();PNr={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:QPe.name},Dne=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(GPe(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),PNr)}})});var SSo,s_t=b(()=>{wo();Ine();SSo={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:H5.name}});var u_t=b(()=>{Ine();a_t();s_t()});var l_t=b(()=>{});var c_t=b(()=>{l_t()});var d_t=b(()=>{vu()});var f_t=b(()=>{});var p_t=b(()=>{});function TNr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var mD,m_t=b(()=>{mD=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=TNr(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 h_t=b(()=>{});var g_t=b(()=>{});var y_t=b(()=>{});var V5=b(()=>{c_t();d_t();f_t();p_t();m_t();h_t();g_t();y_t()});var ANr,INr,b_t,eTe=b(()=>{V5();vu();Wb();ANr=t=>e=>{throw e},INr=(t,e)=>{},b_t=t=>(e,r)=>async n=>{if(!mD.isInstance(n.request))return e(n);let i=ow(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||ANr)(a));return(u.successHandler||INr)(l.response,a),l}});var Kb,iw,W5,Lne=b(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(Kb||(Kb={}));iw=3,W5=Kb.STANDARD});var __t,v_t,w_t,x_t,S_t=b(()=>{__t=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],v_t=["TimeoutError","RequestTimeout","RequestTimeoutException"],w_t=[500,502,503,504],x_t=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"]});var MNr,Qz,Fne,C_t,K5=b(()=>{S_t();MNr=t=>t.$metadata?.clockSkewCorrected,Qz=t=>t.$metadata?.httpStatusCode===429||__t.includes(t.name)||t.$retryable?.throttling==!0,Fne=t=>MNr(t)||v_t.includes(t.name)||x_t.includes(t?.code||"")||w_t.includes(t.$metadata?.httpStatusCode||0),C_t=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!Fne(t)}return!1}});var G5,tTe=b(()=>{K5();G5=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(),Qz(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 kne,$ne,eU=b(()=>{kne="amz-sdk-invocation-id",$ne="amz-sdk-request"});var O_t,E_t=b(()=>{eU();O_t=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var rTe,P_t=b(()=>{eU();rTe=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var hD,zne=b(()=>{Lne();eU();E_t();P_t();hD=class{constructor(e){this.maxAttempts=e,this.mode=Kb.STANDARD,this.capacity=500,this.retryBackoffStrategy=O_t(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return rTe({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,rTe({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 ${iw}`),iw}}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 Une,R_t=b(()=>{Lne();tTe();zne();Une=class{constructor(e,r){this.maxAttemptsProvider=e,this.mode=Kb.ADAPTIVE;let{rateLimiter:n}=r??{};this.rateLimiter=n??new G5,this.standardRetryStrategy=new hD(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 N_t=b(()=>{eU();zne()});var j_t=b(()=>{});var aw=b(()=>{R_t();N_t();tTe();zne();Lne();eU();j_t()});var D_t=b(()=>{});var L_t=b(()=>{D_t()});var F_t=b(()=>{vu()});var k_t=b(()=>{});var $_t=b(()=>{});function RNr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var rU,B_t=b(()=>{rU=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=RNr(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 J5,z_t=b(()=>{J5=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 U_t=b(()=>{});var q_t=b(()=>{});var qne=b(()=>{L_t();F_t();k_t();$_t();B_t();z_t();U_t();q_t()});var H_t=b(()=>{aw()});var oTe=b(()=>{aw()});var iTe=b(()=>{K5()});var aTe,sTe=b(()=>{aTe=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 uTe=b(()=>{qne();K5();aw();H_t();oTe();iTe();sTe()});var V_t=b(()=>{aw();uTe()});var Hne,W_t=b(()=>{Wb();aw();Hne=t=>{let{retryStrategy:e}=t,r=kf(t.maxAttempts??iw);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await kf(t.retryMode)()===Kb.ADAPTIVE?new Une(r):new hD(r))}}});var K_t=b(()=>{qne();aw()});var LI,G_t=b(()=>{LI=class{trace(){}debug(){}info(){}warn(){}error(){}}});var gD,FI,nU,J_t,Z_t,Y_t=b(()=>{gD=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},FI=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,nU=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>J_t[p.step]-J_t[f.step]||Z_t[p.priority||"normal"]-Z_t[f.priority||"normal"]),i=d=>{let f=!1,p=h=>{let m=gD(h.name,h.aliases);if(m.includes(d)){f=!0;for(let g of m)n.delete(g);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},a=d=>{let f=!1,p=h=>{if(h.middleware===d){f=!0;for(let m of gD(h.name,h.aliases))n.delete(m);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=[],h={};return t.forEach(g=>{let y={...g,before:[],after:[]};for(let _ of gD(y.name,y.aliases))h[_]=y;f.push(y)}),e.forEach(g=>{let y={...g,before:[],after:[]};for(let _ of gD(y.name,y.aliases))h[_]=y;p.push(y)}),p.forEach(g=>{if(g.toMiddleware){let y=h[g.toMiddleware];if(y===void 0){if(d)return;throw new Error(`${g.toMiddleware} is not found when adding ${FI(g.name,g.aliases)} middleware ${g.relation} ${g.toMiddleware}`)}g.relation==="after"&&y.after.push(g),g.relation==="before"&&y.before.push(g)}}),o(f).map(u).reduce((g,y)=>(g.push(...y),g),[])},c={add:(d,f={})=>{let{name:p,override:h,aliases:m}=f,g={step:"initialize",priority:"normal",middleware:d,...f},y=gD(p,m);if(y.length>0){if(y.some(_=>n.has(_))){if(!h)throw new Error(`Duplicate middleware name '${FI(p,m)}'`);for(let _ of y){let w=t.findIndex(C=>C.name===_||C.aliases?.some(E=>E===_));if(w===-1)continue;let S=t[w];if(S.step!==g.step||g.priority!==S.priority)throw new Error(`"${FI(S.name,S.aliases)}" middleware with ${S.priority} priority in ${S.step} step cannot be overridden by "${FI(p,m)}" middleware with ${g.priority} priority in ${g.step} step.`);t.splice(w,1)}}for(let _ of y)n.add(_)}t.push(g)},addRelativeTo:(d,f)=>{let{name:p,override:h,aliases:m}=f,g={middleware:d,...f},y=gD(p,m);if(y.length>0){if(y.some(_=>n.has(_))){if(!h)throw new Error(`Duplicate middleware name '${FI(p,m)}'`);for(let _ of y){let w=e.findIndex(C=>C.name===_||C.aliases?.some(E=>E===_));if(w===-1)continue;let S=e[w];if(S.toMiddleware!==g.toMiddleware||S.relation!==g.relation)throw new Error(`"${FI(S.name,S.aliases)}" middleware ${S.relation} "${S.toMiddleware}" middleware cannot be overridden by "${FI(p,m)}" middleware ${g.relation} "${g.toMiddleware}" middleware.`);e.splice(w,1)}}for(let _ of y)n.add(_)}e.push(g)},clone:()=>s(nU()),use:d=>{d.applyToStack(c)},remove:d=>typeof d=="string"?i(d):a(d),removeByTag:d=>{let f=!1,p=h=>{let{tags:m,name:g,aliases:y}=h;if(m&&m.includes(d)){let _=gD(g,y);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(nU());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 FI(d.name,d.aliases)+" - "+f}),identifyOnResolve(d){return typeof d=="boolean"&&(r=d),r},resolve:(d,f)=>{for(let p of l().map(h=>h.middleware).reverse())d=p(d,f);return r&&console.log(c.identify()),d}};return c},J_t={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},Z_t={high:3,normal:2,low:1}});var lTe=b(()=>{Y_t()});var yD,X_t=b(()=>{lTe();yD=class{constructor(e){this.middlewareStack=nU(),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 GE,bD,kI,_D,Q_t,cTe=b(()=>{GE={},bD=new Array(64);for(let t=0,e=65,r=90;t+e<=r;t++){let n=String.fromCharCode(t+e);GE[n]=t,bD[t]=n}for(let t=0,e=97,r=122;t+e<=r;t++){let n=String.fromCharCode(t+e),o=t+26;GE[n]=o,bD[o]=n}for(let t=0;t<10;t++){GE[t.toString(10)]=t+52;let e=t.toString(10),r=t+52;GE[e]=r,bD[r]=e}GE["+"]=62;bD[62]="+";GE["/"]=63;bD[63]="/";kI=6,_D=8,Q_t=63});var $I,evt=b(()=>{cTe();$I=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 GE))throw new TypeError(`Invalid character ${t[l]} in base64 string.`);i|=GE[t[l]]<<(c-l)*kI,a+=kI}else i>>=kI;let s=o/4*3;i>>=a%_D;let u=Math.floor(a/_D);for(let l=0;l<u;l++){let c=(u-l-1)*_D;n.setUint8(s+l,(i&255<<c)>>c)}}return new Uint8Array(r)}});var dTe,fTe=b(()=>{dTe=t=>new TextEncoder().encode(t)});var tvt=b(()=>{fTe()});var rvt=b(()=>{});var nvt=b(()=>{fTe();tvt();rvt()});function BI(t){let e;typeof t=="string"?e=dTe(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)*_D,s+=_D;let u=Math.ceil(s/kI);a<<=u*kI-s;for(let l=1;l<=u;l++){let c=(u-l)*kI;o+=bD[(a&Q_t<<c)>>c]}o+="==".slice(0,4-u)}return o}var ovt=b(()=>{nvt();cTe()});var oU=b(()=>{evt();ovt()});var pTe,mTe=b(()=>{pTe=t=>new TextEncoder().encode(t)});var ivt=b(()=>{mTe()});var Vne,avt=b(()=>{Vne=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 hTe=b(()=>{mTe();ivt();avt()});function svt(t,e="utf-8"){return e==="base64"?BI(t):Vne(t)}function uvt(t,e){return e==="base64"?JE.mutate($I(t)):JE.mutate(pTe(t))}var lvt=b(()=>{oU();hTe();gTe()});var JE,gTe=b(()=>{lvt();JE=class t extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return uvt(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 svt(this,e)}}});var cvt=b(()=>{});var dvt=b(()=>{});var fvt=b(()=>{dvt()});var pvt=b(()=>{vu()});var mvt=b(()=>{});var hvt=b(()=>{});var gvt=b(()=>{});var Z5,yvt=b(()=>{Z5=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 bvt=b(()=>{});var _vt=b(()=>{});var vvt=b(()=>{fvt();pvt();mvt();hvt();gvt();yvt();bvt();_vt()});var ly,NNr,yTe=b(()=>{ly=t=>encodeURIComponent(t).replace(/[!'()*]/g,NNr),NNr=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var wvt=b(()=>{yTe()});var Wne=b(()=>{yTe();wvt()});function xvt(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=ly(r),Array.isArray(n))for(let o=0,i=n.length;o<i;o++)e.push(`${r}=${ly(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${ly(n)}`),e.push(o)}}return e.join("&")}var Svt=b(()=>{Wne()});function Cvt(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 Ovt=b(()=>{});var bTe,zI,Evt=b(()=>{vvt();Svt();Ovt();bTe={supported:void 0},zI=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)),bTe.supported===void 0&&(bTe.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 y=new Error("Request aborted");return y.name="AbortError",Promise.reject(y)}let a=e.path,s=xvt(e.query||{});s&&(a+=`?${s}`),e.fragment&&(a+=`#${e.fragment}`);let u="";if(e.username!=null||e.password!=null){let y=e.username??"",_=e.password??"";u=`${y}:${_}@`}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),bTe.supported&&(p.keepalive=o);let h=()=>{},m=new Request(d,p),g=[fetch(m).then(y=>{let _=y.headers,w={};for(let C of _.entries())w[C[0]]=C[1];return y.body!=null?{response:new Z5({headers:w,reason:y.statusText,statusCode:y.status,body:y.body})}:y.blob().then(C=>({response:new Z5({headers:w,reason:y.statusText,statusCode:y.status,body:C})}))}),Cvt(n)];return r&&g.push(new Promise((y,_)=>{let w=()=>{let S=new Error("Request aborted");S.name="AbortError",_(S)};if(typeof r.addEventListener=="function"){let S=r;S.addEventListener("abort",w,{once:!0}),h=()=>S.removeEventListener("abort",w)}else r.onabort=w})),Promise.race(g).finally(h)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}});async function jNr(t){let e=await LNr(t),r=$I(e);return new Uint8Array(r)}async function DNr(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 LNr(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 iU,Pvt=b(()=>{oU();iU=t=>typeof Blob=="function"&&t instanceof Blob?jNr(t):DNr(t)});var Y5=b(()=>{Evt();Pvt()});function Avt(t){let e="";for(let r=0;r<t.byteLength;r++)e+=Tvt[t[r]];return e}var Tvt,FNr,Ivt=b(()=>{Tvt={},FNr={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Tvt[t]=e,FNr[e]=t}});var _Te,vTe=b(()=>{_Te=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var Mvt,Nvt,Rvt,jvt=b(()=>{Y5();oU();Ivt();hTe();vTe();Mvt="The stream has already been transformed.",Nvt=t=>{if(!Rvt(t)&&!_Te(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(Mvt);return e=!0,await iU(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 BI(i);if(o==="hex")return Avt(i);if(o===void 0||o==="utf8"||o==="utf-8")return Vne(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(Mvt);if(e=!0,Rvt(t))return n(t);if(_Te(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},Rvt=t=>typeof Blob=="function"&&t instanceof Blob});var Dvt=b(()=>{});var Lvt=b(()=>{});var wTe=b(()=>{gTe();cvt();jvt();Dvt();Lvt();vTe()});var UI,Fvt=b(()=>{wTe();UI=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return JE.mutate(t);if(!t)return JE.mutate(new Uint8Array);let r=e.streamCollector(t);return JE.mutate(await r)}});var Mt,xTe,kvt=b(()=>{lTe();vu();Mt=class{constructor(){this.middlewareStack=nU()}static classBuilder(){return new xTe}resolveMiddlewareWithContext(e,r,n,{middlewareFn:o,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,smithyContext:l,additionalContext:c,CommandCtor:d}){for(let g of o.bind(this)(d,e,r,n))this.middlewareStack.use(g);let f=e.concat(this.middlewareStack),{logger:p}=r,h={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,[Yz]:{commandInstance:this,...l},...c},{requestHandler:m}=r;return f.resolve(g=>m.handle(g.request,n||{}),h)}},xTe=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 Mt{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 Kne,$vt=b(()=>{Kne="***SensitiveInformation***"});var Gne,Bvt=b(()=>{Gne=(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 vD,kNr,zvt,$Nr,Uvt,qvt,Hvt,STe,BNr,aU,In,Vvt,Wvt,zNr,X5,Q5,CTe,Kvt,Gvt,Jvt,OTe=b(()=>{vD=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&Jvt.warn(Gvt(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},kNr=Math.ceil(34028234663852886e22),zvt=t=>{let e=vD(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>kNr)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},$Nr=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},Uvt=t=>STe(t,32),qvt=t=>STe(t,16),Hvt=t=>STe(t,8),STe=(t,e)=>{let r=$Nr(t);if(r!==void 0&&BNr(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},BNr=(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]}},aU=(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},In=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return Jvt.warn(Gvt(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},Vvt=t=>vD(typeof t=="string"?X5(t):t),Wvt=t=>zvt(typeof t=="string"?X5(t):t),zNr=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,X5=t=>{let e=t.match(zNr);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},Q5=t=>Uvt(typeof t=="string"?X5(t):t),CTe=t=>qvt(typeof t=="string"?X5(t):t),Kvt=t=>Hvt(typeof t=="string"?X5(t):t),Gvt=t=>String(new TypeError(t).stack||t).split(`
`).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
`),Jvt={warn:console.warn}});var UNr,qNr,Zvt,HNr,Yvt,yPo,bPo,_Po,Jne,Xvt,vPo,VNr,WNr,KNr,wD,GNr,JNr,ETe,Qvt=b(()=>{OTe();UNr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],qNr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),Zvt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=qNr.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=CTe(ETe(n)),d=wD(o,"month",1,12),f=wD(i,"day",1,31);return Xvt(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},HNr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),Yvt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=HNr.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=CTe(ETe(n)),f=wD(o,"month",1,12),p=wD(i,"day",1,31),h=Xvt(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&h.setTime(h.getTime()-JNr(c)),h},yPo=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$/),bPo=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$/),_Po=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})$/),Jne=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=Vvt(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))},Xvt=(t,e,r,n)=>{let o=e-1;return WNr(t,o,r),new Date(Date.UTC(t,o,r,wD(n.hours,"hour",0,23),wD(n.minutes,"minute",0,59),wD(n.seconds,"seconds",0,60),GNr(n.fractionalMilliseconds)))},vPo=50*365*24*60*60*1e3,VNr=[31,28,31,30,31,30,31,31,30,31,30,31],WNr=(t,e,r)=>{let n=VNr[e];if(e===1&&KNr(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${UNr[e]} in ${t}: ${r}`)},KNr=t=>t%4===0&&(t%100!==0||t%400===0),wD=(t,e,r,n)=>{let o=Kvt(ETe(t));if(o<r||o>n)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},GNr=t=>t==null?0:Wvt("0."+t)*1e3,JNr=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},ETe=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var sU,ls,PTe=b(()=>{sU=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}},ls=(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 ZNr,Zne,YNr,ewt=b(()=>{PTe();ZNr=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{let o=YNr(t),i=o.httpStatusCode?o.httpStatusCode+"":void 0,a=new r({name:e?.code||e?.Code||n||i||"UnknownError",$fault:"client",$metadata:o});throw ls(a,e)},Zne=t=>({output:e,parsedBody:r,errorCode:n})=>{ZNr({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},YNr=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 Yne,twt=b(()=>{Yne=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 rwt=b(()=>{});var nwt,owt,iwt=b(()=>{vu();nwt=t=>{let e=[];for(let r in Zz){let n=Zz[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}}},owt=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var awt,swt,uwt=b(()=>{awt=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},swt=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var Xne,Qne,lwt=b(()=>{iwt();uwt();Xne=t=>({...nwt(t),...awt(t)}),Qne=t=>({...owt(t),...swt(t)})});var cwt=b(()=>{lwt()});function eoe(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var TTe=b(()=>{});var dwt=b(()=>{});var ATe,fwt=b(()=>{ATe=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]=ATe(t[r]));return t}});var ITe,pwt=b(()=>{ITe=function(){let t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};ITe.prototype=Object.create(String.prototype,{constructor:{value:ITe,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(ITe,String)});var eW,XNr,QNr,ejr,mwt=b(()=>{eW=(t,e)=>{let r={};for(let n in e)XNr(r,t,e,n);return r},XNr=(t,e,r,n)=>{if(e!==null){let a=r[n];typeof a=="function"&&(a=[,a]);let[s=QNr,u=ejr,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)}},QNr=t=>t!=null,ejr=t=>t});var hwt=b(()=>{TTe()});var gwt=b(()=>{});var hr,ywt=b(()=>{hr=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(hr);if(typeof t=="object"){let e={};for(let r of Object.keys(t))t[r]!=null&&(e[r]=hr(t[r]));return e}return t}});var bwt=b(()=>{});var gr=b(()=>{G_t();X_t();Fvt();kvt();$vt();Bvt();Qvt();ewt();twt();rwt();cwt();PTe();TTe();dwt();fwt();pwt();mwt();OTe();hwt();gwt();ywt();bwt()});var _wt,vwt=b(()=>{_wt=t=>t?.body instanceof ReadableStream});var tjr,rjr,njr,ojr,MTe,toe,ijr,wwt=b(()=>{qne();K5();gr();aw();LN();vwt();sTe();tjr=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(rjr(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=rU.isInstance(c);for(d&&(c.headers[kne]=lm());;)try{d&&(c.headers[$ne]=`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=njr(f);if(s=aTe(f),d&&_wt(c))throw(r.logger instanceof LI?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 h=a.getRetryDelay();l+=h,await new Promise(m=>setTimeout(m,h))}}else return o=o,o?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",o.mode]]),o.retry(e,n)},rjr=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",njr=t=>{let e={error:t,errorType:ojr(t)},r=ijr(t.$response);return r&&(e.retryAfterHint=r),e},ojr=t=>Qz(t)?"THROTTLING":Fne(t)?"TRANSIENT":C_t(t)?"SERVER_ERROR":"CLIENT_ERROR",MTe={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},toe=t=>({applyToStack:e=>{e.add(tjr(t),MTe)}}),ijr=t=>{if(!J5.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 roe=b(()=>{V_t();uTe();W_t();oTe();K_t();iTe();wwt()});var ajr,noe,xwt=b(()=>{roe();eTe();ajr={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:MTe.name},noe=t=>({applyToStack:e=>{e.addRelativeTo(b_t(t),ajr)}})});var Swt=b(()=>{eTe();xwt()});var uU,Cwt=b(()=>{uU=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 Owt=b(()=>{V5();vu()});var Ewt=b(()=>{V5()});var lU,Pwt=b(()=>{lU=class{async sign(e,r,n){return e}}});var Twt=b(()=>{Owt();Ewt();Pwt()});var sjr,Awt,RTe,Iwt,Mwt=b(()=>{sjr=t=>e=>RTe(e)&&e.expiration.getTime()-Date.now()<t,Awt=sjr(3e5),RTe=t=>t.expiration!==void 0,Iwt=(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 Rwt=b(()=>{Cwt();Twt();Mwt()});var Nwt=b(()=>{vu()});var cU,jwt=b(()=>{cU=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var Dwt=b(()=>{V5();gr()});function NTe(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 ujr(e,a.client,s,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield d;let f=l;l=ljr(d,n),c=!!(l&&(!a.stopOnSameToken||l!==f))}return void 0}}var ujr,ljr,Lwt=b(()=>{ujr=async(t,e,r,...n)=>await e.send(new t(r),...n);ljr=(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 qI=b(()=>{u_t();Swt();Rwt();Nwt();jwt();Dwt();Lwt()});var Fwt=b(()=>{});var kwt=b(()=>{Fwt()});var $wt=b(()=>{vu()});var Bwt=b(()=>{});var zwt=b(()=>{});function cjr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var ooe,Uwt=b(()=>{ooe=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=cjr(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 qwt=b(()=>{});var Hwt=b(()=>{});var Vwt=b(()=>{});var Wwt=b(()=>{kwt();$wt();Bwt();zwt();Uwt();qwt();Hwt();Vwt()});function djr(t){return e=>async r=>{let n=r.request;if(ooe.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(Kwt)===-1)try{let a=t(o);n.headers={...n.headers,[Kwt]:String(a)}}catch{}}return e({...r,request:n})}}var Kwt,fjr,ioe,jTe=b(()=>{Wwt();Kwt="content-length";fjr={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},ioe=t=>({applyToStack:e=>{e.add(djr(t.bodyLengthChecker),fjr)}})});var Gwt=b(()=>{});var Jwt=b(()=>{Gwt()});var Zwt=b(()=>{});var Ywt=b(()=>{Zwt()});var Xwt=b(()=>{vu()});var Qwt=b(()=>{});var e0t=b(()=>{});function pjr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var HI,t0t=b(()=>{HI=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=pjr(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 aoe,r0t=b(()=>{aoe=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 n0t=b(()=>{});var o0t=b(()=>{});var tW=b(()=>{Ywt();Xwt();Qwt();e0t();t0t();r0t();n0t();o0t()});var DTe,i0t=b(()=>{tW();DTe=t=>aoe.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var soe,LTe=b(()=>{soe=t=>new Date(Date.now()+t)});var a0t,s0t=b(()=>{LTe();a0t=(t,e)=>Math.abs(soe(e).getTime()-t)>=3e5});var FTe,u0t=b(()=>{s0t();FTe=(t,e)=>{let r=Date.parse(t);return a0t(r,e)?r-Date.now():e}});var l0t=b(()=>{i0t();LTe();u0t()});var rW,c0t,xD,d0t=b(()=>{tW();l0t();rW=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},c0t=async t=>{let e=rW("context",t.context),r=rW("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await rW("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},xD=class{async sign(e,r,n){if(!HI.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await c0t(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:soe(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??DTe(r.$response);if(n){let o=rW("config",e.config),i=o.systemClockOffset;o.systemClockOffset=FTe(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=DTe(e);if(n){let o=rW("config",r.config);o.systemClockOffset=FTe(n,o.systemClockOffset)}}}});var f0t=b(()=>{qI();VE()});function m0t(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 kTe)e[r/2]=kTe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function Gb(t){let e="";for(let r=0;r<t.byteLength;r++)e+=p0t[t[r]];return e}var p0t,kTe,nW=b(()=>{p0t={},kTe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),p0t[t]=e,kTe[e]=t}});var oW,$Te=b(()=>{oW=t=>new TextEncoder().encode(t)});var VI,h0t=b(()=>{$Te();VI=t=>typeof t=="string"?oW(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var g0t=b(()=>{});var iW=b(()=>{$Te();h0t();g0t()});var y0t,b0t,BTe,_0t,v0t,zTe,UTe,qTe,HTe,mjr,w0t,x0t,aW,S0t,C0t,O0t,E0t,uoe,P0t,T0t,A0t,VTe,I0t,SD=b(()=>{y0t="X-Amz-Algorithm",b0t="X-Amz-Credential",BTe="X-Amz-Date",_0t="X-Amz-SignedHeaders",v0t="X-Amz-Expires",zTe="X-Amz-Signature",UTe="X-Amz-Security-Token",qTe="authorization",HTe=BTe.toLowerCase(),mjr="date",w0t=[qTe,HTe,mjr],x0t=zTe.toLowerCase(),aW="x-amz-content-sha256",S0t=UTe.toLowerCase(),C0t={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},O0t=/^proxy-/,E0t=/^sec-/,uoe="AWS4-HMAC-SHA256",P0t="AWS4-HMAC-SHA256-PAYLOAD",T0t="UNSIGNED-PAYLOAD",A0t=50,VTe="aws4_request",I0t=60*60*24*7});var loe,WTe,coe,R0t,M0t,KTe=b(()=>{nW();iW();SD();loe={},WTe=[],coe=(t,e,r)=>`${t}/${e}/${r}/${VTe}`,R0t=async(t,e,r,n,o)=>{let i=await M0t(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${Gb(i)}:${e.sessionToken}`;if(a in loe)return loe[a];for(WTe.push(a);WTe.length>A0t;)delete loe[WTe.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,VTe])s=await M0t(t,s,u);return loe[a]=s},M0t=(t,e,r)=>{let n=new t(e);return n.update(VI(r)),n.digest()}});var doe,GTe=b(()=>{SD();doe=({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 C0t||e?.has(i)||O0t.test(i)||E0t.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var JTe,ZTe=b(()=>{Wne();SD();JTe=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===x0t)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${ly(n)}=${ly(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).reduce((i,a)=>i.concat([`${ly(n)}=${ly(a)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")}});var N0t,j0t=b(()=>{N0t=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var sW,YTe=b(()=>{j0t();nW();iW();SD();sW=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===aW)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||N0t(e)){let n=new r;return n.update(VI(e)),Gb(await n.digest())}return T0t}});function L0t(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var foe,D0t,hjr,XTe,F0t=b(()=>{nW();iW();foe=class{format(e){let r=[];for(let i of Object.keys(e)){let a=oW(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=oW(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(XTe.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!hjr.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(m0t(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"})(D0t||(D0t={}));hjr=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,XTe=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&&L0t(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&L0t(e),parseInt(Gb(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var k0t,$0t=b(()=>{k0t=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var QTe,eAe=b(()=>{tW();QTe=(t,e={})=>{let{headers:r,query:n={}}=HI.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 poe,tAe=b(()=>{tW();SD();poe=t=>{t=HI.clone(t);for(let e of Object.keys(t.headers))w0t.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var B0t,gjr,z0t=b(()=>{B0t=t=>gjr(t).toISOString().replace(/\.\d{3}Z$/,"Z"),gjr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var uW,moe,U0t,q0t=b(()=>{nW();Wb();Wne();iW();SD();KTe();GTe();ZTe();YTe();F0t();$0t();eAe();tAe();z0t();uW=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new foe,this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=kf(n),this.credentialProvider=kf(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}=moe(n);if(o>I0t)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let h=coe(p,d,l??this.service),m=QTe(poe(e),{unhoistableHeaders:a});c.sessionToken&&(m.query[UTe]=c.sessionToken),m.query[y0t]=uoe,m.query[b0t]=`${c.accessKeyId}/${h}`,m.query[BTe]=f,m.query[v0t]=o.toString(10);let g=doe(m,i,s);return m.query[_0t]=U0t(g),m.query[zTe]=await this.getSignature(f,h,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(m,g,await sW(e,this.sha256))),m}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}=moe(n),c=coe(u,s,a??this.service),d=await sW({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=Gb(await f.digest()),h=[P0t,l,c,o,p,d].join(`
`);return this.signString(h,{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}=moe(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update(VI(e)),Gb(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=poe(e),{longDate:c,shortDate:d}=moe(r),f=coe(d,u,a??this.service);l.headers[HTe]=c,s.sessionToken&&(l.headers[S0t]=s.sessionToken);let p=await sW(l,this.sha256);!k0t(aW,l.headers)&&this.applyChecksum&&(l.headers[aW]=p);let h=doe(l,o,n),m=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,h,p));return l.headers[qTe]=`${uoe} Credential=${s.accessKeyId}/${f}, SignedHeaders=${U0t(h)}, Signature=${m}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${JTe(e)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}
${o.join(";")}
${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update(VI(n));let i=await o.digest();return`${uoe}
${e}
${r}
${Gb(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 ly(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(VI(i)),Gb(await a.digest())}getSigningKey(e,r,n,o){return R0t(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")}},moe=t=>{let e=B0t(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},U0t=t=>Object.keys(t).sort().join(";")});var H0t=b(()=>{q0t();GTe();ZTe();YTe();eAe();tAe();KTe()});var hoe,V0t=b(()=>{qI();H0t();hoe=t=>{let e;t.credentials&&(e=Iwt(t.credentials,Awt,RTe)),e||(t.credentialDefaultProvider?e=cU(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=cU(t.signer):t.regionInfoProvider?i=()=>cU(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||uW;return new d(c)}):i=async a=>{a=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await cU(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||uW;return new c(l)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:i}}});var W0t=b(()=>{d0t();f0t();V0t()});var K0t=b(()=>{W0t()});var G0t=b(()=>{});var J0t=b(()=>{gr()});var goe,rAe=b(()=>{gr();goe=(t,e)=>UI(t,e).then(r=>e.utf8Encoder(r))});var nu,Z0t,Y0t,X0t=b(()=>{rAe();nu=(t,e)=>goe(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{}}),Z0t=async(t,e)=>{let r=await nu(t,e);return r.message=r.message??r.Message,r},Y0t=(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 yoe=x(ZE=>{"use strict";var Q0t=":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",yjr=Q0t+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",ext="["+Q0t+"]["+yjr+"]*",bjr=new RegExp("^"+ext+"$"),_jr=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},vjr=function(t){let e=bjr.exec(t);return!(e===null||typeof e>"u")};ZE.isExist=function(t){return typeof t<"u"};ZE.isEmptyObject=function(t){return Object.keys(t).length===0};ZE.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]]}};ZE.getValue=function(t){return ZE.isExist(t)?t:""};ZE.isName=vjr;ZE.getAllMatches=_jr;ZE.nameRegexp=ext});var oAe=x(ixt=>{"use strict";var nAe=yoe(),wjr={allowBooleanAttributes:!1,unpairedTags:[]};ixt.validate=function(t,e){e=Object.assign({},wjr,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=rxt(t,i),i.err)return i}else if(t[i]==="<"){let a=i;if(i++,t[i]==="!"){i=nxt(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--),!Ajr(u)){let d;return u.trim().length===0?d="Invalid space after '<'.":d="Tag '"+u+"' is an invalid name.",ou("InvalidTag",d,Dp(t,i))}let l=Cjr(t,i);if(l===!1)return ou("InvalidAttr","Attributes for '"+u+"' have open quote.",Dp(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=oxt(c,e);if(f===!0)n=!0;else return ou(f.err.code,f.err.msg,Dp(t,d+f.err.line))}else if(s)if(l.tagClosed){if(c.trim().length>0)return ou("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",Dp(t,a));if(r.length===0)return ou("InvalidTag","Closing tag '"+u+"' has not been opened.",Dp(t,a));{let d=r.pop();if(u!==d.tagName){let f=Dp(t,d.tagStartPos);return ou("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+u+"'.",Dp(t,a))}r.length==0&&(o=!0)}}else return ou("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",Dp(t,i));else{let d=oxt(c,e);if(d!==!0)return ou(d.err.code,d.err.msg,Dp(t,i-c.length+d.err.line));if(o===!0)return ou("InvalidXml","Multiple possible root nodes found.",Dp(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=nxt(t,i);continue}else if(t[i+1]==="?"){if(i=rxt(t,++i),i.err)return i}else break;else if(t[i]==="&"){let d=Pjr(t,i);if(d==-1)return ou("InvalidChar","char '&' is not expected.",Dp(t,i));i=d}else if(o===!0&&!txt(t[i]))return ou("InvalidXml","Extra text at the end",Dp(t,i));t[i]==="<"&&i--}}else{if(txt(t[i]))continue;return ou("InvalidChar","char '"+t[i]+"' is not expected.",Dp(t,i))}if(n){if(r.length==1)return ou("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Dp(t,r[0].tagStartPos));if(r.length>0)return ou("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return ou("InvalidXml","Start tag expected.",1);return!0};function txt(t){return t===" "||t===" "||t===`
`||t==="\r"}function rxt(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 ou("InvalidXml","XML declaration allowed only at the start of the document.",Dp(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function nxt(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 xjr='"',Sjr="'";function Cjr(t,e){let r="",n="",o=!1;for(;e<t.length;e++){if(t[e]===xjr||t[e]===Sjr)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 Ojr=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function oxt(t,e){let r=nAe.getAllMatches(t,Ojr),n={};for(let o=0;o<r.length;o++){if(r[o][1].length===0)return ou("InvalidAttr","Attribute '"+r[o][2]+"' has no space in starting.",lW(r[o]));if(r[o][3]!==void 0&&r[o][4]===void 0)return ou("InvalidAttr","Attribute '"+r[o][2]+"' is without value.",lW(r[o]));if(r[o][3]===void 0&&!e.allowBooleanAttributes)return ou("InvalidAttr","boolean attribute '"+r[o][2]+"' is not allowed.",lW(r[o]));let i=r[o][2];if(!Tjr(i))return ou("InvalidAttr","Attribute '"+i+"' is an invalid name.",lW(r[o]));if(!n.hasOwnProperty(i))n[i]=1;else return ou("InvalidAttr","Attribute '"+i+"' is repeated.",lW(r[o]))}return!0}function Ejr(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 Pjr(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Ejr(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 ou(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function Tjr(t){return nAe.isName(t)}function Ajr(t){return nAe.isName(t)}function Dp(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function lW(t){return t.startIndex+t[1].length}});var sxt=x(iAe=>{var axt={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}},Ijr=function(t){return Object.assign({},axt,t)};iAe.buildOptions=Ijr;iAe.defaultOptions=axt});var lxt=x((HMo,uxt)=>{"use strict";var aAe=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})}};uxt.exports=aAe});var dxt=x((VMo,cxt)=>{var Mjr=yoe();function Rjr(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&&Djr(t,e))e+=7,[entityName,val,e]=Njr(t,e+1),val.indexOf("&")===-1&&(r[$jr(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(o&&Ljr(t,e))e+=8;else if(o&&Fjr(t,e))e+=8;else if(o&&kjr(t,e))e+=9;else if(jjr)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 Njr(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 jjr(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function Djr(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 Ljr(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 Fjr(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 kjr(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 $jr(t){if(Mjr.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}cxt.exports=Rjr});var pxt=x((WMo,fxt)=>{var Bjr=/^[-+]?0x[a-fA-F0-9]+$/,zjr=/^([\-\+])?(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 Ujr={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function qjr(t,e={}){if(e=Object.assign({},Ujr,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&&Bjr.test(r))return Number.parseInt(r,16);{let n=zjr.exec(r);if(n){let o=n[1],i=n[2],a=Hjr(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 Hjr(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}fxt.exports=qjr});var gxt=x((KMo,hxt)=>{"use strict";var mxt=yoe(),cW=lxt(),Vjr=dxt(),Wjr=pxt(),sAe=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=Kjr,this.parseXml=Xjr,this.parseTextData=Gjr,this.resolveNameSpace=Jjr,this.buildAttributesMap=Yjr,this.isItStopNode=rDr,this.replaceEntitiesValue=eDr,this.readStopNodeData=oDr,this.saveTextToParentTag=tDr,this.addChild=Qjr}};function Kjr(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 Gjr(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?lAe(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?lAe(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Jjr(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 Zjr=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Yjr(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let n=mxt.getAllMatches(t,Zjr),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]=lAe(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 Xjr=function(t){t=t.replace(/\r\n?/g,`
`);let e=new cW("!xml"),r=e,n="",o="";for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){let s=CD(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=uAe(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 cW(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=CD(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=Vjr(t,i);this.docTypeEntities=s.entities,i=s.i}else if(t.substr(i+1,2)==="!["){let s=CD(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=uAe(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 h="";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 g=this.readStopNodeData(t,l,f+1);if(!g)throw new Error(`Unexpected end of ${l}`);i=g.i,h=g.tagContent}let m=new cW(u);u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),h&&(h=this.parseTextData(h,u,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),m.add(this.options.textNodeName,h),this.addChild(r,m,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 h=new cW(u);u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,h,o),o=o.substr(0,o.lastIndexOf("."))}else{let h=new cW(u);this.tagsNodeStack.push(r),u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,h,o),r=h}n="",i=f}}else n+=t[i];return e.child};function Qjr(t,e,r){let n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}var eDr=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 tDr(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 rDr(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 nDr(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 CD(t,e,r,n){let o=t.indexOf(e,r);if(o===-1)throw new Error(n);return o+e.length-1}function uAe(t,e,r,n=">"){let o=nDr(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 oDr(t,e,r){let n=r,o=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let i=CD(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=CD(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=CD(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=CD(t,"]]>",r,"StopNode is not closed.")-2;else{let i=uAe(t,r,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,r=i.closeIndex)}}function lAe(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:Wjr(t,r)}else return mxt.isExist(t)?t:""}hxt.exports=sAe});var _xt=x(bxt=>{"use strict";function iDr(t,e){return yxt(t,e)}function yxt(t,e,r){let n,o={};for(let i=0;i<t.length;i++){let a=t[i],s=aDr(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=yxt(a[s],e,u),c=uDr(l,e);a[":@"]?sDr(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 aDr(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function sDr(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 uDr(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))}bxt.prettify=iDr});var wxt=x((JMo,vxt)=>{var{buildOptions:lDr}=sxt(),cDr=gxt(),{prettify:dDr}=_xt(),fDr=oAe(),cAe=class{constructor(e){this.externalEntities={},this.options=lDr(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=fDr.validate(e,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new cDr(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:dDr(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}};vxt.exports=cAe});var Ext=x((ZMo,Oxt)=>{var pDr=`
`;function mDr(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=pDr),Sxt(t,e,"",r)}function Sxt(t,e,r,n){let o="",i=!1;for(let a=0;a<t.length;a++){let s=t[a],u=hDr(s);if(u===void 0)continue;let l="";if(r.length===0?l=u:l=`${r}.${u}`,u===e.textNodeName){let h=s[u];gDr(l,e)||(h=e.tagValueProcessor(u,h),h=Cxt(h,e)),i&&(o+=n),o+=h,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 h=xxt(s[":@"],e),m=u==="?xml"?"":n,g=s[u][0][e.textNodeName];g=g.length!==0?" "+g:"",o+=m+`<${u}${g}${h}?>`,i=!0;continue}let c=n;c!==""&&(c+=e.indentBy);let d=xxt(s[":@"],e),f=n+`<${u}${d}`,p=Sxt(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 hDr(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 xxt(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=Cxt(o,e),o===!0&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${o}"`}return r}function gDr(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 Cxt(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}Oxt.exports=mDr});var Txt=x((YMo,Pxt)=>{"use strict";var yDr=Ext(),bDr={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 WI(t){this.options=Object.assign({},bDr,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=wDr),this.processTextOrObjNode=_Dr,this.options.format?(this.indentate=vDr,this.tagEndChar=`>
`,this.newLine=`
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}WI.prototype.build=function(t){return this.options.preserveOrder?yDr(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};WI.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}};WI.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 _Dr(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)}WI.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}};WI.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};WI.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}};WI.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 vDr(t){return this.options.indentBy.repeat(t)}function wDr(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}Pxt.exports=WI});var Ixt=x((XMo,Axt)=>{"use strict";var xDr=oAe(),SDr=wxt(),CDr=Txt();Axt.exports={XMLParser:SDr,XMLValidator:xDr,XMLBuilder:CDr}});var Mxt,sw,Rxt,Nxt=b(()=>{gr();Mxt=j(Ixt());rAe();sw=(t,e)=>goe(t,e).then(r=>{if(r.length){let n=new Mxt.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]),ATe(s)}return{}}),Rxt=async(t,e)=>{let r=await sw(t,e);return r.Error&&(r.Error.message=r.Error.message??r.Error.Message),r}});var jxt=b(()=>{G0t();J0t();X0t();Nxt()});var OD=b(()=>{Jwt();K0t();jxt()});function ODr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function boe(t){return{schemeId:"smithy.api#noAuth"}}var Dxt,Lxt,Fxt,dAe=b(()=>{OD();Wb();Dxt=async(t,e,r)=>({operation:ow(e).operation,region:await kf(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});Lxt=t=>{let e=[];switch(t.operation){case"GetCredentialsForIdentity":{e.push(boe(t));break}case"GetId":{e.push(boe(t));break}case"GetOpenIdToken":{e.push(boe(t));break}case"UnlinkIdentity":{e.push(boe(t));break}default:e.push(ODr(t))}return e},Fxt=t=>({...hoe(t)})});var kxt,qr,Ca=b(()=>{kxt=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),qr={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var Bxt,$xt=b(()=>{Bxt={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 fAe,pAe,zxt,Uxt=b(()=>{fAe={name:"SHA-256"},pAe={name:"HMAC",hash:fAe},zxt=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 dU(){return typeof window<"u"?window:typeof self<"u"?self:PDr}var PDr,mAe=b(()=>{PDr={}});var fU,hAe,gAe=b(()=>{fU=j(rne());Uxt();mAe();hAe=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,fU.isEmptyData)(e)){var r=(0,fU.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 dU().crypto.subtle.sign(pAe,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,fU.isEmptyData)(this.toHash)?Promise.resolve(zxt):Promise.resolve().then(function(){return dU().crypto.subtle.digest(fAe,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){dU().crypto.subtle.importKey("raw",(0,fU.convertToBuffer)(e.secret),pAe,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function qxt(t){if(ADr(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return IDr(e)}return!1}function ADr(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function IDr(t){return t&&TDr.every(function(e){return typeof t[e]=="function"})}var TDr,Hxt=b(()=>{TDr=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var Vxt=b(()=>{Hxt()});var Wxt,Kxt,_oe,Gxt=b(()=>{gAe();Wxt=j(wPe());Vxt();mAe();Kxt=j(rne()),_oe=function(){function t(e){qxt(dU())?this.hash=new hAe(e):this.hash=new Wxt.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,Kxt.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var yAe=b(()=>{Gxt();gAe()});var _Ae=x((dW,bAe)=>{(function(t,e){typeof dW=="object"&&typeof bAe=="object"?bAe.exports=e():typeof define=="function"&&define.amd?define([],e):typeof dW=="object"?dW.bowser=e():t.bowser=e()})(dW,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(h){var m=d-i.getVersionPrecision(h),g=h+new Array(m+1).join(".0");return i.map(g.split("."),function(y){return new Array(20-y.length).join("0")+y}).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 h=d[s];typeof h=="object"&&h!==null&&Object.keys(h).forEach(function(m){l[m]=h[m]})};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(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});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(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});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(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});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(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});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,h={},m=0,g={},y=0;if(Object.keys(f).forEach(function(I){var N=f[I];typeof N=="string"?(g[I]=N,y+=1):typeof N=="object"&&(h[I]=N,m+=1)}),m>0){var _=Object.keys(h),w=s.default.find(_,function(I){return p.isOS(I)});if(w){var S=this.satisfies(h[w]);if(S!==void 0)return S}var C=s.default.find(_,function(I){return p.isPlatform(I)});if(C){var E=this.satisfies(h[C]);if(E!==void 0)return E}}if(y>0){var P=Object.keys(g),T=s.default.find(P,function(I){return p.isBrowser(I,!0)});if(T!==void 0)return this.compareVersion(g[T])}},d.isBrowser=function(f,p){p===void 0&&(p=!1);var h=this.getBrowserName().toLowerCase(),m=f.toLowerCase(),g=s.default.getBrowserTypeByAlias(m);return p&&g&&(m=g.toLowerCase()),m===h},d.compareVersion=function(f){var p=[0],h=f,m=!1,g=this.getBrowserVersion();if(typeof g=="string")return f[0]===">"||f[0]==="<"?(h=f.substr(1),f[1]==="="?(m=!0,h=f.substr(2)):p=[],f[0]===">"?p.push(1):p.push(-1)):f[0]==="="?h=f.substr(1):f[0]==="~"&&(m=!0,h=f.substr(1)),p.indexOf(s.default.compareVersions(g,h,m))>-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(h){return p.is(h)})},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 Jxt,voe,vAe=b(()=>{Jxt=j(_Ae()),voe=({serviceId:t,clientVersion:e})=>async()=>{let r=typeof window<"u"&&window?.navigator?.userAgent?Jxt.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 Zxt=b(()=>{});var woe,Yxt=b(()=>{woe=t=>()=>Promise.reject(t)});var wAe=b(()=>{Zxt();Yxt()});var Xxt,xoe,Qxt=b(()=>{Xxt=typeof TextEncoder=="function"?new TextEncoder:null,xoe=t=>{if(typeof t=="string"){if(Xxt)return Xxt.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 xAe=b(()=>{Qxt()});var SAe,CAe=b(()=>{SAe=t=>new TextEncoder().encode(t)});var eSt=b(()=>{CAe()});var tSt,rSt=b(()=>{tSt=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 nSt=b(()=>{CAe();eSt();rSt()});var pSt,lw,cw,mU,oSt,pW,pU,fW,YE,OAe,iSt,aSt,sSt,mSt,hSt,uw,uSt,lSt,cSt,dSt,fSt,MDr,gSt,ySt=b(()=>{pSt="required",lw="fn",cw="argv",mU="ref",oSt="isSet",pW="booleanEquals",pU="error",fW="endpoint",YE="tree",OAe="PartitionResult",iSt={[pSt]:!1,type:"String"},aSt={[pSt]:!0,default:!1,type:"Boolean"},sSt={[mU]:"Endpoint"},mSt={[lw]:pW,[cw]:[{[mU]:"UseFIPS"},!0]},hSt={[lw]:pW,[cw]:[{[mU]:"UseDualStack"},!0]},uw={},uSt={[lw]:"getAttr",[cw]:[{[mU]:OAe},"supportsFIPS"]},lSt={[lw]:pW,[cw]:[!0,{[lw]:"getAttr",[cw]:[{[mU]:OAe},"supportsDualStack"]}]},cSt=[mSt],dSt=[hSt],fSt=[{[mU]:"Region"}],MDr={version:"1.0",parameters:{Region:iSt,UseDualStack:aSt,UseFIPS:aSt,Endpoint:iSt},rules:[{conditions:[{[lw]:oSt,[cw]:[sSt]}],rules:[{conditions:cSt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:pU},{conditions:dSt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:pU},{endpoint:{url:sSt,properties:uw,headers:uw},type:fW}],type:YE},{conditions:[{[lw]:oSt,[cw]:fSt}],rules:[{conditions:[{[lw]:"aws.partition",[cw]:fSt,assign:OAe}],rules:[{conditions:[mSt,hSt],rules:[{conditions:[{[lw]:pW,[cw]:[!0,uSt]},lSt],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:uw,headers:uw},type:fW}],type:YE},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:pU}],type:YE},{conditions:cSt,rules:[{conditions:[{[lw]:pW,[cw]:[uSt,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:uw,headers:uw},type:fW}],type:YE},{error:"FIPS is enabled but this partition does not support FIPS",type:pU}],type:YE},{conditions:dSt,rules:[{conditions:[lSt],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:uw,headers:uw},type:fW}],type:YE},{error:"DualStack is enabled but this partition does not support DualStack",type:pU}],type:YE},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:uw,headers:uw},type:fW}],type:YE}],type:YE},{error:"Invalid Configuration: Missing Region",type:pU}]},gSt=MDr});var bSt,_St=b(()=>{vne();jI();ySt();bSt=(t,e={})=>z5(gSt,{endpointParams:t,logger:e.logger});WE.aws=U5});var vSt,wSt=b(()=>{OD();qI();gr();Mne();oU();nSt();dAe();_St();vSt=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??$I,base64Encoder:t?.base64Encoder??BI,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??bSt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??Lxt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new xD},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new lU}],logger:t?.logger??new LI,serviceId:t?.serviceId??"Cognito Identity",urlParser:t?.urlParser??DI,utf8Decoder:t?.utf8Decoder??SAe,utf8Encoder:t?.utf8Encoder??tSt})});var xSt,SSt=b(()=>{xSt=["in-region","cross-region","mobile","standard","legacy"]});var CSt,Soe,RDr,OSt=b(()=>{VE();CSt=j(_Ae());SSt();Soe=({defaultsMode:t}={})=>wht(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(RDr()?"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 ${xSt.join(", ")}, got ${e}`)}}),RDr=()=>{let e=(typeof window<"u"&&window?.navigator?.userAgent?CSt.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return e==="tablet"||e==="mobile"}});var EAe=b(()=>{OSt()});var ESt,PSt=b(()=>{$xt();yAe();vAe();q5();Y5();wAe();xAe();aw();wSt();gr();EAe();ESt=t=>{let e=Soe(t),r=()=>e().then(Yne),n=vSt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??xoe,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??voe({serviceId:n.serviceId,clientVersion:Bxt.version}),maxAttempts:t?.maxAttempts??iw,region:t?.region??woe("Region is missing"),requestHandler:zI.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||W5),sha256:t?.sha256??_oe,streamCollector:t?.streamCollector??iU,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(Ene)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(Pne))}}});var Coe,Ooe,TSt=b(()=>{Coe=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}}},Ooe=t=>({region:t.region()})});var ASt=b(()=>{});var PAe=b(()=>{});var ISt=b(()=>{PAe()});var MSt=b(()=>{ISt();PAe()});var RSt=b(()=>{ASt();MSt()});var TAe=b(()=>{TSt();RSt()});var NSt,jSt,DSt=b(()=>{NSt=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},jSt=t=>({httpHandler:t.httpHandler()})});var LSt=b(()=>{DSt()});var FSt=b(()=>{vu()});var kSt=b(()=>{});var $St=b(()=>{});function jDr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Eoe,BSt=b(()=>{Eoe=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=jDr(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 zSt=b(()=>{});var USt=b(()=>{});var qSt=b(()=>{});var AAe=b(()=>{LSt();FSt();kSt();$St();BSt();zSt();USt();qSt()});var HSt,VSt,WSt=b(()=>{HSt=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}}},VSt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var Poe,KSt,GSt=b(()=>{TAe();AAe();gr();WSt();Poe=t=>t,KSt=(t,e)=>{let r={...Poe(Coe(t)),...Poe(Xne(t)),...Poe(NSt(t)),...Poe(HSt(t))};return e.forEach(n=>n.configure(r)),{...t,...Ooe(r),...Qne(r),...jSt(r),...VSt(r)}}});var KI,Toe=b(()=>{OPe();EPe();PPe();HPe();q5();qI();jTe();lo();roe();gr();dAe();Ca();PSt();GSt();KI=class extends yD{constructor(...[e]){let r=ESt(e||{}),n=kxt(r),o=fne(n),i=Hne(o),a=Ane(i),s=a,u=jne(s),l=Fxt(u),c=KSt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(Cne(this.config)),this.middlewareStack.use(toe(this.config)),this.middlewareStack.use(ioe(this.config)),this.middlewareStack.use(une(this.config)),this.middlewareStack.use(lne(this.config)),this.middlewareStack.use(dne(this.config)),this.middlewareStack.use(Dne(this.config,{httpAuthSchemeParametersProvider:Dxt,identityProviderConfigProvider:async d=>new uU({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(noe(this.config))}destroy(){super.destroy()}}});var $f,IAe=b(()=>{gr();$f=class t extends sU{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var Aoe,Ioe,Moe,Roe,Noe,joe,Doe,Loe,Foe,koe,$oe,MAe=b(()=>{IAe();Aoe=class t extends $f{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,t.prototype)}},Ioe=class t extends $f{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Moe=class t extends $f{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Roe=class t extends $f{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Noe=class t extends $f{constructor(e){super({name:"ResourceConflictException",$fault:"client",...e}),this.name="ResourceConflictException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},joe=class t extends $f{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Doe=class t extends $f{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Loe=class t extends $f{constructor(e){super({name:"ExternalServiceException",$fault:"client",...e}),this.name="ExternalServiceException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Foe=class t extends $f{constructor(e){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...e}),this.name="InvalidIdentityPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},koe=class t extends $f{constructor(e){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...e}),this.name="DeveloperUserAlreadyRegisteredException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},$oe=class t extends $f{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}}});function fs(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${t}`}}var JSt,ZSt,YSt,XSt,QSt,eCt,tCt,rCt,nCt,oCt,iCt,aCt,sCt,uCt,lCt,cCt,dCt,fCt,pCt,mCt,hCt,gCt,yCt,bCt,_Ct,vCt,wCt,xCt,SCt,CCt,OCt,ECt,PCt,TCt,ACt,ICt,MCt,RCt,NCt,jCt,DCt,LCt,FCt,kCt,$Ct,BCt,cs,LDr,FDr,kDr,$Dr,BDr,zDr,UDr,qDr,HDr,VDr,WDr,KDr,GDr,JDr,zCt,ZDr,xo,YDr,ds,za=b(()=>{OD();AAe();gr();IAe();MAe();JSt=async(t,e)=>{let r=fs("CreateIdentityPool"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},ZSt=async(t,e)=>{let r=fs("DeleteIdentities"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},YSt=async(t,e)=>{let r=fs("DeleteIdentityPool"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},XSt=async(t,e)=>{let r=fs("DescribeIdentity"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},QSt=async(t,e)=>{let r=fs("DescribeIdentityPool"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},eCt=async(t,e)=>{let r=fs("GetCredentialsForIdentity"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},tCt=async(t,e)=>{let r=fs("GetId"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},rCt=async(t,e)=>{let r=fs("GetIdentityPoolRoles"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},nCt=async(t,e)=>{let r=fs("GetOpenIdToken"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},oCt=async(t,e)=>{let r=fs("GetOpenIdTokenForDeveloperIdentity"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},iCt=async(t,e)=>{let r=fs("GetPrincipalTagAttributeMap"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},aCt=async(t,e)=>{let r=fs("ListIdentities"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},sCt=async(t,e)=>{let r=fs("ListIdentityPools"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},uCt=async(t,e)=>{let r=fs("ListTagsForResource"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},lCt=async(t,e)=>{let r=fs("LookupDeveloperIdentity"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},cCt=async(t,e)=>{let r=fs("MergeDeveloperIdentities"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},dCt=async(t,e)=>{let r=fs("SetIdentityPoolRoles"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},fCt=async(t,e)=>{let r=fs("SetPrincipalTagAttributeMap"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},pCt=async(t,e)=>{let r=fs("TagResource"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},mCt=async(t,e)=>{let r=fs("UnlinkDeveloperIdentity"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},hCt=async(t,e)=>{let r=fs("UnlinkIdentity"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},gCt=async(t,e)=>{let r=fs("UntagResource"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},yCt=async(t,e)=>{let r=fs("UpdateIdentityPool"),n;return n=JSON.stringify(hr(t)),ds(e,r,"/",void 0,n)},bCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},_Ct=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},vCt=async(t,e)=>t.statusCode>=300?cs(t,e):(await UI(t.body,e),{$metadata:xo(t)}),wCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=zCt(r,e),{$metadata:xo(t),...n}},xCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},SCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=GDr(r,e),{$metadata:xo(t),...n}},CCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},OCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},ECt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},PCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},TCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},ACt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=ZDr(r,e),{$metadata:xo(t),...n}},ICt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},MCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},RCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},NCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},jCt=async(t,e)=>t.statusCode>=300?cs(t,e):(await UI(t.body,e),{$metadata:xo(t)}),DCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},LCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},FCt=async(t,e)=>t.statusCode>=300?cs(t,e):(await UI(t.body,e),{$metadata:xo(t)}),kCt=async(t,e)=>t.statusCode>=300?cs(t,e):(await UI(t.body,e),{$metadata:xo(t)}),$Ct=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},BCt=async(t,e)=>{if(t.statusCode>=300)return cs(t,e);let r=await nu(t.body,e),n={};return n=hr(r),{$metadata:xo(t),...n}},cs=async(t,e)=>{let r={...t,body:await Z0t(t.body,e)},n=Y0t(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":throw await $Dr(r,e);case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":throw await zDr(r,e);case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":throw await UDr(r,e);case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":throw await qDr(r,e);case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":throw await HDr(r,e);case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":throw await WDr(r,e);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":throw await VDr(r,e);case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":throw await kDr(r,e);case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":throw await BDr(r,e);case"DeveloperUserAlreadyRegisteredException":case"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException":throw await FDr(r,e);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentity#ConcurrentModificationException":throw await LDr(r,e);default:let o=r.body;return YDr({output:t,parsedBody:o,errorCode:n})}},LDr=async(t,e)=>{let r=t.body,n=hr(r),o=new $oe({$metadata:xo(t),...n});return ls(o,r)},FDr=async(t,e)=>{let r=t.body,n=hr(r),o=new koe({$metadata:xo(t),...n});return ls(o,r)},kDr=async(t,e)=>{let r=t.body,n=hr(r),o=new Loe({$metadata:xo(t),...n});return ls(o,r)},$Dr=async(t,e)=>{let r=t.body,n=hr(r),o=new Aoe({$metadata:xo(t),...n});return ls(o,r)},BDr=async(t,e)=>{let r=t.body,n=hr(r),o=new Foe({$metadata:xo(t),...n});return ls(o,r)},zDr=async(t,e)=>{let r=t.body,n=hr(r),o=new Ioe({$metadata:xo(t),...n});return ls(o,r)},UDr=async(t,e)=>{let r=t.body,n=hr(r),o=new Moe({$metadata:xo(t),...n});return ls(o,r)},qDr=async(t,e)=>{let r=t.body,n=hr(r),o=new Roe({$metadata:xo(t),...n});return ls(o,r)},HDr=async(t,e)=>{let r=t.body,n=hr(r),o=new Noe({$metadata:xo(t),...n});return ls(o,r)},VDr=async(t,e)=>{let r=t.body,n=hr(r),o=new Doe({$metadata:xo(t),...n});return ls(o,r)},WDr=async(t,e)=>{let r=t.body,n=hr(r),o=new joe({$metadata:xo(t),...n});return ls(o,r)},KDr=(t,e)=>eW(t,{AccessKeyId:In,Expiration:r=>aU(Jne(vD(r))),SecretKey:In,SessionToken:In}),GDr=(t,e)=>eW(t,{Credentials:r=>KDr(r,e),IdentityId:In}),JDr=(t,e)=>(t||[]).filter(n=>n!=null).map(n=>zCt(n,e)),zCt=(t,e)=>eW(t,{CreationDate:r=>aU(Jne(vD(r))),IdentityId:In,LastModifiedDate:r=>aU(Jne(vD(r))),Logins:hr}),ZDr=(t,e)=>eW(t,{Identities:r=>JDr(r,e),IdentityPoolId:In,NextToken:In}),xo=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"]}),YDr=Zne($f),ds=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 Eoe(l)}});var Boe,RAe=b(()=>{lo();wo();gr();Ca();za();Boe=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").f(void 0,void 0).ser(JSt).de(bCt).build(){}});var zoe,NAe=b(()=>{lo();wo();gr();Ca();za();zoe=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").f(void 0,void 0).ser(ZSt).de(_Ct).build(){}});var Uoe,jAe=b(()=>{lo();wo();gr();Ca();za();Uoe=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").f(void 0,void 0).ser(YSt).de(vCt).build(){}});var qoe,DAe=b(()=>{lo();wo();gr();Ca();za();qoe=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").f(void 0,void 0).ser(XSt).de(wCt).build(){}});var Hoe,LAe=b(()=>{lo();wo();gr();Ca();za();Hoe=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").f(void 0,void 0).ser(QSt).de(xCt).build(){}});var hU,FAe=b(()=>{lo();wo();gr();Ca();za();hU=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").f(void 0,void 0).ser(eCt).de(SCt).build(){}});var gU,kAe=b(()=>{lo();wo();gr();Ca();za();gU=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").f(void 0,void 0).ser(tCt).de(CCt).build(){}});var Voe,$Ae=b(()=>{lo();wo();gr();Ca();za();Voe=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").f(void 0,void 0).ser(rCt).de(OCt).build(){}});var Woe,BAe=b(()=>{lo();wo();gr();Ca();za();Woe=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").f(void 0,void 0).ser(nCt).de(ECt).build(){}});var Koe,zAe=b(()=>{lo();wo();gr();Ca();za();Koe=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").f(void 0,void 0).ser(oCt).de(PCt).build(){}});var Goe,UAe=b(()=>{lo();wo();gr();Ca();za();Goe=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(iCt).de(TCt).build(){}});var Joe,qAe=b(()=>{lo();wo();gr();Ca();za();Joe=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").f(void 0,void 0).ser(aCt).de(ACt).build(){}});var yU,Zoe=b(()=>{lo();wo();gr();Ca();za();yU=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").f(void 0,void 0).ser(sCt).de(ICt).build(){}});var Yoe,HAe=b(()=>{lo();wo();gr();Ca();za();Yoe=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").f(void 0,void 0).ser(uCt).de(MCt).build(){}});var Xoe,VAe=b(()=>{lo();wo();gr();Ca();za();Xoe=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").f(void 0,void 0).ser(lCt).de(RCt).build(){}});var Qoe,WAe=b(()=>{lo();wo();gr();Ca();za();Qoe=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").f(void 0,void 0).ser(cCt).de(NCt).build(){}});var eie,KAe=b(()=>{lo();wo();gr();Ca();za();eie=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").f(void 0,void 0).ser(dCt).de(jCt).build(){}});var tie,GAe=b(()=>{lo();wo();gr();Ca();za();tie=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(fCt).de(DCt).build(){}});var rie,JAe=b(()=>{lo();wo();gr();Ca();za();rie=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").f(void 0,void 0).ser(pCt).de(LCt).build(){}});var nie,ZAe=b(()=>{lo();wo();gr();Ca();za();nie=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").f(void 0,void 0).ser(mCt).de(FCt).build(){}});var oie,YAe=b(()=>{lo();wo();gr();Ca();za();oie=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").f(void 0,void 0).ser(hCt).de(kCt).build(){}});var iie,XAe=b(()=>{lo();wo();gr();Ca();za();iie=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").f(void 0,void 0).ser(gCt).de($Ct).build(){}});var aie,QAe=b(()=>{lo();wo();gr();Ca();za();aie=class extends Mt.classBuilder().ep({...qr}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").f(void 0,void 0).ser(yCt).de(BCt).build(){}});var XDr,eIe,UCt=b(()=>{gr();Toe();RAe();NAe();jAe();DAe();LAe();FAe();kAe();$Ae();BAe();zAe();UAe();qAe();Zoe();HAe();VAe();WAe();KAe();GAe();JAe();ZAe();YAe();XAe();QAe();XDr={CreateIdentityPoolCommand:Boe,DeleteIdentitiesCommand:zoe,DeleteIdentityPoolCommand:Uoe,DescribeIdentityCommand:qoe,DescribeIdentityPoolCommand:Hoe,GetCredentialsForIdentityCommand:hU,GetIdCommand:gU,GetIdentityPoolRolesCommand:Voe,GetOpenIdTokenCommand:Woe,GetOpenIdTokenForDeveloperIdentityCommand:Koe,GetPrincipalTagAttributeMapCommand:Goe,ListIdentitiesCommand:Joe,ListIdentityPoolsCommand:yU,ListTagsForResourceCommand:Yoe,LookupDeveloperIdentityCommand:Xoe,MergeDeveloperIdentitiesCommand:Qoe,SetIdentityPoolRolesCommand:eie,SetPrincipalTagAttributeMapCommand:tie,TagResourceCommand:rie,UnlinkDeveloperIdentityCommand:nie,UnlinkIdentityCommand:oie,UntagResourceCommand:iie,UpdateIdentityPoolCommand:aie},eIe=class extends KI{};Gne(XDr,eIe)});var qCt=b(()=>{RAe();NAe();jAe();DAe();LAe();FAe();kAe();$Ae();BAe();zAe();UAe();qAe();Zoe();HAe();VAe();WAe();KAe();GAe();JAe();ZAe();YAe();XAe();QAe()});var HCt=b(()=>{});var dFo,VCt=b(()=>{qI();Toe();Zoe();dFo=NTe(KI,yU,"NextToken","NextToken","MaxResults")});var WCt=b(()=>{HCt();VCt()});var KCt=b(()=>{MAe()});var GCt=b(()=>{Toe();UCt();qCt();WCt();KCt()});var tIe={};ns(tIe,{CognitoIdentityClient:()=>KI,GetCredentialsForIdentityCommand:()=>hU,GetIdCommand:()=>gU});var rIe=b(()=>{GCt()});function sie(t){return async()=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:e,CognitoIdentityClient:r}=await Promise.resolve().then(()=>(rIe(),tIe)),{Credentials:{AccessKeyId:n=QDr(t.logger),Expiration:o,SecretKey:i=tLr(t.logger),SessionToken:a}=eLr(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 ane(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:n,secretAccessKey:i,sessionToken:a,expiration:o}}}function QDr(t){throw new uc("Response from Amazon Cognito contained no access key ID",{logger:t})}function eLr(t){throw new uc("Response from Amazon Cognito contained no credentials",{logger:t})}function tLr(t){throw new uc("Response from Amazon Cognito contained no secret key",{logger:t})}var nIe=b(()=>{VE();xPe()});var oIe,uie,JCt=b(()=>{oIe="IdentityIds",uie=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(oIe,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(oIe,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(oIe)))}).catch(i=>{throw n.close(),i})})}}});var lie,ZCt=b(()=>{lie=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 YCt(){return typeof self=="object"&&self.indexedDB?new uie:typeof window=="object"&&window.localStorage?window.localStorage:rLr}var rLr,XCt=b(()=>{JCt();ZCt();rLr=new lie});function QCt({accountId:t,cache:e=YCt(),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(()=>(rIe(),tIe)),h=r??new p(Object.assign({},n??{},{region:n?.region??l?.region})),m=c&&await e.getItem(c);if(!m){let{IdentityId:g=nLr(u)}=await h.send(new f({AccountId:t,IdentityPoolId:i,Logins:a?await ane(a):void 0}));m=g,c&&Promise.resolve(e.setItem(c,m)).catch(()=>{})}return d=sie({client:h,customRoleArn:o,logins:a,identityId:m}),d()};return()=>d().catch(async f=>{throw c&&Promise.resolve(e.removeItem(c)).catch(()=>{}),f})}function nLr(t){throw new uc("Response from Amazon Cognito contained no identity ID",{logger:t})}var eOt=b(()=>{VE();nIe();XCt();xPe()});var iIe=b(()=>{mht();hht();ght();nIe();eOt()});var oLr,tOt=b(()=>{iIe();oLr=t=>sie({...t})});var iLr,rOt=b(()=>{iIe();iLr=t=>QCt({...t})});var aLr,sLr,uLr,nOt,oOt=b(()=>{VE();aLr="169.254.170.2",sLr="169.254.170.23",uLr="[fd00:ec2::23]",nOt=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===aLr||t.hostname===sLr||t.hostname===uLr)){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 uc(`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 iOt=b(()=>{});var aOt=b(()=>{iOt()});var sOt=b(()=>{vu()});var uOt=b(()=>{});var lOt=b(()=>{});function lLr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var cie,cOt=b(()=>{cie=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=lLr(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 dOt=b(()=>{});var fOt=b(()=>{});var pOt=b(()=>{});var mOt=b(()=>{aOt();sOt();uOt();lOt();cOt();dOt();fOt();pOt()});function hOt(t){return new cie({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 gOt(t,e){let n=await Nvt(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 uc("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:Zvt(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new uc(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new uc(`Server responded with status: ${t.statusCode}`,{logger:e})}var yOt=b(()=>{VE();mOt();gr();wTe()});var bOt,_Ot=b(()=>{bOt=(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 aIe,vOt=b(()=>{Y5();VE();oOt();yOt();_Ot();aIe=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new uc("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);nOt(n,t.logger);let o=new zI;return bOt(async()=>{let i=hOt(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return gOt(a.response)},t.maxRetries??3,t.timeout??1e3)}});var wOt=b(()=>{vOt()});function cLr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function xOt(t){return{schemeId:"smithy.api#noAuth"}}var SOt,COt,dLr,OOt,sIe=b(()=>{OD();Wb();mW();SOt=async(t,e,r)=>({operation:ow(e).operation,region:await kf(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});COt=t=>{let e=[];switch(t.operation){case"AssumeRoleWithSAML":{e.push(xOt(t));break}case"AssumeRoleWithWebIdentity":{e.push(xOt(t));break}default:e.push(cLr(t))}return e},dLr=t=>({...t,stsClientCtor:cy}),OOt=t=>{let e=dLr(t);return{...hoe(e)}}});var EOt,Bf,dw=b(()=>{EOt=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),Bf={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 TOt,POt=b(()=>{TOt={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 uIe,lIe=b(()=>{uIe=t=>new TextEncoder().encode(t)});var AOt=b(()=>{lIe()});var IOt,MOt=b(()=>{IOt=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 ROt=b(()=>{lIe();AOt();MOt()});var qOt,xn,$o,Bo,JI,GI,Id,HOt,VOt,WOt,Ua,NOt,fw,bU,dIe,jOt,cIe,KOt,DOt,Md,LOt,GOt,JOt,zf,Hh,FOt,ZOt,YOt,kOt,XOt,$Ot,BOt,zOt,UOt,pLr,QOt,eEt=b(()=>{qOt="required",xn="type",$o="fn",Bo="argv",JI="ref",GI="booleanEquals",Id="stringEquals",HOt="sigv4",VOt="sts",WOt="us-east-1",Ua="endpoint",NOt="https://sts.{Region}.{PartitionResult#dnsSuffix}",fw="tree",bU="error",dIe="getAttr",jOt={[qOt]:!1,[xn]:"String"},cIe={[qOt]:!0,default:!1,[xn]:"Boolean"},KOt={[JI]:"Endpoint"},DOt={[$o]:"isSet",[Bo]:[{[JI]:"Region"}]},Md={[JI]:"Region"},LOt={[$o]:"aws.partition",[Bo]:[Md],assign:"PartitionResult"},GOt={[JI]:"UseFIPS"},JOt={[JI]:"UseDualStack"},zf={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:HOt,signingName:VOt,signingRegion:WOt}]},headers:{}},Hh={},FOt={conditions:[{[$o]:Id,[Bo]:[Md,"aws-global"]}],[Ua]:zf,[xn]:Ua},ZOt={[$o]:GI,[Bo]:[GOt,!0]},YOt={[$o]:GI,[Bo]:[JOt,!0]},kOt={[$o]:dIe,[Bo]:[{[JI]:"PartitionResult"},"supportsFIPS"]},XOt={[JI]:"PartitionResult"},$Ot={[$o]:GI,[Bo]:[!0,{[$o]:dIe,[Bo]:[XOt,"supportsDualStack"]}]},BOt=[{[$o]:"isSet",[Bo]:[KOt]}],zOt=[ZOt],UOt=[YOt],pLr={version:"1.0",parameters:{Region:jOt,UseDualStack:cIe,UseFIPS:cIe,Endpoint:jOt,UseGlobalEndpoint:cIe},rules:[{conditions:[{[$o]:GI,[Bo]:[{[JI]:"UseGlobalEndpoint"},!0]},{[$o]:"not",[Bo]:BOt},DOt,LOt,{[$o]:GI,[Bo]:[GOt,!1]},{[$o]:GI,[Bo]:[JOt,!1]}],rules:[{conditions:[{[$o]:Id,[Bo]:[Md,"ap-northeast-1"]}],endpoint:zf,[xn]:Ua},{conditions:[{[$o]:Id,[Bo]:[Md,"ap-south-1"]}],endpoint:zf,[xn]:Ua},{conditions:[{[$o]:Id,[Bo]:[Md,"ap-southeast-1"]}],endpoint:zf,[xn]:Ua},{conditions:[{[$o]:Id,[Bo]:[Md,"ap-southeast-2"]}],endpoint:zf,[xn]:Ua},FOt,{conditions:[{[$o]:Id,[Bo]:[Md,"ca-central-1"]}],endpoint:zf,[xn]:Ua},{conditions:[{[$o]:Id,[Bo]:[Md,"eu-central-1"]}],endpoint:zf,[xn]:Ua},{conditions:[{[$o]:Id,[Bo]:[Md,"eu-north-1"]}],endpoint:zf,[xn]:Ua},{conditions:[{[$o]:Id,[Bo]:[Md,"eu-west-1"]}],endpoint:zf,[xn]:Ua},{conditions:[{[$o]:Id,[Bo]:[Md,"eu-west-2"]}],endpoint:zf,[xn]:Ua},{conditions:[{[$o]:Id,[Bo]:[Md,"eu-west-3"]}],endpoint:zf,[xn]:Ua},{conditions:[{[$o]:Id,[Bo]:[Md,"sa-east-1"]}],endpoint:zf,[xn]:Ua},{conditions:[{[$o]:Id,[Bo]:[Md,WOt]}],endpoint:zf,[xn]:Ua},{conditions:[{[$o]:Id,[Bo]:[Md,"us-east-2"]}],endpoint:zf,[xn]:Ua},{conditions:[{[$o]:Id,[Bo]:[Md,"us-west-1"]}],endpoint:zf,[xn]:Ua},{conditions:[{[$o]:Id,[Bo]:[Md,"us-west-2"]}],endpoint:zf,[xn]:Ua},{endpoint:{url:NOt,properties:{authSchemes:[{name:HOt,signingName:VOt,signingRegion:"{Region}"}]},headers:Hh},[xn]:Ua}],[xn]:fw},{conditions:BOt,rules:[{conditions:zOt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[xn]:bU},{conditions:UOt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[xn]:bU},{endpoint:{url:KOt,properties:Hh,headers:Hh},[xn]:Ua}],[xn]:fw},{conditions:[DOt],rules:[{conditions:[LOt],rules:[{conditions:[ZOt,YOt],rules:[{conditions:[{[$o]:GI,[Bo]:[!0,kOt]},$Ot],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Hh,headers:Hh},[xn]:Ua}],[xn]:fw},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[xn]:bU}],[xn]:fw},{conditions:zOt,rules:[{conditions:[{[$o]:GI,[Bo]:[kOt,!0]}],rules:[{conditions:[{[$o]:Id,[Bo]:[{[$o]:dIe,[Bo]:[XOt,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:Hh,headers:Hh},[xn]:Ua},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Hh,headers:Hh},[xn]:Ua}],[xn]:fw},{error:"FIPS is enabled but this partition does not support FIPS",[xn]:bU}],[xn]:fw},{conditions:UOt,rules:[{conditions:[$Ot],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Hh,headers:Hh},[xn]:Ua}],[xn]:fw},{error:"DualStack is enabled but this partition does not support DualStack",[xn]:bU}],[xn]:fw},FOt,{endpoint:{url:NOt,properties:Hh,headers:Hh},[xn]:Ua}],[xn]:fw}],[xn]:fw},{error:"Invalid Configuration: Missing Region",[xn]:bU}]},QOt=pLr});var tEt,rEt=b(()=>{vne();jI();eEt();tEt=(t,e={})=>z5(QOt,{endpointParams:t,logger:e.logger});WE.aws=U5});var nEt,oEt=b(()=>{OD();qI();gr();Mne();oU();ROt();sIe();rEt();nEt=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??$I,base64Encoder:t?.base64Encoder??BI,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??tEt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??COt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new xD},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new lU}],logger:t?.logger??new LI,serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??DI,utf8Decoder:t?.utf8Decoder??uIe,utf8Encoder:t?.utf8Encoder??IOt})});var iEt,aEt=b(()=>{POt();yAe();vAe();q5();Y5();wAe();xAe();aw();oEt();gr();EAe();iEt=t=>{let e=Soe(t),r=()=>e().then(Yne),n=nEt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??xoe,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??voe({serviceId:n.serviceId,clientVersion:TOt.version}),maxAttempts:t?.maxAttempts??iw,region:t?.region??woe("Region is missing"),requestHandler:zI.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||W5),sha256:t?.sha256??_oe,streamCollector:t?.streamCollector??iU,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(Ene)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(Pne))}}});var sEt,uEt,lEt=b(()=>{sEt=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},uEt=t=>({httpHandler:t.httpHandler()})});var cEt=b(()=>{lEt()});var dEt=b(()=>{vu()});var fEt=b(()=>{});var pEt=b(()=>{});function mLr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var die,mEt=b(()=>{die=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=mLr(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 hEt=b(()=>{});var gEt=b(()=>{});var yEt=b(()=>{});var fIe=b(()=>{cEt();dEt();fEt();pEt();mEt();hEt();gEt();yEt()});var bEt,_Et,vEt=b(()=>{bEt=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}}},_Et=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var fie,wEt,xEt=b(()=>{TAe();fIe();gr();vEt();fie=t=>t,wEt=(t,e)=>{let r={...fie(Coe(t)),...fie(Xne(t)),...fie(sEt(t)),...fie(bEt(t))};return e.forEach(n=>n.configure(r)),{...t,...Ooe(r),...Qne(r),...uEt(r),..._Et(r)}}});var cy,mW=b(()=>{OPe();EPe();PPe();HPe();q5();qI();jTe();lo();roe();gr();sIe();dw();aEt();xEt();cy=class extends yD{constructor(...[e]){let r=iEt(e||{}),n=EOt(r),o=fne(n),i=Hne(o),a=Ane(i),s=a,u=jne(s),l=OOt(u),c=wEt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(Cne(this.config)),this.middlewareStack.use(toe(this.config)),this.middlewareStack.use(ioe(this.config)),this.middlewareStack.use(une(this.config)),this.middlewareStack.use(lne(this.config)),this.middlewareStack.use(dne(this.config)),this.middlewareStack.use(Dne(this.config,{httpAuthSchemeParametersProvider:SOt,identityProviderConfigProvider:async d=>new uU({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(noe(this.config))}destroy(){super.destroy()}}});var Lp,pie=b(()=>{gr();Lp=class t extends sU{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var hW,gW,yW,bW,_W,vW,wW,xW,_U,pIe,mIe,hIe,gIe,yIe,bIe,_Ie,ZI=b(()=>{gr();pie();hW=class t extends Lp{constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},gW=class t extends Lp{constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},yW=class t extends Lp{constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},bW=class t extends Lp{constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_W=class t extends Lp{constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},vW=class t extends Lp{constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},wW=class t extends Lp{constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},xW=class t extends Lp{constructor(e){super({name:"InvalidAuthorizationMessageException",$fault:"client",...e}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_U=t=>({...t,...t.SecretAccessKey&&{SecretAccessKey:Kne}}),pIe=t=>({...t,...t.Credentials&&{Credentials:_U(t.Credentials)}}),mIe=t=>({...t,...t.SAMLAssertion&&{SAMLAssertion:Kne}}),hIe=t=>({...t,...t.Credentials&&{Credentials:_U(t.Credentials)}}),gIe=t=>({...t,...t.WebIdentityToken&&{WebIdentityToken:Kne}}),yIe=t=>({...t,...t.Credentials&&{Credentials:_U(t.Credentials)}}),bIe=t=>({...t,...t.Credentials&&{Credentials:_U(t.Credentials)}}),_Ie=t=>({...t,...t.Credentials&&{Credentials:_U(t.Credentials)}})});var SEt,CEt,OEt,EEt,PEt,TEt,AEt,IEt,MEt,REt,NEt,jEt,DEt,LEt,FEt,kEt,YI,hLr,gLr,yLr,bLr,_Lr,vLr,wLr,xLr,SLr,CLr,OLr,ELr,PLr,TLr,ALr,ILr,mie,MLr,RLr,NLr,jLr,DLr,$Et,GIe,LLr,FLr,kLr,SW,$Lr,BLr,zLr,ULr,qLr,HLr,VLr,WLr,KLr,GLr,JLr,ZLr,YLr,XLr,Uf,QLr,XI,QI,eM,tM,vU,eFr,vIe,XE,tFr,rFr,wU,QE,xU,Fp,wIe,nFr,xIe,kp,SIe,CIe,OIe,EIe,PIe,oFr,iFr,aFr,sFr,TIe,AIe,IIe,MIe,dy,fy,RIe,NIe,jIe,DIe,py,LIe,eP,SU,FIe,kIe,$Ie,BIe,my,CU,zIe,UIe,OU,EU,qIe,HIe,rM,VIe,WIe,KIe,qa,nM,uFr,tP=b(()=>{OD();fIe();gr();ZI();pie();SEt=async(t,e)=>{let r=QI,n;return n=nM({...SLr(t,e),[tM]:eFr,[rM]:eM}),XI(e,r,"/",void 0,n)},CEt=async(t,e)=>{let r=QI,n;return n=nM({...CLr(t,e),[tM]:tFr,[rM]:eM}),XI(e,r,"/",void 0,n)},OEt=async(t,e)=>{let r=QI,n;return n=nM({...OLr(t,e),[tM]:rFr,[rM]:eM}),XI(e,r,"/",void 0,n)},EEt=async(t,e)=>{let r=QI,n;return n=nM({...ELr(t,e),[tM]:nFr,[rM]:eM}),XI(e,r,"/",void 0,n)},PEt=async(t,e)=>{let r=QI,n;return n=nM({...PLr(t,e),[tM]:oFr,[rM]:eM}),XI(e,r,"/",void 0,n)},TEt=async(t,e)=>{let r=QI,n;return n=nM({...TLr(t,e),[tM]:iFr,[rM]:eM}),XI(e,r,"/",void 0,n)},AEt=async(t,e)=>{let r=QI,n;return n=nM({...ALr(t,e),[tM]:aFr,[rM]:eM}),XI(e,r,"/",void 0,n)},IEt=async(t,e)=>{let r=QI,n;return n=nM({...ILr(t,e),[tM]:sFr,[rM]:eM}),XI(e,r,"/",void 0,n)},MEt=async(t,e)=>{if(t.statusCode>=300)return YI(t,e);let r=await sw(t.body,e),n={};return n=LLr(r.AssumeRoleResult,e),{$metadata:Uf(t),...n}},REt=async(t,e)=>{if(t.statusCode>=300)return YI(t,e);let r=await sw(t.body,e),n={};return n=FLr(r.AssumeRoleWithSAMLResult,e),{$metadata:Uf(t),...n}},NEt=async(t,e)=>{if(t.statusCode>=300)return YI(t,e);let r=await sw(t.body,e),n={};return n=kLr(r.AssumeRoleWithWebIdentityResult,e),{$metadata:Uf(t),...n}},jEt=async(t,e)=>{if(t.statusCode>=300)return YI(t,e);let r=await sw(t.body,e),n={};return n=$Lr(r.DecodeAuthorizationMessageResult,e),{$metadata:Uf(t),...n}},DEt=async(t,e)=>{if(t.statusCode>=300)return YI(t,e);let r=await sw(t.body,e),n={};return n=ULr(r.GetAccessKeyInfoResult,e),{$metadata:Uf(t),...n}},LEt=async(t,e)=>{if(t.statusCode>=300)return YI(t,e);let r=await sw(t.body,e),n={};return n=qLr(r.GetCallerIdentityResult,e),{$metadata:Uf(t),...n}},FEt=async(t,e)=>{if(t.statusCode>=300)return YI(t,e);let r=await sw(t.body,e),n={};return n=HLr(r.GetFederationTokenResult,e),{$metadata:Uf(t),...n}},kEt=async(t,e)=>{if(t.statusCode>=300)return YI(t,e);let r=await sw(t.body,e),n={};return n=VLr(r.GetSessionTokenResult,e),{$metadata:Uf(t),...n}},YI=async(t,e)=>{let r={...t,body:await Rxt(t.body,e)},n=uFr(t,r.body);switch(n){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await hLr(r,e);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await vLr(r,e);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await wLr(r,e);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await xLr(r,e);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await yLr(r,e);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await _Lr(r,e);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await gLr(r,e);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await bLr(r,e);default:let o=r.body;return QLr({output:t,parsedBody:o.Error,errorCode:n})}},hLr=async(t,e)=>{let r=t.body,n=BLr(r.Error,e),o=new hW({$metadata:Uf(t),...n});return ls(o,r)},gLr=async(t,e)=>{let r=t.body,n=WLr(r.Error,e),o=new wW({$metadata:Uf(t),...n});return ls(o,r)},yLr=async(t,e)=>{let r=t.body,n=KLr(r.Error,e),o=new _W({$metadata:Uf(t),...n});return ls(o,r)},bLr=async(t,e)=>{let r=t.body,n=GLr(r.Error,e),o=new xW({$metadata:Uf(t),...n});return ls(o,r)},_Lr=async(t,e)=>{let r=t.body,n=JLr(r.Error,e),o=new vW({$metadata:Uf(t),...n});return ls(o,r)},vLr=async(t,e)=>{let r=t.body,n=ZLr(r.Error,e),o=new gW({$metadata:Uf(t),...n});return ls(o,r)},wLr=async(t,e)=>{let r=t.body,n=YLr(r.Error,e),o=new yW({$metadata:Uf(t),...n});return ls(o,r)},xLr=async(t,e)=>{let r=t.body,n=XLr(r.Error,e),o=new bW({$metadata:Uf(t),...n});return ls(o,r)},SLr=(t,e)=>{let r={};if(t[eP]!=null&&(r[eP]=t[eP]),t[SU]!=null&&(r[SU]=t[SU]),t[fy]!=null){let n=mie(t[fy],e);t[fy]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[dy]!=null&&(r[dy]=t[dy]),t[kp]!=null&&(r[kp]=t[kp]),t[OU]!=null){let n=$Et(t[OU],e);t[OU]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}if(t[qIe]!=null){let n=DLr(t[qIe],e);t[qIe]?.length===0&&(r.TransitiveTagKeys=[]),Object.entries(n).forEach(([o,i])=>{let a=`TransitiveTagKeys.${o}`;r[a]=i})}if(t[CIe]!=null&&(r[CIe]=t[CIe]),t[CU]!=null&&(r[CU]=t[CU]),t[EU]!=null&&(r[EU]=t[EU]),t[my]!=null&&(r[my]=t[my]),t[jIe]!=null){let n=NLr(t[jIe],e);t[jIe]?.length===0&&(r.ProvidedContexts=[]),Object.entries(n).forEach(([o,i])=>{let a=`ProvidedContexts.${o}`;r[a]=i})}return r},CLr=(t,e)=>{let r={};if(t[eP]!=null&&(r[eP]=t[eP]),t[RIe]!=null&&(r[RIe]=t[RIe]),t[$Ie]!=null&&(r[$Ie]=t[$Ie]),t[fy]!=null){let n=mie(t[fy],e);t[fy]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[dy]!=null&&(r[dy]=t[dy]),t[kp]!=null&&(r[kp]=t[kp]),r},OLr=(t,e)=>{let r={};if(t[eP]!=null&&(r[eP]=t[eP]),t[SU]!=null&&(r[SU]=t[SU]),t[WIe]!=null&&(r[WIe]=t[WIe]),t[DIe]!=null&&(r[DIe]=t[DIe]),t[fy]!=null){let n=mie(t[fy],e);t[fy]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[dy]!=null&&(r[dy]=t[dy]),t[kp]!=null&&(r[kp]=t[kp]),r},ELr=(t,e)=>{let r={};return t[OIe]!=null&&(r[OIe]=t[OIe]),r},PLr=(t,e)=>{let r={};return t[vU]!=null&&(r[vU]=t[vU]),r},TLr=(t,e)=>({}),ALr=(t,e)=>{let r={};if(t[IIe]!=null&&(r[IIe]=t[IIe]),t[dy]!=null&&(r[dy]=t[dy]),t[fy]!=null){let n=mie(t[fy],e);t[fy]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[kp]!=null&&(r[kp]=t[kp]),t[OU]!=null){let n=$Et(t[OU],e);t[OU]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}return r},ILr=(t,e)=>{let r={};return t[kp]!=null&&(r[kp]=t[kp]),t[CU]!=null&&(r[CU]=t[CU]),t[EU]!=null&&(r[EU]=t[EU]),r},mie=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=MLr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},MLr=(t,e)=>{let r={};return t[KIe]!=null&&(r[KIe]=t[KIe]),r},RLr=(t,e)=>{let r={};return t[NIe]!=null&&(r[NIe]=t[NIe]),t[wIe]!=null&&(r[wIe]=t[wIe]),r},NLr=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=RLr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},jLr=(t,e)=>{let r={};return t[AIe]!=null&&(r[AIe]=t[AIe]),t[VIe]!=null&&(r[VIe]=t[VIe]),r},DLr=(t,e)=>{let r={},n=1;for(let o of t)o!==null&&(r[`member.${n}`]=o,n++);return r},$Et=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=jLr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},GIe=(t,e)=>{let r={};return t[vIe]!=null&&(r[vIe]=In(t[vIe])),t[QE]!=null&&(r[QE]=In(t[QE])),r},LLr=(t,e)=>{let r={};return t[Fp]!=null&&(r[Fp]=SW(t[Fp],e)),t[XE]!=null&&(r[XE]=GIe(t[XE],e)),t[py]!=null&&(r[py]=Q5(t[py])),t[my]!=null&&(r[my]=In(t[my])),r},FLr=(t,e)=>{let r={};return t[Fp]!=null&&(r[Fp]=SW(t[Fp],e)),t[XE]!=null&&(r[XE]=GIe(t[XE],e)),t[py]!=null&&(r[py]=Q5(t[py])),t[FIe]!=null&&(r[FIe]=In(t[FIe])),t[zIe]!=null&&(r[zIe]=In(t[zIe])),t[TIe]!=null&&(r[TIe]=In(t[TIe])),t[xU]!=null&&(r[xU]=In(t[xU])),t[MIe]!=null&&(r[MIe]=In(t[MIe])),t[my]!=null&&(r[my]=In(t[my])),r},kLr=(t,e)=>{let r={};return t[Fp]!=null&&(r[Fp]=SW(t[Fp],e)),t[BIe]!=null&&(r[BIe]=In(t[BIe])),t[XE]!=null&&(r[XE]=GIe(t[XE],e)),t[py]!=null&&(r[py]=Q5(t[py])),t[LIe]!=null&&(r[LIe]=In(t[LIe])),t[xU]!=null&&(r[xU]=In(t[xU])),t[my]!=null&&(r[my]=In(t[my])),r},SW=(t,e)=>{let r={};return t[vU]!=null&&(r[vU]=In(t[vU])),t[kIe]!=null&&(r[kIe]=In(t[kIe])),t[UIe]!=null&&(r[UIe]=In(t[UIe])),t[SIe]!=null&&(r[SIe]=aU(Yvt(t[SIe]))),r},$Lr=(t,e)=>{let r={};return t[xIe]!=null&&(r[xIe]=In(t[xIe])),r},BLr=(t,e)=>{let r={};return t[qa]!=null&&(r[qa]=In(t[qa])),r},zLr=(t,e)=>{let r={};return t[PIe]!=null&&(r[PIe]=In(t[PIe])),t[QE]!=null&&(r[QE]=In(t[QE])),r},ULr=(t,e)=>{let r={};return t[wU]!=null&&(r[wU]=In(t[wU])),r},qLr=(t,e)=>{let r={};return t[HIe]!=null&&(r[HIe]=In(t[HIe])),t[wU]!=null&&(r[wU]=In(t[wU])),t[QE]!=null&&(r[QE]=In(t[QE])),r},HLr=(t,e)=>{let r={};return t[Fp]!=null&&(r[Fp]=SW(t[Fp],e)),t[EIe]!=null&&(r[EIe]=zLr(t[EIe],e)),t[py]!=null&&(r[py]=Q5(t[py])),r},VLr=(t,e)=>{let r={};return t[Fp]!=null&&(r[Fp]=SW(t[Fp],e)),r},WLr=(t,e)=>{let r={};return t[qa]!=null&&(r[qa]=In(t[qa])),r},KLr=(t,e)=>{let r={};return t[qa]!=null&&(r[qa]=In(t[qa])),r},GLr=(t,e)=>{let r={};return t[qa]!=null&&(r[qa]=In(t[qa])),r},JLr=(t,e)=>{let r={};return t[qa]!=null&&(r[qa]=In(t[qa])),r},ZLr=(t,e)=>{let r={};return t[qa]!=null&&(r[qa]=In(t[qa])),r},YLr=(t,e)=>{let r={};return t[qa]!=null&&(r[qa]=In(t[qa])),r},XLr=(t,e)=>{let r={};return t[qa]!=null&&(r[qa]=In(t[qa])),r},Uf=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"]}),QLr=Zne(Lp),XI=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 die(l)},QI={"content-type":"application/x-www-form-urlencoded"},eM="2011-06-15",tM="Action",vU="AccessKeyId",eFr="AssumeRole",vIe="AssumedRoleId",XE="AssumedRoleUser",tFr="AssumeRoleWithSAML",rFr="AssumeRoleWithWebIdentity",wU="Account",QE="Arn",xU="Audience",Fp="Credentials",wIe="ContextAssertion",nFr="DecodeAuthorizationMessage",xIe="DecodedMessage",kp="DurationSeconds",SIe="Expiration",CIe="ExternalId",OIe="EncodedMessage",EIe="FederatedUser",PIe="FederatedUserId",oFr="GetAccessKeyInfo",iFr="GetCallerIdentity",aFr="GetFederationToken",sFr="GetSessionToken",TIe="Issuer",AIe="Key",IIe="Name",MIe="NameQualifier",dy="Policy",fy="PolicyArns",RIe="PrincipalArn",NIe="ProviderArn",jIe="ProvidedContexts",DIe="ProviderId",py="PackedPolicySize",LIe="Provider",eP="RoleArn",SU="RoleSessionName",FIe="Subject",kIe="SecretAccessKey",$Ie="SAMLAssertion",BIe="SubjectFromWebIdentityToken",my="SourceIdentity",CU="SerialNumber",zIe="SubjectType",UIe="SessionToken",OU="Tags",EU="TokenCode",qIe="TransitiveTagKeys",HIe="UserId",rM="Version",VIe="Value",WIe="WebIdentityToken",KIe="arn",qa="message",nM=t=>Object.entries(t).map(([e,r])=>eoe(e)+"="+eoe(r)).join("&"),uFr=(t,e)=>{if(e.Error?.Code!==void 0)return e.Error.Code;if(t.statusCode==404)return"NotFound"}});var rP,hie=b(()=>{lo();wo();gr();dw();ZI();tP();rP=class extends Mt.classBuilder().ep({...Bf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,pIe).ser(SEt).de(MEt).build(){}});var CW,JIe=b(()=>{lo();wo();gr();dw();ZI();tP();CW=class extends Mt.classBuilder().ep({...Bf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").f(mIe,hIe).ser(CEt).de(REt).build(){}});var ED,gie=b(()=>{lo();wo();gr();dw();ZI();tP();ED=class extends Mt.classBuilder().ep({...Bf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(gIe,yIe).ser(OEt).de(NEt).build(){}});var OW,ZIe=b(()=>{lo();wo();gr();dw();tP();OW=class extends Mt.classBuilder().ep({...Bf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").f(void 0,void 0).ser(EEt).de(jEt).build(){}});var EW,YIe=b(()=>{lo();wo();gr();dw();tP();EW=class extends Mt.classBuilder().ep({...Bf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").f(void 0,void 0).ser(PEt).de(DEt).build(){}});var PW,XIe=b(()=>{lo();wo();gr();dw();tP();PW=class extends Mt.classBuilder().ep({...Bf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").f(void 0,void 0).ser(TEt).de(LEt).build(){}});var TW,QIe=b(()=>{lo();wo();gr();dw();ZI();tP();TW=class extends Mt.classBuilder().ep({...Bf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").f(void 0,bIe).ser(AEt).de(FEt).build(){}});var AW,eMe=b(()=>{lo();wo();gr();dw();ZI();tP();AW=class extends Mt.classBuilder().ep({...Bf}).m(function(e,r,n,o){return[Bt(n,this.serialize,this.deserialize),zt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").f(void 0,_Ie).ser(IEt).de(kEt).build(){}});var lFr,yie,BEt=b(()=>{gr();hie();JIe();gie();ZIe();YIe();XIe();QIe();eMe();mW();lFr={AssumeRoleCommand:rP,AssumeRoleWithSAMLCommand:CW,AssumeRoleWithWebIdentityCommand:ED,DecodeAuthorizationMessageCommand:OW,GetAccessKeyInfoCommand:EW,GetCallerIdentityCommand:PW,GetFederationTokenCommand:TW,GetSessionTokenCommand:AW},yie=class extends cy{};Gne(lFr,yie)});var zEt=b(()=>{hie();JIe();gie();ZIe();YIe();XIe();QIe();eMe()});var UEt=b(()=>{ZI()});var qEt,HEt,VEt,WEt,KEt,GEt,JEt=b(()=>{hie();gie();qEt="us-east-1",HEt=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},VEt=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)`,`${qEt} (STS default)`),n??o??qEt},WEt=(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 VEt(c,t?.parentClientConfig?.region,f),h=!GEt(d);r=new e({credentialDefaultProvider:()=>async()=>n,region:p,requestHandler:h?d:void 0,logger:l})}let{Credentials:a,AssumedRoleUser:s}=await r.send(new rP(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=HEt(s);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}}}},KEt=(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 VEt(u,t?.parentClientConfig?.region,c),f=!GEt(l);r=new e({region:d,requestHandler:f?l:void 0,logger:s})}let{Credentials:o,AssumedRoleUser:i}=await r.send(new ED(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=HEt(i);return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}}}},GEt=t=>t?.metadata?.handlerProtocol==="h2"});var ZEt,YEt,XEt,cFr,QEt=b(()=>{JEt();mW();ZEt=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,YEt=(t={},e)=>WEt(t,ZEt(cy,e)),XEt=(t={},e)=>KEt(t,ZEt(cy,e)),cFr=t=>e=>t({roleAssumer:YEt(e),roleAssumerWithWebIdentity:XEt(e),...e})});var ePt={};ns(ePt,{$Command:()=>Mt,AssumeRoleCommand:()=>rP,AssumeRoleResponseFilterSensitiveLog:()=>pIe,AssumeRoleWithSAMLCommand:()=>CW,AssumeRoleWithSAMLRequestFilterSensitiveLog:()=>mIe,AssumeRoleWithSAMLResponseFilterSensitiveLog:()=>hIe,AssumeRoleWithWebIdentityCommand:()=>ED,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:()=>gIe,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:()=>yIe,CredentialsFilterSensitiveLog:()=>_U,DecodeAuthorizationMessageCommand:()=>OW,ExpiredTokenException:()=>hW,GetAccessKeyInfoCommand:()=>EW,GetCallerIdentityCommand:()=>PW,GetFederationTokenCommand:()=>TW,GetFederationTokenResponseFilterSensitiveLog:()=>bIe,GetSessionTokenCommand:()=>AW,GetSessionTokenResponseFilterSensitiveLog:()=>_Ie,IDPCommunicationErrorException:()=>wW,IDPRejectedClaimException:()=>_W,InvalidAuthorizationMessageException:()=>xW,InvalidIdentityTokenException:()=>vW,MalformedPolicyDocumentException:()=>gW,PackedPolicyTooLargeException:()=>yW,RegionDisabledException:()=>bW,STS:()=>yie,STSClient:()=>cy,STSServiceException:()=>Lp,__Client:()=>yD,decorateDefaultCredentialProvider:()=>cFr,getDefaultRoleAssumer:()=>YEt,getDefaultRoleAssumerWithWebIdentity:()=>XEt});var tMe=b(()=>{mW();BEt();zEt();UEt();QEt();pie()});var tPt={};ns(tPt,{AssumeRoleCommand:()=>rP,STSClient:()=>cy});var rPt=b(()=>{tMe()});var dFr,nPt=b(()=>{VE();dFr=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 uc("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(()=>(rPt(),tPt));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 uc(`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 oPt=b(()=>{});var iPt,aPt=b(()=>{iPt=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(()=>(tMe(),ePt));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 sPt=b(()=>{oPt();aPt()});var fFr,uPt=b(()=>{sPt();fFr=t=>iPt({...t})});var lPt={};ns(lPt,{fromCognitoIdentity:()=>oLr,fromCognitoIdentityPool:()=>iLr,fromHttp:()=>aIe,fromTemporaryCredentials:()=>dFr,fromWebToken:()=>fFr});var cPt=b(()=>{tOt();rOt();wOt();nPt();uPt()});var PD={};ns(PD,{__addDisposableResource:()=>MPt,__assign:()=>bie,__asyncDelegator:()=>SPt,__asyncGenerator:()=>xPt,__asyncValues:()=>CPt,__await:()=>PU,__awaiter:()=>gPt,__classPrivateFieldGet:()=>TPt,__classPrivateFieldIn:()=>IPt,__classPrivateFieldSet:()=>APt,__createBinding:()=>vie,__decorate:()=>pPt,__disposeResources:()=>RPt,__esDecorate:()=>pFr,__exportStar:()=>bPt,__extends:()=>dPt,__generator:()=>yPt,__importDefault:()=>PPt,__importStar:()=>EPt,__makeTemplateObject:()=>OPt,__metadata:()=>hPt,__param:()=>mPt,__propKey:()=>hFr,__read:()=>nMe,__rest:()=>fPt,__runInitializers:()=>mFr,__setFunctionName:()=>gFr,__spread:()=>_Pt,__spreadArray:()=>wPt,__spreadArrays:()=>vPt,__values:()=>_ie,default:()=>_Fr});function dPt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");rMe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function fPt(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 pPt(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 mPt(t,e){return function(r,n){e(r,n,t)}}function pFr(t,e,r,n,o,i){function a(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}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 h={};for(var m in n)h[m]=m==="access"?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(y){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(y||null))};var g=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],h);if(s==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(d=a(g.get))&&(c.get=d),(d=a(g.set))&&(c.set=d),(d=a(g.init))&&o.unshift(d)}else(d=a(g))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function mFr(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 hFr(t){return typeof t=="symbol"?t:"".concat(t)}function gFr(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 hPt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function gPt(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 yPt(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 bPt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vie(e,t,r)}function _ie(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 nMe(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 _Pt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(nMe(arguments[e]));return t}function vPt(){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 wPt(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 PU(t){return this instanceof PU?(this.v=t,this):new PU(t)}function xPt(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(h){return Promise.resolve(h).then(p,d)}}function s(p,h){n[p]&&(o[p]=function(m){return new Promise(function(g,y){i.push([p,m,g,y])>1||u(p,m)})},h&&(o[p]=h(o[p])))}function u(p,h){try{l(n[p](h))}catch(m){f(i[0][3],m)}}function l(p){p.value instanceof PU?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,h){p(h),i.shift(),i.length&&u(i[0][0],i[0][1])}}function SPt(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:PU(t[o](a)),done:!1}:i?i(a):a}:i}}function CPt(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 _ie=="function"?_ie(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 OPt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function EPt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vie(e,t,r);return yFr(e,t),e}function PPt(t){return t&&t.__esModule?t:{default:t}}function TPt(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 APt(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 IPt(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 MPt(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 RPt(t){function e(i){t.error=t.hasError?new bFr(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 rMe,bie,vie,yFr,bFr,_Fr,TD=b(()=>{rMe=function(t,e){return rMe=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])},rMe(t,e)};bie=function(){return bie=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},bie.apply(this,arguments)};vie=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};yFr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};bFr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};_Fr={__extends:dPt,__assign:bie,__rest:fPt,__decorate:pPt,__param:mPt,__metadata:hPt,__awaiter:gPt,__generator:yPt,__createBinding:vie,__exportStar:bPt,__values:_ie,__read:nMe,__spread:_Pt,__spreadArrays:vPt,__spreadArray:wPt,__await:PU,__asyncGenerator:xPt,__asyncDelegator:SPt,__asyncValues:CPt,__makeTemplateObject:OPt,__importStar:EPt,__importDefault:PPt,__classPrivateFieldGet:TPt,__classPrivateFieldSet:APt,__classPrivateFieldIn:IPt,__addDisposableResource:MPt,__disposeResources:RPt}});var jPt=x(NPt=>{"use strict";Object.defineProperty(NPt,"__esModule",{value:!0})});var DPt=x(IW=>{"use strict";Object.defineProperty(IW,"__esModule",{value:!0});IW.HttpAuthLocation=void 0;var vFr;(function(t){t.HEADER="header",t.QUERY="query"})(vFr=IW.HttpAuthLocation||(IW.HttpAuthLocation={}))});var FPt=x(LPt=>{"use strict";Object.defineProperty(LPt,"__esModule",{value:!0})});var $Pt=x(kPt=>{"use strict";Object.defineProperty(kPt,"__esModule",{value:!0})});var zPt=x(BPt=>{"use strict";Object.defineProperty(BPt,"__esModule",{value:!0})});var qPt=x(UPt=>{"use strict";Object.defineProperty(UPt,"__esModule",{value:!0})});var VPt=x(HPt=>{"use strict";Object.defineProperty(HPt,"__esModule",{value:!0})});var KPt=x(WPt=>{"use strict";Object.defineProperty(WPt,"__esModule",{value:!0})});var JPt=x(GPt=>{"use strict";Object.defineProperty(GPt,"__esModule",{value:!0})});var ZPt=x(MW=>{"use strict";Object.defineProperty(MW,"__esModule",{value:!0});var oMe=(TD(),Mc(PD));oMe.__exportStar(VPt(),MW);oMe.__exportStar(KPt(),MW);oMe.__exportStar(JPt(),MW)});var XPt=x(YPt=>{"use strict";Object.defineProperty(YPt,"__esModule",{value:!0})});var eTt=x(QPt=>{"use strict";Object.defineProperty(QPt,"__esModule",{value:!0})});var tTt=x(RW=>{"use strict";Object.defineProperty(RW,"__esModule",{value:!0});RW.EndpointURLScheme=void 0;var wFr;(function(t){t.HTTP="http",t.HTTPS="https"})(wFr=RW.EndpointURLScheme||(RW.EndpointURLScheme={}))});var nTt=x(rTt=>{"use strict";Object.defineProperty(rTt,"__esModule",{value:!0})});var iTt=x(oTt=>{"use strict";Object.defineProperty(oTt,"__esModule",{value:!0})});var sTt=x(aTt=>{"use strict";Object.defineProperty(aTt,"__esModule",{value:!0})});var lTt=x(uTt=>{"use strict";Object.defineProperty(uTt,"__esModule",{value:!0})});var dTt=x(cTt=>{"use strict";Object.defineProperty(cTt,"__esModule",{value:!0})});var fTt=x(AD=>{"use strict";Object.defineProperty(AD,"__esModule",{value:!0});var NW=(TD(),Mc(PD));NW.__exportStar(nTt(),AD);NW.__exportStar(iTt(),AD);NW.__exportStar(sTt(),AD);NW.__exportStar(lTt(),AD);NW.__exportStar(dTt(),AD)});var mTt=x(pTt=>{"use strict";Object.defineProperty(pTt,"__esModule",{value:!0})});var hTt=x(jW=>{"use strict";Object.defineProperty(jW,"__esModule",{value:!0});jW.FieldPosition=void 0;var xFr;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(xFr=jW.FieldPosition||(jW.FieldPosition={}))});var yTt=x(gTt=>{"use strict";Object.defineProperty(gTt,"__esModule",{value:!0})});var _Tt=x(bTt=>{"use strict";Object.defineProperty(bTt,"__esModule",{value:!0})});var wTt=x(wie=>{"use strict";Object.defineProperty(wie,"__esModule",{value:!0});var vTt=(TD(),Mc(PD));vTt.__exportStar(yTt(),wie);vTt.__exportStar(_Tt(),wie)});var STt=x(xTt=>{"use strict";Object.defineProperty(xTt,"__esModule",{value:!0})});var OTt=x(CTt=>{"use strict";Object.defineProperty(CTt,"__esModule",{value:!0})});var PTt=x(ETt=>{"use strict";Object.defineProperty(ETt,"__esModule",{value:!0})});var ATt=x(TTt=>{"use strict";Object.defineProperty(TTt,"__esModule",{value:!0})});var MTt=x(ITt=>{"use strict";Object.defineProperty(ITt,"__esModule",{value:!0})});var NTt=x(RTt=>{"use strict";Object.defineProperty(RTt,"__esModule",{value:!0})});var DTt=x(jTt=>{"use strict";Object.defineProperty(jTt,"__esModule",{value:!0})});var FTt=x(LTt=>{"use strict";Object.defineProperty(LTt,"__esModule",{value:!0})});var $Tt=x(kTt=>{"use strict";Object.defineProperty(kTt,"__esModule",{value:!0})});var zTt=x(BTt=>{"use strict";Object.defineProperty(BTt,"__esModule",{value:!0})});var qTt=x(UTt=>{"use strict";Object.defineProperty(UTt,"__esModule",{value:!0})});var VTt=x(HTt=>{"use strict";Object.defineProperty(HTt,"__esModule",{value:!0})});var KTt=x(WTt=>{"use strict";Object.defineProperty(WTt,"__esModule",{value:!0})});var GTt=x(DW=>{"use strict";Object.defineProperty(DW,"__esModule",{value:!0});DW.RequestHandlerProtocol=void 0;var SFr;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(SFr=DW.RequestHandlerProtocol||(DW.RequestHandlerProtocol={}))});var ZTt=x(JTt=>{"use strict";Object.defineProperty(JTt,"__esModule",{value:!0})});var XTt=x(YTt=>{"use strict";Object.defineProperty(YTt,"__esModule",{value:!0})});var eAt=x(QTt=>{"use strict";Object.defineProperty(QTt,"__esModule",{value:!0})});var rAt=x(tAt=>{"use strict";Object.defineProperty(tAt,"__esModule",{value:!0})});var oAt=x(nAt=>{"use strict";Object.defineProperty(nAt,"__esModule",{value:!0})});var iAt=x(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});var Fo=(TD(),Mc(PD));Fo.__exportStar(jPt(),co);Fo.__exportStar(DPt(),co);Fo.__exportStar(FPt(),co);Fo.__exportStar($Pt(),co);Fo.__exportStar(zPt(),co);Fo.__exportStar(qPt(),co);Fo.__exportStar(ZPt(),co);Fo.__exportStar(XPt(),co);Fo.__exportStar(eTt(),co);Fo.__exportStar(tTt(),co);Fo.__exportStar(fTt(),co);Fo.__exportStar(mTt(),co);Fo.__exportStar(hTt(),co);Fo.__exportStar(wTt(),co);Fo.__exportStar(STt(),co);Fo.__exportStar(OTt(),co);Fo.__exportStar(PTt(),co);Fo.__exportStar(ATt(),co);Fo.__exportStar(MTt(),co);Fo.__exportStar(NTt(),co);Fo.__exportStar(DTt(),co);Fo.__exportStar(FTt(),co);Fo.__exportStar($Tt(),co);Fo.__exportStar(zTt(),co);Fo.__exportStar(qTt(),co);Fo.__exportStar(VTt(),co);Fo.__exportStar(KTt(),co);Fo.__exportStar(GTt(),co);Fo.__exportStar(ZTt(),co);Fo.__exportStar(XTt(),co);Fo.__exportStar(eAt(),co);Fo.__exportStar(rAt(),co);Fo.__exportStar(oAt(),co)});var aAt=x(xie=>{"use strict";Object.defineProperty(xie,"__esModule",{value:!0});xie.Field=void 0;var CFr=iAt(),iMe=class{constructor({name:e,kind:r=CFr.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}};xie.Field=iMe});var sAt=x(Sie=>{"use strict";Object.defineProperty(Sie,"__esModule",{value:!0});Sie.Fields=void 0;var aMe=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)}};Sie.Fields=aMe});var lAt=x(uAt=>{"use strict";Object.defineProperty(uAt,"__esModule",{value:!0})});var cAt=x(Cie=>{"use strict";Object.defineProperty(Cie,"__esModule",{value:!0});Cie.HttpRequest=void 0;var sMe=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=OFr(e.query)),e}};Cie.HttpRequest=sMe;function OFr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}});var dAt=x(Oie=>{"use strict";Object.defineProperty(Oie,"__esModule",{value:!0});Oie.HttpResponse=void 0;var uMe=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"}};Oie.HttpResponse=uMe});var fAt=x(Eie=>{"use strict";Object.defineProperty(Eie,"__esModule",{value:!0});Eie.isValidHostname=void 0;function EFr(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}Eie.isValidHostname=EFr});var mAt=x(pAt=>{"use strict";Object.defineProperty(pAt,"__esModule",{value:!0})});var hAt=x(nP=>{"use strict";Object.defineProperty(nP,"__esModule",{value:!0});var ID=(TD(),Mc(PD));ID.__exportStar(aAt(),nP);ID.__exportStar(sAt(),nP);ID.__exportStar(lAt(),nP);ID.__exportStar(cAt(),nP);ID.__exportStar(dAt(),nP);ID.__exportStar(fAt(),nP);ID.__exportStar(mAt(),nP)});var gAt=x(lMe=>{"use strict";Object.defineProperty(lMe,"__esModule",{value:!0});var PFr=(TD(),Mc(PD));PFr.__exportStar(hAt(),lMe)});var MD={};ns(MD,{__addDisposableResource:()=>FAt,__assign:()=>Pie,__asyncDelegator:()=>AAt,__asyncGenerator:()=>TAt,__asyncValues:()=>IAt,__await:()=>TU,__awaiter:()=>xAt,__classPrivateFieldGet:()=>jAt,__classPrivateFieldIn:()=>LAt,__classPrivateFieldSet:()=>DAt,__createBinding:()=>Aie,__decorate:()=>_At,__disposeResources:()=>kAt,__esDecorate:()=>TFr,__exportStar:()=>CAt,__extends:()=>yAt,__generator:()=>SAt,__importDefault:()=>NAt,__importStar:()=>RAt,__makeTemplateObject:()=>MAt,__metadata:()=>wAt,__param:()=>vAt,__propKey:()=>IFr,__read:()=>dMe,__rest:()=>bAt,__runInitializers:()=>AFr,__setFunctionName:()=>MFr,__spread:()=>OAt,__spreadArray:()=>PAt,__spreadArrays:()=>EAt,__values:()=>Tie,default:()=>jFr});function yAt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");cMe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function bAt(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 _At(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 vAt(t,e){return function(r,n){e(r,n,t)}}function TFr(t,e,r,n,o,i){function a(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}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 h={};for(var m in n)h[m]=m==="access"?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(y){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(y||null))};var g=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],h);if(s==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(d=a(g.get))&&(c.get=d),(d=a(g.set))&&(c.set=d),(d=a(g.init))&&o.unshift(d)}else(d=a(g))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function AFr(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 IFr(t){return typeof t=="symbol"?t:"".concat(t)}function MFr(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 wAt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function xAt(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 SAt(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 CAt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Aie(e,t,r)}function Tie(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 dMe(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 OAt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(dMe(arguments[e]));return t}function EAt(){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 PAt(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 TU(t){return this instanceof TU?(this.v=t,this):new TU(t)}function TAt(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(h){return Promise.resolve(h).then(p,d)}}function s(p,h){n[p]&&(o[p]=function(m){return new Promise(function(g,y){i.push([p,m,g,y])>1||u(p,m)})},h&&(o[p]=h(o[p])))}function u(p,h){try{l(n[p](h))}catch(m){f(i[0][3],m)}}function l(p){p.value instanceof TU?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,h){p(h),i.shift(),i.length&&u(i[0][0],i[0][1])}}function AAt(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:TU(t[o](a)),done:!1}:i?i(a):a}:i}}function IAt(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 Tie=="function"?Tie(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 MAt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function RAt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Aie(e,t,r);return RFr(e,t),e}function NAt(t){return t&&t.__esModule?t:{default:t}}function jAt(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 DAt(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 LAt(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 FAt(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 kAt(t){function e(i){t.error=t.hasError?new NFr(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 cMe,Pie,Aie,RFr,NFr,jFr,RD=b(()=>{cMe=function(t,e){return cMe=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])},cMe(t,e)};Pie=function(){return Pie=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},Pie.apply(this,arguments)};Aie=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};RFr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};NFr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};jFr={__extends:yAt,__assign:Pie,__rest:bAt,__decorate:_At,__param:vAt,__metadata:wAt,__awaiter:xAt,__generator:SAt,__createBinding:Aie,__exportStar:CAt,__values:Tie,__read:dMe,__spread:OAt,__spreadArrays:EAt,__spreadArray:PAt,__await:TU,__asyncGenerator:TAt,__asyncDelegator:AAt,__asyncValues:IAt,__makeTemplateObject:MAt,__importStar:RAt,__importDefault:NAt,__classPrivateFieldGet:jAt,__classPrivateFieldSet:DAt,__classPrivateFieldIn:LAt,__addDisposableResource:FAt,__disposeResources:kAt}});var hMe={};ns(hMe,{__assign:()=>pMe,__asyncDelegator:()=>KFr,__asyncGenerator:()=>WFr,__asyncValues:()=>GFr,__await:()=>LW,__awaiter:()=>BFr,__classPrivateFieldGet:()=>XFr,__classPrivateFieldSet:()=>QFr,__createBinding:()=>UFr,__decorate:()=>FFr,__exportStar:()=>qFr,__extends:()=>DFr,__generator:()=>zFr,__importDefault:()=>YFr,__importStar:()=>ZFr,__makeTemplateObject:()=>JFr,__metadata:()=>$Fr,__param:()=>kFr,__read:()=>$At,__rest:()=>LFr,__spread:()=>HFr,__spreadArrays:()=>VFr,__values:()=>mMe});function DFr(t,e){fMe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function LFr(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 FFr(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 kFr(t,e){return function(r,n){e(r,n,t)}}function $Fr(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function BFr(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 zFr(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 UFr(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function qFr(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function mMe(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 $At(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 HFr(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat($At(arguments[e]));return t}function VFr(){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 LW(t){return this instanceof LW?(this.v=t,this):new LW(t)}function WFr(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(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof LW?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 KFr(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:LW(t[o](a)),done:o==="return"}:i?i(a):a}:i}}function GFr(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 mMe=="function"?mMe(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 JFr(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ZFr(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 YFr(t){return t&&t.__esModule?t:{default:t}}function XFr(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function QFr(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 fMe,pMe,gMe=b(()=>{fMe=function(t,e){return fMe=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])},fMe(t,e)};pMe=function(){return pMe=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},pMe.apply(this,arguments)}});var BAt=x(AU=>{"use strict";Object.defineProperty(AU,"__esModule",{value:!0});AU.toUtf8=AU.fromUtf8=void 0;var ekr=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)};AU.fromUtf8=ekr;var tkr=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};AU.toUtf8=tkr});var zAt=x(IU=>{"use strict";Object.defineProperty(IU,"__esModule",{value:!0});IU.toUtf8=IU.fromUtf8=void 0;function rkr(t){return new TextEncoder().encode(t)}IU.fromUtf8=rkr;function nkr(t){return new TextDecoder("utf-8").decode(t)}IU.toUtf8=nkr});var HAt=x(MU=>{"use strict";Object.defineProperty(MU,"__esModule",{value:!0});MU.toUtf8=MU.fromUtf8=void 0;var UAt=BAt(),qAt=zAt(),okr=t=>typeof TextEncoder=="function"?(0,qAt.fromUtf8)(t):(0,UAt.fromUtf8)(t);MU.fromUtf8=okr;var ikr=t=>typeof TextDecoder=="function"?(0,qAt.toUtf8)(t):(0,UAt.toUtf8)(t);MU.toUtf8=ikr});var VAt=x(Iie=>{"use strict";Object.defineProperty(Iie,"__esModule",{value:!0});Iie.convertToBuffer=void 0;var akr=HAt(),skr=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:akr.fromUtf8;function ukr(t){return t instanceof Uint8Array?t:typeof t=="string"?skr(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}Iie.convertToBuffer=ukr});var WAt=x(Mie=>{"use strict";Object.defineProperty(Mie,"__esModule",{value:!0});Mie.isEmptyData=void 0;function lkr(t){return typeof t=="string"?t.length===0:t.byteLength===0}Mie.isEmptyData=lkr});var KAt=x(Rie=>{"use strict";Object.defineProperty(Rie,"__esModule",{value:!0});Rie.numToUint8=void 0;function ckr(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}Rie.numToUint8=ckr});var GAt=x(Nie=>{"use strict";Object.defineProperty(Nie,"__esModule",{value:!0});Nie.uint32ArrayFrom=void 0;function dkr(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)}Nie.uint32ArrayFrom=dkr});var yMe=x(pw=>{"use strict";Object.defineProperty(pw,"__esModule",{value:!0});pw.uint32ArrayFrom=pw.numToUint8=pw.isEmptyData=pw.convertToBuffer=void 0;var fkr=VAt();Object.defineProperty(pw,"convertToBuffer",{enumerable:!0,get:function(){return fkr.convertToBuffer}});var pkr=WAt();Object.defineProperty(pw,"isEmptyData",{enumerable:!0,get:function(){return pkr.isEmptyData}});var mkr=KAt();Object.defineProperty(pw,"numToUint8",{enumerable:!0,get:function(){return mkr.numToUint8}});var hkr=GAt();Object.defineProperty(pw,"uint32ArrayFrom",{enumerable:!0,get:function(){return hkr.uint32ArrayFrom}})});var YAt=x(jie=>{"use strict";Object.defineProperty(jie,"__esModule",{value:!0});jie.AwsCrc32=void 0;var JAt=(gMe(),Mc(hMe)),bMe=yMe(),ZAt=Die(),gkr=function(){function t(){this.crc32=new ZAt.Crc32}return t.prototype.update=function(e){(0,bMe.isEmptyData)(e)||this.crc32.update((0,bMe.convertToBuffer)(e))},t.prototype.digest=function(){return JAt.__awaiter(this,void 0,void 0,function(){return JAt.__generator(this,function(e){return[2,(0,bMe.numToUint8)(this.crc32.digest())]})})},t.prototype.reset=function(){this.crc32=new ZAt.Crc32},t}();jie.AwsCrc32=gkr});var Die=x(oM=>{"use strict";Object.defineProperty(oM,"__esModule",{value:!0});oM.AwsCrc32=oM.Crc32=oM.crc32=void 0;var ykr=(gMe(),Mc(hMe)),bkr=yMe();function _kr(t){return new XAt().update(t).digest()}oM.crc32=_kr;var XAt=function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var r,n;try{for(var o=ykr.__values(e),i=o.next();!i.done;i=o.next()){var a=i.value;this.checksum=this.checksum>>>8^wkr[(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}();oM.Crc32=XAt;var vkr=[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],wkr=(0,bkr.uint32ArrayFrom)(vkr),xkr=YAt();Object.defineProperty(oM,"AwsCrc32",{enumerable:!0,get:function(){return xkr.AwsCrc32}})});var NU=x(RU=>{"use strict";Object.defineProperty(RU,"__esModule",{value:!0});RU.toHex=RU.fromHex=void 0;var QAt={},_Me={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),QAt[t]=e,_Me[e]=t}function Skr(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 _Me)e[r/2]=_Me[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}RU.fromHex=Skr;function Ckr(t){let e="";for(let r=0;r<t.byteLength;r++)e+=QAt[t[r]];return e}RU.toHex=Ckr});var wMe=x(Lie=>{"use strict";Object.defineProperty(Lie,"__esModule",{value:!0});Lie.Int64=void 0;var Okr=NU(),vMe=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&&eIt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&eIt(e),parseInt((0,Okr.toHex)(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};Lie.Int64=vMe;function eIt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}});var CMe=x(Fie=>{"use strict";Object.defineProperty(Fie,"__esModule",{value:!0});Fie.HeaderMarshaller=void 0;var jU=NU(),xMe=wMe(),SMe=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(xMe.Int64.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!jkr.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set((0,jU.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:rIt,value:!0};break;case 1:r[i]={type:rIt,value:!1};break;case 2:r[i]={type:Ekr,value:e.getInt8(n++)};break;case 3:r[i]={type:Pkr,value:e.getInt16(n,!1)},n+=2;break;case 4:r[i]={type:Tkr,value:e.getInt32(n,!1)},n+=4;break;case 5:r[i]={type:Akr,value:new xMe.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:Ikr,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:Mkr,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,s))},n+=s;break;case 8:r[i]={type:Rkr,value:new Date(new xMe.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:Nkr,value:`${(0,jU.toHex)(u.subarray(0,4))}-${(0,jU.toHex)(u.subarray(4,6))}-${(0,jU.toHex)(u.subarray(6,8))}-${(0,jU.toHex)(u.subarray(8,10))}-${(0,jU.toHex)(u.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};Fie.HeaderMarshaller=SMe;var tIt;(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"})(tIt||(tIt={}));var rIt="boolean",Ekr="byte",Pkr="short",Tkr="integer",Akr="long",Ikr="binary",Mkr="string",Rkr="timestamp",Nkr="uuid",jkr=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});var oIt=x(kie=>{"use strict";Object.defineProperty(kie,"__esModule",{value:!0});kie.splitMessage=void 0;var Dkr=Die(),nIt=4,iM=nIt*2,ND=4,Lkr=iM+ND*2;function Fkr({byteLength:t,byteOffset:e,buffer:r}){if(t<Lkr)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(nIt,!1),a=n.getUint32(iM,!1),s=n.getUint32(t-ND,!1),u=new Dkr.Crc32().update(new Uint8Array(r,e,iM));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+iM,t-(iM+ND))),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+iM+ND,i),body:new Uint8Array(r,e+iM+ND+i,o-i-(iM+ND+ND))}}kie.splitMessage=Fkr});var iIt=x($ie=>{"use strict";Object.defineProperty($ie,"__esModule",{value:!0});$ie.EventStreamCodec=void 0;var kkr=Die(),$kr=CMe(),Bkr=oIt(),OMe=class{constructor(e,r){this.headerMarshaller=new $kr.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 kkr.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,Bkr.splitMessage)(e);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}};$ie.EventStreamCodec=OMe});var sIt=x(aIt=>{"use strict";Object.defineProperty(aIt,"__esModule",{value:!0})});var uIt=x(Bie=>{"use strict";Object.defineProperty(Bie,"__esModule",{value:!0});Bie.MessageDecoderStream=void 0;var EMe=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)}};Bie.MessageDecoderStream=EMe});var lIt=x(zie=>{"use strict";Object.defineProperty(zie,"__esModule",{value:!0});zie.MessageEncoderStream=void 0;var PMe=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))}};zie.MessageEncoderStream=PMe});var cIt=x(Uie=>{"use strict";Object.defineProperty(Uie,"__esModule",{value:!0});Uie.SmithyMessageDecoderStream=void 0;var TMe=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)}}};Uie.SmithyMessageDecoderStream=TMe});var dIt=x(qie=>{"use strict";Object.defineProperty(qie,"__esModule",{value:!0});qie.SmithyMessageEncoderStream=void 0;var AMe=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)}};qie.SmithyMessageEncoderStream=AMe});var fIt=x(mw=>{"use strict";Object.defineProperty(mw,"__esModule",{value:!0});var aM=(RD(),Mc(MD));aM.__exportStar(iIt(),mw);aM.__exportStar(CMe(),mw);aM.__exportStar(wMe(),mw);aM.__exportStar(sIt(),mw);aM.__exportStar(uIt(),mw);aM.__exportStar(lIt(),mw);aM.__exportStar(cIt(),mw);aM.__exportStar(dIt(),mw)});var pIt=x(Hie=>{"use strict";Object.defineProperty(Hie,"__esModule",{value:!0});Hie.normalizeProvider=void 0;var zkr=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};Hie.normalizeProvider=zkr});var mIt=x(IMe=>{"use strict";Object.defineProperty(IMe,"__esModule",{value:!0});var Ukr=(RD(),Mc(MD));Ukr.__exportStar(pIt(),IMe)});var MMe=x(Vie=>{"use strict";Object.defineProperty(Vie,"__esModule",{value:!0});Vie.isArrayBuffer=void 0;var qkr=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";Vie.isArrayBuffer=qkr});var NMe=x(DU=>{"use strict";Object.defineProperty(DU,"__esModule",{value:!0});DU.fromString=DU.fromArrayBuffer=void 0;var Hkr=MMe(),RMe=Tm(),Vkr=(t,e=0,r=t.byteLength-e)=>{if(!(0,Hkr.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return RMe.Buffer.from(t,e,r)};DU.fromArrayBuffer=Vkr;var Wkr=(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)};DU.fromString=Wkr});var jMe=x(Wie=>{"use strict";Object.defineProperty(Wie,"__esModule",{value:!0});Wie.fromUtf8=void 0;var Kkr=NMe(),Gkr=t=>{let e=(0,Kkr.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)};Wie.fromUtf8=Gkr});var hIt=x(Kie=>{"use strict";Object.defineProperty(Kie,"__esModule",{value:!0});Kie.toUint8Array=void 0;var Jkr=jMe(),Zkr=t=>typeof t=="string"?(0,Jkr.fromUtf8)(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t);Kie.toUint8Array=Zkr});var gIt=x(Gie=>{"use strict";Object.defineProperty(Gie,"__esModule",{value:!0});Gie.toUtf8=void 0;var Ykr=NMe(),Xkr=t=>(0,Ykr.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8");Gie.toUtf8=Xkr});var Jie=x(FW=>{"use strict";Object.defineProperty(FW,"__esModule",{value:!0});var DMe=(RD(),Mc(MD));DMe.__exportStar(jMe(),FW);DMe.__exportStar(hIt(),FW);DMe.__exportStar(gIt(),FW)});var jD=x(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.MAX_PRESIGNED_TTL=Ut.KEY_TYPE_IDENTIFIER=Ut.MAX_CACHE_SIZE=Ut.UNSIGNED_PAYLOAD=Ut.EVENT_ALGORITHM_IDENTIFIER=Ut.ALGORITHM_IDENTIFIER_V4A=Ut.ALGORITHM_IDENTIFIER=Ut.UNSIGNABLE_PATTERNS=Ut.SEC_HEADER_PATTERN=Ut.PROXY_HEADER_PATTERN=Ut.ALWAYS_UNSIGNABLE_HEADERS=Ut.HOST_HEADER=Ut.TOKEN_HEADER=Ut.SHA256_HEADER=Ut.SIGNATURE_HEADER=Ut.GENERATED_HEADERS=Ut.DATE_HEADER=Ut.AMZ_DATE_HEADER=Ut.AUTH_HEADER=Ut.REGION_SET_PARAM=Ut.TOKEN_QUERY_PARAM=Ut.SIGNATURE_QUERY_PARAM=Ut.EXPIRES_QUERY_PARAM=Ut.SIGNED_HEADERS_QUERY_PARAM=Ut.AMZ_DATE_QUERY_PARAM=Ut.CREDENTIAL_QUERY_PARAM=Ut.ALGORITHM_QUERY_PARAM=void 0;Ut.ALGORITHM_QUERY_PARAM="X-Amz-Algorithm";Ut.CREDENTIAL_QUERY_PARAM="X-Amz-Credential";Ut.AMZ_DATE_QUERY_PARAM="X-Amz-Date";Ut.SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders";Ut.EXPIRES_QUERY_PARAM="X-Amz-Expires";Ut.SIGNATURE_QUERY_PARAM="X-Amz-Signature";Ut.TOKEN_QUERY_PARAM="X-Amz-Security-Token";Ut.REGION_SET_PARAM="X-Amz-Region-Set";Ut.AUTH_HEADER="authorization";Ut.AMZ_DATE_HEADER=Ut.AMZ_DATE_QUERY_PARAM.toLowerCase();Ut.DATE_HEADER="date";Ut.GENERATED_HEADERS=[Ut.AUTH_HEADER,Ut.AMZ_DATE_HEADER,Ut.DATE_HEADER];Ut.SIGNATURE_HEADER=Ut.SIGNATURE_QUERY_PARAM.toLowerCase();Ut.SHA256_HEADER="x-amz-content-sha256";Ut.TOKEN_HEADER=Ut.TOKEN_QUERY_PARAM.toLowerCase();Ut.HOST_HEADER="host";Ut.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};Ut.PROXY_HEADER_PATTERN=/^proxy-/;Ut.SEC_HEADER_PATTERN=/^sec-/;Ut.UNSIGNABLE_PATTERNS=[/^proxy-/i,/^sec-/i];Ut.ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256";Ut.ALGORITHM_IDENTIFIER_V4A="AWS4-ECDSA-P256-SHA256";Ut.EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD";Ut.UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD";Ut.MAX_CACHE_SIZE=50;Ut.KEY_TYPE_IDENTIFIER="aws4_request";Ut.MAX_PRESIGNED_TTL=60*60*24*7});var FMe=x(sM=>{"use strict";Object.defineProperty(sM,"__esModule",{value:!0});sM.clearCredentialCache=sM.getSigningKey=sM.createScope=void 0;var Qkr=NU(),e$r=Jie(),LMe=jD(),LU={},Zie=[],t$r=(t,e,r)=>`${t}/${e}/${r}/${LMe.KEY_TYPE_IDENTIFIER}`;sM.createScope=t$r;var r$r=async(t,e,r,n,o)=>{let i=await yIt(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${(0,Qkr.toHex)(i)}:${e.sessionToken}`;if(a in LU)return LU[a];for(Zie.push(a);Zie.length>LMe.MAX_CACHE_SIZE;)delete LU[Zie.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,LMe.KEY_TYPE_IDENTIFIER])s=await yIt(t,s,u);return LU[a]=s};sM.getSigningKey=r$r;var n$r=()=>{Zie.length=0,Object.keys(LU).forEach(t=>{delete LU[t]})};sM.clearCredentialCache=n$r;var yIt=(t,e,r)=>{let n=new t(e);return n.update((0,e$r.toUint8Array)(r)),n.digest()}});var $Me=x(Yie=>{"use strict";Object.defineProperty(Yie,"__esModule",{value:!0});Yie.getCanonicalHeaders=void 0;var kMe=jD(),o$r=({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 kMe.ALWAYS_UNSIGNABLE_HEADERS||e?.has(i)||kMe.PROXY_HEADER_PATTERN.test(i)||kMe.SEC_HEADER_PATTERN.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n};Yie.getCanonicalHeaders=o$r});var BMe=x(Xie=>{"use strict";Object.defineProperty(Xie,"__esModule",{value:!0});Xie.escapeUri=void 0;var i$r=t=>encodeURIComponent(t).replace(/[!'()*]/g,a$r);Xie.escapeUri=i$r;var a$r=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var bIt=x(Qie=>{"use strict";Object.defineProperty(Qie,"__esModule",{value:!0});Qie.escapeUriPath=void 0;var s$r=BMe(),u$r=t=>t.split("/").map(s$r.escapeUri).join("/");Qie.escapeUriPath=u$r});var vIt=x(eae=>{"use strict";Object.defineProperty(eae,"__esModule",{value:!0});var _It=(RD(),Mc(MD));_It.__exportStar(BMe(),eae);_It.__exportStar(bIt(),eae)});var zMe=x(rae=>{"use strict";Object.defineProperty(rae,"__esModule",{value:!0});rae.getCanonicalQuery=void 0;var tae=vIt(),l$r=jD(),c$r=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===l$r.SIGNATURE_HEADER)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${(0,tae.escapeUri)(n)}=${(0,tae.escapeUri)(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).sort().reduce((i,a)=>i.concat([`${(0,tae.escapeUri)(n)}=${(0,tae.escapeUri)(a)}`]),[]).join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")};rae.getCanonicalQuery=c$r});var UMe=x(nae=>{"use strict";Object.defineProperty(nae,"__esModule",{value:!0});nae.getPayloadHash=void 0;var d$r=MMe(),f$r=NU(),p$r=Jie(),wIt=jD(),m$r=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===wIt.SHA256_HEADER)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||(0,d$r.isArrayBuffer)(e)){let n=new r;return n.update((0,p$r.toUint8Array)(e)),(0,f$r.toHex)(await n.digest())}return wIt.UNSIGNED_PAYLOAD};nae.getPayloadHash=m$r});var xIt=x(uM=>{"use strict";Object.defineProperty(uM,"__esModule",{value:!0});uM.deleteHeader=uM.getHeaderValue=uM.hasHeader=void 0;var h$r=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1};uM.hasHeader=h$r;var g$r=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return e[r]};uM.getHeaderValue=g$r;var y$r=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))t===r.toLowerCase()&&delete e[r]};uM.deleteHeader=y$r});var qMe=x(DD=>{"use strict";Object.defineProperty(DD,"__esModule",{value:!0});DD.cloneQuery=DD.cloneRequest=void 0;var b$r=({headers:t,query:e,...r})=>({...r,headers:{...t},query:e?(0,DD.cloneQuery)(e):void 0});DD.cloneRequest=b$r;var _$r=t=>Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{});DD.cloneQuery=_$r});var HMe=x(oae=>{"use strict";Object.defineProperty(oae,"__esModule",{value:!0});oae.moveHeadersToQuery=void 0;var v$r=qMe(),w$r=(t,e={})=>{var r;let{headers:n,query:o={}}=typeof t.clone=="function"?t.clone():(0,v$r.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}};oae.moveHeadersToQuery=w$r});var VMe=x(iae=>{"use strict";Object.defineProperty(iae,"__esModule",{value:!0});iae.prepareRequest=void 0;var x$r=qMe(),S$r=jD(),C$r=t=>{t=typeof t.clone=="function"?t.clone():(0,x$r.cloneRequest)(t);for(let e of Object.keys(t.headers))S$r.GENERATED_HEADERS.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t};iae.prepareRequest=C$r});var SIt=x(LD=>{"use strict";Object.defineProperty(LD,"__esModule",{value:!0});LD.toDate=LD.iso8601=void 0;var O$r=t=>(0,LD.toDate)(t).toISOString().replace(/\.\d{3}Z$/,"Z");LD.iso8601=O$r;var E$r=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;LD.toDate=E$r});var TIt=x(lae=>{"use strict";Object.defineProperty(lae,"__esModule",{value:!0});lae.SignatureV4=void 0;var P$r=fIt(),aae=NU(),CIt=mIt(),kW=Jie(),Rd=jD(),sae=FMe(),OIt=$Me(),T$r=zMe(),WMe=UMe(),A$r=xIt(),I$r=HMe(),EIt=VMe(),M$r=SIt(),KMe=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerMarshaller=new P$r.HeaderMarshaller(kW.toUtf8,kW.fromUtf8),this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=(0,CIt.normalizeProvider)(n),this.credentialProvider=(0,CIt.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}=uae(n);if(o>Rd.MAX_PRESIGNED_TTL)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let h=(0,sae.createScope)(p,d,l??this.service),m=(0,I$r.moveHeadersToQuery)((0,EIt.prepareRequest)(e),{unhoistableHeaders:a});c.sessionToken&&(m.query[Rd.TOKEN_QUERY_PARAM]=c.sessionToken),m.query[Rd.ALGORITHM_QUERY_PARAM]=Rd.ALGORITHM_IDENTIFIER,m.query[Rd.CREDENTIAL_QUERY_PARAM]=`${c.accessKeyId}/${h}`,m.query[Rd.AMZ_DATE_QUERY_PARAM]=f,m.query[Rd.EXPIRES_QUERY_PARAM]=o.toString(10);let g=(0,OIt.getCanonicalHeaders)(m,i,s);return m.query[Rd.SIGNED_HEADERS_QUERY_PARAM]=PIt(g),m.query[Rd.SIGNATURE_QUERY_PARAM]=await this.getSignature(f,h,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(m,g,await(0,WMe.getPayloadHash)(e,this.sha256))),m}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}=uae(n),c=(0,sae.createScope)(u,s,a??this.service),d=await(0,WMe.getPayloadHash)({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=(0,aae.toHex)(await f.digest()),h=[Rd.EVENT_ALGORITHM_IDENTIFIER,l,c,o,p,d].join(`
`);return this.signString(h,{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}=uae(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update((0,kW.toUint8Array)(e)),(0,aae.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,EIt.prepareRequest)(e),{longDate:c,shortDate:d}=uae(r),f=(0,sae.createScope)(d,u,a??this.service);l.headers[Rd.AMZ_DATE_HEADER]=c,s.sessionToken&&(l.headers[Rd.TOKEN_HEADER]=s.sessionToken);let p=await(0,WMe.getPayloadHash)(l,this.sha256);!(0,A$r.hasHeader)(Rd.SHA256_HEADER,l.headers)&&this.applyChecksum&&(l.headers[Rd.SHA256_HEADER]=p);let h=(0,OIt.getCanonicalHeaders)(l,o,n),m=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,h,p));return l.headers[Rd.AUTH_HEADER]=`${Rd.ALGORITHM_IDENTIFIER} Credential=${s.accessKeyId}/${f}, SignedHeaders=${PIt(h)}, Signature=${m}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${(0,T$r.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,kW.toUint8Array)(n));let i=await o.digest();return`${Rd.ALGORITHM_IDENTIFIER}
${e}
${r}
${(0,aae.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,kW.toUint8Array)(i)),(0,aae.toHex)(await a.digest())}getSigningKey(e,r,n,o){return(0,sae.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")}};lae.SignatureV4=KMe;var uae=t=>{let e=(0,M$r.iso8601)(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},PIt=t=>Object.keys(t).sort().join(";")});var IIt=x(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});km.prepareRequest=km.moveHeadersToQuery=km.getPayloadHash=km.getCanonicalQuery=km.getCanonicalHeaders=void 0;var AIt=(RD(),Mc(MD));AIt.__exportStar(TIt(),km);var R$r=$Me();Object.defineProperty(km,"getCanonicalHeaders",{enumerable:!0,get:function(){return R$r.getCanonicalHeaders}});var N$r=zMe();Object.defineProperty(km,"getCanonicalQuery",{enumerable:!0,get:function(){return N$r.getCanonicalQuery}});var j$r=UMe();Object.defineProperty(km,"getPayloadHash",{enumerable:!0,get:function(){return j$r.getPayloadHash}});var D$r=HMe();Object.defineProperty(km,"moveHeadersToQuery",{enumerable:!0,get:function(){return D$r.moveHeadersToQuery}});var L$r=VMe();Object.defineProperty(km,"prepareRequest",{enumerable:!0,get:function(){return L$r.prepareRequest}});AIt.__exportStar(FMe(),km)});var MIt=x(GMe=>{"use strict";Object.defineProperty(GMe,"__esModule",{value:!0});var F$r=(RD(),Mc(MD));F$r.__exportStar(IIt(),GMe)});var ps=x((Gqo,RIt)=>{"use strict";RIt.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 FU=x((Jqo,cae)=>{"use strict";var{AbortController:NIt,AbortSignal:k$r}=typeof self<"u"?self:typeof window<"u"?window:void 0;cae.exports=NIt;cae.exports.AbortSignal=k$r;cae.exports.default=NIt});var $W=x((Zqo,JMe)=>{"use strict";var kU=typeof Reflect=="object"?Reflect:null,jIt=kU&&typeof kU.apply=="function"?kU.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},dae;kU&&typeof kU.ownKeys=="function"?dae=kU.ownKeys:Object.getOwnPropertySymbols?dae=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:dae=function(e){return Object.getOwnPropertyNames(e)};function $$r(t){console&&console.warn&&console.warn(t)}var LIt=Number.isNaN||function(e){return e!==e};function Ki(){Ki.init.call(this)}JMe.exports=Ki;JMe.exports.once=q$r;Ki.EventEmitter=Ki;Ki.prototype._events=void 0;Ki.prototype._eventsCount=0;Ki.prototype._maxListeners=void 0;var DIt=10;function fae(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ki,"defaultMaxListeners",{enumerable:!0,get:function(){return DIt},set:function(t){if(typeof t!="number"||t<0||LIt(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");DIt=t}});Ki.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};Ki.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||LIt(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 FIt(t){return t._maxListeners===void 0?Ki.defaultMaxListeners:t._maxListeners}Ki.prototype.getMaxListeners=function(){return FIt(this)};Ki.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")jIt(u,this,r);else for(var l=u.length,c=UIt(u,l),n=0;n<l;++n)jIt(c[n],this,r);return!0};function kIt(t,e,r,n){var o,i,a;if(fae(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=FIt(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,$$r(s)}return t}Ki.prototype.addListener=function(e,r){return kIt(this,e,r,!1)};Ki.prototype.on=Ki.prototype.addListener;Ki.prototype.prependListener=function(e,r){return kIt(this,e,r,!0)};function B$r(){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 $It(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=B$r.bind(n);return o.listener=r,n.wrapFn=o,o}Ki.prototype.once=function(e,r){return fae(r),this.on(e,$It(this,e,r)),this};Ki.prototype.prependOnceListener=function(e,r){return fae(r),this.prependListener(e,$It(this,e,r)),this};Ki.prototype.removeListener=function(e,r){var n,o,i,a,s;if(fae(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():z$r(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};Ki.prototype.off=Ki.prototype.removeListener;Ki.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 BIt(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?U$r(o):UIt(o,o.length)}Ki.prototype.listeners=function(e){return BIt(this,e,!0)};Ki.prototype.rawListeners=function(e){return BIt(this,e,!1)};Ki.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):zIt.call(t,e)};Ki.prototype.listenerCount=zIt;function zIt(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}Ki.prototype.eventNames=function(){return this._eventsCount>0?dae(this._events):[]};function UIt(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function z$r(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function U$r(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function q$r(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))}qIt(t,e,i,{once:!0}),e!=="error"&&H$r(t,o,{once:!0})})}function H$r(t,e,r){typeof t.on=="function"&&qIt(t,"error",e,r)}function qIt(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 qf=x((Yqo,YMe)=>{"use strict";var V$r=Tm(),{kResistStopPropagation:W$r,SymbolDispose:K$r}=ps(),G$r=globalThis.AbortSignal||FU().AbortSignal,J$r=globalThis.AbortController||FU().AbortController,Z$r=Object.getPrototypeOf(async function(){}).constructor,HIt=globalThis.Blob||V$r.Blob,Y$r=typeof HIt<"u"?function(e){return e instanceof HIt}:function(e){return!1},VIt=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},X$r=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},ZMe=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}};YMe.exports={AggregateError:ZMe,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 Z$r},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Y$r,deprecate(t,e){return t},addAbortListener:$W().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);VIt(e,"signal"),X$r(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[W$r]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[K$r](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:G$r.any||function(e){if(e.length===1)return e[0];let r=new J$r,n=()=>r.abort();return e.forEach(o=>{VIt(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};YMe.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var $p=x((Xqo,GIt)=>{"use strict";var{format:Q$r,inspect:pae,AggregateError:eBr}=qf(),tBr=globalThis.AggregateError||eBr,rBr=Symbol("kIsNodeError"),nBr=["string","function","number","object","Function","Object","boolean","bigint","symbol"],oBr=/^([A-Z][a-z0-9]*)+$/,iBr="__node_internal_",mae={};function FD(t,e){if(!t)throw new mae.ERR_INTERNAL_ASSERTION(e)}function WIt(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 aBr(t,e,r){if(typeof e=="function")return FD(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 FD(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Q$r(e,...r)}function Nd(t,e,r){r||(r=Error);class n extends r{constructor(...i){super(aBr(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[rBr]=!0,mae[t]=n}function KIt(t){let e=iBr+t.name;return Object.defineProperty(t,"name",{value:e}),t}function sBr(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new tBr([e,t],e.message);return r.code=e.code,r}return t||e}var XMe=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new mae.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};Nd("ERR_ASSERTION","%s",Error);Nd("ERR_INVALID_ARG_TYPE",(t,e,r)=>{FD(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)FD(typeof u=="string","All expected entries have to be of type string"),nBr.includes(u)?o.push(u.toLowerCase()):oBr.test(u)?i.push(u):(FD(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=pae(r,{depth:-1});n+=`. Received ${u}`}}else{let u=pae(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);Nd("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=pae(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);Nd("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);Nd("ERR_MISSING_ARGS",(...t)=>{FD(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);Nd("ERR_OUT_OF_RANGE",(t,e,r)=>{FD(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=WIt(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=WIt(n)),n+="n"):n=pae(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);Nd("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Nd("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Nd("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Nd("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Nd("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Nd("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Nd("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Nd("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Nd("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Nd("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Nd("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);GIt.exports={AbortError:XMe,aggregateTwoErrors:KIt(sBr),hideStackFrames:KIt,codes:mae}});var BU=x((Qqo,oMt)=>{"use strict";var{ArrayIsArray:eRe,ArrayPrototypeIncludes:XIt,ArrayPrototypeJoin:QIt,ArrayPrototypeMap:uBr,NumberIsInteger:tRe,NumberIsNaN:lBr,NumberMAX_SAFE_INTEGER:cBr,NumberMIN_SAFE_INTEGER:dBr,NumberParseInt:fBr,ObjectPrototypeHasOwnProperty:pBr,RegExpPrototypeExec:eMt,String:mBr,StringPrototypeToUpperCase:hBr,StringPrototypeTrim:gBr}=ps(),{hideStackFrames:hy,codes:{ERR_SOCKET_BAD_PORT:yBr,ERR_INVALID_ARG_TYPE:Hf,ERR_INVALID_ARG_VALUE:$U,ERR_OUT_OF_RANGE:kD,ERR_UNKNOWN_SIGNAL:JIt}}=$p(),{normalizeEncoding:bBr}=qf(),{isAsyncFunction:_Br,isArrayBufferView:vBr}=qf().types,ZIt={};function wBr(t){return t===(t|0)}function xBr(t){return t===t>>>0}var SBr=/^[0-7]+$/,CBr="must be a 32-bit unsigned integer or an octal string";function OBr(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(eMt(SBr,t)===null)throw new $U(e,t,CBr);t=fBr(t,8)}return tMt(t,e),t}var EBr=hy((t,e,r=dBr,n=cBr)=>{if(typeof t!="number")throw new Hf(e,"number",t);if(!tRe(t))throw new kD(e,"an integer",t);if(t<r||t>n)throw new kD(e,`>= ${r} && <= ${n}`,t)}),PBr=hy((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Hf(e,"number",t);if(!tRe(t))throw new kD(e,"an integer",t);if(t<r||t>n)throw new kD(e,`>= ${r} && <= ${n}`,t)}),tMt=hy((t,e,r=!1)=>{if(typeof t!="number")throw new Hf(e,"number",t);if(!tRe(t))throw new kD(e,"an integer",t);let n=r?1:0,o=4294967295;if(t<n||t>o)throw new kD(e,`>= ${n} && <= ${o}`,t)});function rRe(t,e){if(typeof t!="string")throw new Hf(e,"string",t)}function TBr(t,e,r=void 0,n){if(typeof t!="number")throw new Hf(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&lBr(t))throw new kD(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var ABr=hy((t,e,r)=>{if(!XIt(r,t)){let o="must be one of: "+QIt(uBr(r,i=>typeof i=="string"?`'${i}'`:mBr(i)),", ");throw new $U(e,t,o)}});function rMt(t,e){if(typeof t!="boolean")throw new Hf(e,"boolean",t)}function QMe(t,e,r){return t==null||!pBr(t,e)?r:t[e]}var IBr=hy((t,e,r=null)=>{let n=QMe(r,"allowArray",!1),o=QMe(r,"allowFunction",!1);if(!QMe(r,"nullable",!1)&&t===null||!n&&eRe(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new Hf(e,"Object",t)}),MBr=hy((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Hf(e,"a dictionary",t)}),hae=hy((t,e,r=0)=>{if(!eRe(t))throw new Hf(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new $U(e,t,n)}});function RBr(t,e){hae(t,e);for(let r=0;r<t.length;r++)rRe(t[r],`${e}[${r}]`)}function NBr(t,e){hae(t,e);for(let r=0;r<t.length;r++)rMt(t[r],`${e}[${r}]`)}function jBr(t,e){hae(t,e);for(let r=0;r<t.length;r++){let n=t[r],o=`${e}[${r}]`;if(n==null)throw new Hf(o,"AbortSignal",n);nMt(n,o)}}function DBr(t,e="signal"){if(rRe(t,e),ZIt[t]===void 0)throw ZIt[hBr(t)]!==void 0?new JIt(t+" (signals must use all capital letters)"):new JIt(t)}var LBr=hy((t,e="buffer")=>{if(!vBr(t))throw new Hf(e,["Buffer","TypedArray","DataView"],t)});function FBr(t,e){let r=bBr(e),n=t.length;if(r==="hex"&&n%2!==0)throw new $U("encoding",e,`is invalid for data of length ${n}`)}function kBr(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&gBr(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new yBr(e,t,r);return t|0}var nMt=hy((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Hf(e,"AbortSignal",t)}),$Br=hy((t,e)=>{if(typeof t!="function")throw new Hf(e,"Function",t)}),BBr=hy((t,e)=>{if(typeof t!="function"||_Br(t))throw new Hf(e,"Function",t)}),zBr=hy((t,e)=>{if(t!==void 0)throw new Hf(e,"undefined",t)});function UBr(t,e,r){if(!XIt(r,t))throw new Hf(e,`('${QIt(r,"|")}')`,t)}var qBr=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function YIt(t,e){if(typeof t>"u"||!eMt(qBr,t))throw new $U(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function HBr(t){if(typeof t=="string")return YIt(t,"hints"),t;if(eRe(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let o=t[n];YIt(o,"hints"),r+=o,n!==e-1&&(r+=", ")}return r}throw new $U("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}oMt.exports={isInt32:wBr,isUint32:xBr,parseFileMode:OBr,validateArray:hae,validateStringArray:RBr,validateBooleanArray:NBr,validateAbortSignalArray:jBr,validateBoolean:rMt,validateBuffer:LBr,validateDictionary:MBr,validateEncoding:FBr,validateFunction:$Br,validateInt32:PBr,validateInteger:EBr,validateNumber:TBr,validateObject:IBr,validateOneOf:ABr,validatePlainFunction:BBr,validatePort:kBr,validateSignalName:DBr,validateString:rRe,validateUint32:tMt,validateUndefined:zBr,validateUnion:UBr,validateAbortSignal:nMt,validateLinkHeaderValue:HBr}});var lM=x((e2o,uMt)=>{var iu=uMt.exports={},hw,gw;function nRe(){throw new Error("setTimeout has not been defined")}function oRe(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?hw=setTimeout:hw=nRe}catch{hw=nRe}try{typeof clearTimeout=="function"?gw=clearTimeout:gw=oRe}catch{gw=oRe}})();function iMt(t){if(hw===setTimeout)return setTimeout(t,0);if((hw===nRe||!hw)&&setTimeout)return hw=setTimeout,setTimeout(t,0);try{return hw(t,0)}catch{try{return hw.call(null,t,0)}catch{return hw.call(this,t,0)}}}function VBr(t){if(gw===clearTimeout)return clearTimeout(t);if((gw===oRe||!gw)&&clearTimeout)return gw=clearTimeout,clearTimeout(t);try{return gw(t)}catch{try{return gw.call(null,t)}catch{return gw.call(this,t)}}}var oP=[],zU=!1,$D,gae=-1;function WBr(){!zU||!$D||(zU=!1,$D.length?oP=$D.concat(oP):gae=-1,oP.length&&aMt())}function aMt(){if(!zU){var t=iMt(WBr);zU=!0;for(var e=oP.length;e;){for($D=oP,oP=[];++gae<e;)$D&&$D[gae].run();gae=-1,e=oP.length}$D=null,zU=!1,VBr(t)}}iu.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];oP.push(new sMt(t,e)),oP.length===1&&!zU&&iMt(aMt)};function sMt(t,e){this.fun=t,this.array=e}sMt.prototype.run=function(){this.fun.apply(null,this.array)};iu.title="browser";iu.browser=!0;iu.env={};iu.argv=[];iu.version="";iu.versions={};function iP(){}iu.on=iP;iu.addListener=iP;iu.once=iP;iu.off=iP;iu.removeListener=iP;iu.removeAllListeners=iP;iu.emit=iP;iu.prependListener=iP;iu.prependOnceListener=iP;iu.listeners=function(t){return[]};iu.binding=function(t){throw new Error("process.binding is not supported")};iu.cwd=function(){return"/"};iu.chdir=function(t){throw new Error("process.chdir is not supported")};iu.umask=function(){return 0}});var bw=x((t2o,SMt)=>{"use strict";var{SymbolAsyncIterator:lMt,SymbolIterator:cMt,SymbolFor:BD}=ps(),dMt=BD("nodejs.stream.destroyed"),fMt=BD("nodejs.stream.errored"),iRe=BD("nodejs.stream.readable"),aRe=BD("nodejs.stream.writable"),pMt=BD("nodejs.stream.disturbed"),KBr=BD("nodejs.webstream.isClosedPromise"),GBr=BD("nodejs.webstream.controllerErrorFunction");function yae(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 bae(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 JBr(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function yw(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function mMt(t){return!!(t&&!yw(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function hMt(t){return!!(t&&!yw(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function gMt(t){return!!(t&&!yw(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function ZBr(t){return mMt(t)||hMt(t)||gMt(t)}function YBr(t,e){return t==null?!1:e===!0?typeof t[lMt]=="function":e===!1?typeof t[cMt]=="function":typeof t[lMt]=="function"||typeof t[cMt]=="function"}function _ae(t){if(!yw(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[dMt]||n!=null&&n.destroyed)}function yMt(t){if(!bae(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 XBr(t,e){if(!bae(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 QBr(t){if(!yae(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 bMt(t,e){if(!yae(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 _Mt(t){return t&&t[iRe]!=null?t[iRe]:typeof t?.readable!="boolean"?null:_ae(t)?!1:yae(t)&&t.readable&&!bMt(t)}function vMt(t){return t&&t[aRe]!=null?t[aRe]:typeof t?.writable!="boolean"?null:_ae(t)?!1:bae(t)&&t.writable&&!yMt(t)}function ezr(t,e){return yw(t)?_ae(t)?!0:!(e?.readable!==!1&&_Mt(t)||e?.writable!==!1&&vMt(t)):null}function tzr(t){var e,r;return yw(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 rzr(t){var e,r;return yw(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 nzr(t){if(!yw(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"&&wMt(t)?t._closed:null}function wMt(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function xMt(t){return typeof t._sent100=="boolean"&&wMt(t)}function ozr(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 izr(t){if(!yw(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&xMt(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function azr(t){var e;return!!(t&&((e=t[pMt])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function szr(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[fMt])!==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))}SMt.exports={isDestroyed:_ae,kIsDestroyed:dMt,isDisturbed:azr,kIsDisturbed:pMt,isErrored:szr,kIsErrored:fMt,isReadable:_Mt,kIsReadable:iRe,kIsClosedPromise:KBr,kControllerErrorFunction:GBr,kIsWritable:aRe,isClosed:nzr,isDuplexNodeStream:JBr,isFinished:ezr,isIterable:YBr,isReadableNodeStream:yae,isReadableStream:mMt,isReadableEnded:QBr,isReadableFinished:bMt,isReadableErrored:rzr,isNodeStream:yw,isWebStream:ZBr,isWritable:vMt,isWritableNodeStream:bae,isWritableStream:hMt,isWritableEnded:yMt,isWritableFinished:XBr,isWritableErrored:tzr,isServerRequest:ozr,isServerResponse:xMt,willEmitClose:izr,isTransformStream:gMt}});var aP=x((r2o,dRe)=>{var cM=lM(),{AbortError:RMt,codes:uzr}=$p(),{ERR_INVALID_ARG_TYPE:lzr,ERR_STREAM_PREMATURE_CLOSE:CMt}=uzr,{kEmptyObject:uRe,once:lRe}=qf(),{validateAbortSignal:czr,validateFunction:dzr,validateObject:fzr,validateBoolean:pzr}=BU(),{Promise:mzr,PromisePrototypeThen:hzr,SymbolDispose:NMt}=ps(),{isClosed:gzr,isReadable:OMt,isReadableNodeStream:sRe,isReadableStream:yzr,isReadableFinished:EMt,isReadableErrored:PMt,isWritable:TMt,isWritableNodeStream:AMt,isWritableStream:bzr,isWritableFinished:IMt,isWritableErrored:MMt,isNodeStream:_zr,willEmitClose:vzr,kIsClosedPromise:wzr}=bw(),UU;function xzr(t){return t.setHeader&&typeof t.abort=="function"}var cRe=()=>{};function jMt(t,e,r){var n,o;if(arguments.length===2?(r=e,e=uRe):e==null?e=uRe:fzr(e,"options"),dzr(r,"callback"),czr(e.signal,"options.signal"),r=lRe(r),yzr(t)||bzr(t))return Szr(t,e,r);if(!_zr(t))throw new lzr("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:sRe(t),a=(o=e.writable)!==null&&o!==void 0?o:AMt(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=vzr(t)&&sRe(t)===i&&AMt(t)===a,d=IMt(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=EMt(t,!1),h=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||a))&&(!a||d)&&r.call(t)},m=C=>{r.call(t,C)},g=gzr(t),y=()=>{g=!0;let C=MMt(t)||PMt(t);if(C&&typeof C!="boolean")return r.call(t,C);if(i&&!p&&sRe(t,!0)&&!EMt(t,!1))return r.call(t,new CMt);if(a&&!d&&!IMt(t,!1))return r.call(t,new CMt);r.call(t)},_=()=>{g=!0;let C=MMt(t)||PMt(t);if(C&&typeof C!="boolean")return r.call(t,C);r.call(t)},w=()=>{t.req.on("finish",f)};xzr(t)?(t.on("complete",f),c||t.on("abort",y),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",y),t.on("end",h),t.on("finish",f),e.error!==!1&&t.on("error",m),t.on("close",y),g?cM.nextTick(y):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||cM.nextTick(_):(!i&&(!c||OMt(t))&&(d||TMt(t)===!1)||!a&&(!c||TMt(t))&&(p||OMt(t)===!1)||u&&t.req&&t.aborted)&&cM.nextTick(_);let S=()=>{r=cRe,t.removeListener("aborted",y),t.removeListener("complete",f),t.removeListener("abort",y),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",h),t.removeListener("error",m),t.removeListener("close",y)};if(e.signal&&!g){let C=()=>{let E=r;S(),E.call(t,new RMt(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)cM.nextTick(C);else{UU=UU||qf().addAbortListener;let E=UU(e.signal,C),P=r;r=lRe((...T)=>{E[NMt](),P.apply(t,T)})}}return S}function Szr(t,e,r){let n=!1,o=cRe;if(e.signal)if(o=()=>{n=!0,r.call(t,new RMt(void 0,{cause:e.signal.reason}))},e.signal.aborted)cM.nextTick(o);else{UU=UU||qf().addAbortListener;let a=UU(e.signal,o),s=r;r=lRe((...u)=>{a[NMt](),s.apply(t,u)})}let i=(...a)=>{n||cM.nextTick(()=>r.apply(t,a))};return hzr(t[wzr].promise,i,i),cRe}function Czr(t,e){var r;let n=!1;return e===null&&(e=uRe),(r=e)!==null&&r!==void 0&&r.cleanup&&(pzr(e.cleanup,"cleanup"),n=e.cleanup),new mzr((o,i)=>{let a=jMt(t,e,s=>{n&&a(),s?i(s):o()})})}dRe.exports=jMt;dRe.exports.finished=Czr});var zD=x((n2o,UMt)=>{"use strict";var _w=lM(),{aggregateTwoErrors:Ozr,codes:{ERR_MULTIPLE_CALLBACK:Ezr},AbortError:Pzr}=$p(),{Symbol:FMt}=ps(),{kIsDestroyed:Tzr,isDestroyed:Azr,isFinished:Izr,isServerRequest:Mzr}=bw(),kMt=FMt("kDestroy"),fRe=FMt("kConstruct");function $Mt(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Rzr(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):($Mt(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?DMt(this,t,e):this.once(kMt,function(i){DMt(this,Ozr(i,t),e)}),this)}function DMt(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;$Mt(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?_w.nextTick(Nzr,t,i):_w.nextTick(BMt,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function Nzr(t,e){pRe(t,e),BMt(t)}function BMt(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 pRe(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 jzr(){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 mRe(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?_w.nextTick(pRe,t,e):pRe(t,e))}function Dzr(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(fRe,e),!(t.listenerCount(fRe)>1)&&_w.nextTick(Lzr,t)}function Lzr(t){let e=!1;function r(n){if(e){mRe(t,n??new Ezr);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(kMt,n):n?mRe(t,n,!0):_w.nextTick(Fzr,t)}try{t._construct(n=>{_w.nextTick(r,n)})}catch(n){_w.nextTick(r,n)}}function Fzr(t){t.emit(fRe)}function LMt(t){return t?.setHeader&&typeof t.abort=="function"}function zMt(t){t.emit("close")}function kzr(t,e){t.emit("error",e),_w.nextTick(zMt,t)}function $zr(t,e){!t||Azr(t)||(!e&&!Izr(t)&&(e=new Pzr),Mzr(t)?(t.socket=null,t.destroy(e)):LMt(t)?t.abort():LMt(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?_w.nextTick(kzr,t,e):_w.nextTick(zMt,t),t.destroyed||(t[Tzr]=!0))}UMt.exports={construct:Dzr,destroyer:$zr,destroy:Rzr,undestroy:jzr,errorOrDestroy:mRe}});var xae=x((o2o,HMt)=>{"use strict";var{ArrayIsArray:Bzr,ObjectSetPrototypeOf:qMt}=ps(),{EventEmitter:vae}=$W();function wae(t){vae.call(this,t)}qMt(wae.prototype,vae.prototype);qMt(wae,vae);wae.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(),vae.listenerCount(this,"error")===0&&this.emit("error",c)}hRe(r,"error",u),hRe(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 hRe(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Bzr(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}HMt.exports={Stream:wae,prependListener:hRe}});var BW=x((i2o,Sae)=>{"use strict";var{SymbolDispose:zzr}=ps(),{AbortError:VMt,codes:Uzr}=$p(),{isNodeStream:WMt,isWebStream:qzr,kControllerErrorFunction:Hzr}=bw(),Vzr=aP(),{ERR_INVALID_ARG_TYPE:KMt}=Uzr,gRe,Wzr=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new KMt(e,"AbortSignal",t)};Sae.exports.addAbortSignal=function(e,r){if(Wzr(e,"signal"),!WMt(r)&&!qzr(r))throw new KMt("stream",["ReadableStream","WritableStream","Stream"],r);return Sae.exports.addAbortSignalNoValidate(e,r)};Sae.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=WMt(e)?()=>{e.destroy(new VMt(void 0,{cause:t.reason}))}:()=>{e[Hzr](new VMt(void 0,{cause:t.reason}))};if(t.aborted)r();else{gRe=gRe||qf().addAbortListener;let n=gRe(t,r);Vzr(e,n[zzr])}return e}});var ZMt=x((s2o,JMt)=>{"use strict";var{StringPrototypeSlice:GMt,SymbolIterator:Kzr,TypedArrayPrototypeSet:Cae,Uint8Array:Gzr}=ps(),{Buffer:yRe}=Tm(),{inspect:Jzr}=qf();JMt.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 yRe.alloc(0);let r=yRe.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)Cae(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}*[Kzr](){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+=GMt(i,0,e),this.head=n,n.data=GMt(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=yRe.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)Cae(r,a,n-e),e-=a.length;else{e===a.length?(Cae(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):(Cae(r,new Gzr(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 Jzr(this,{...r,depth:0,customInspect:!1})}}});var zW=x((u2o,eRt)=>{"use strict";var{MathFloor:Zzr,NumberIsInteger:Yzr}=ps(),{validateInteger:Xzr}=BU(),{ERR_INVALID_ARG_VALUE:Qzr}=$p().codes,YMt=16*1024,XMt=16;function eUr(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function QMt(t){return t?XMt:YMt}function tUr(t,e){Xzr(e,"value",0),t?XMt=e:YMt=e}function rUr(t,e,r,n){let o=eUr(e,n,r);if(o!=null){if(!Yzr(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new Qzr(i,o)}return Zzr(o)}return QMt(t.objectMode)}eRt.exports={getHighWaterMark:rUr,getDefaultHighWaterMark:QMt,setDefaultHighWaterMark:tUr}});var nRt=x((bRe,rRt)=>{var Oae=Tm(),vw=Oae.Buffer;function tRt(t,e){for(var r in t)e[r]=t[r]}vw.from&&vw.alloc&&vw.allocUnsafe&&vw.allocUnsafeSlow?rRt.exports=Oae:(tRt(Oae,bRe),bRe.Buffer=UD);function UD(t,e,r){return vw(t,e,r)}UD.prototype=Object.create(vw.prototype);tRt(vw,UD);UD.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return vw(t,e,r)};UD.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=vw(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};UD.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return vw(t)};UD.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Oae.SlowBuffer(t)}});var aRt=x(iRt=>{"use strict";var vRe=nRt().Buffer,oRt=vRe.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 nUr(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 oUr(t){var e=nUr(t);if(typeof e!="string"&&(vRe.isEncoding===oRt||!oRt(t)))throw new Error("Unknown encoding: "+t);return e||t}iRt.StringDecoder=UW;function UW(t){this.encoding=oUr(t);var e;switch(this.encoding){case"utf16le":this.text=cUr,this.end=dUr,e=4;break;case"utf8":this.fillLast=sUr,e=4;break;case"base64":this.text=fUr,this.end=pUr,e=3;break;default:this.write=mUr,this.end=hUr;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=vRe.allocUnsafe(e)}UW.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||""};UW.prototype.end=lUr;UW.prototype.text=uUr;UW.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 _Re(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function iUr(t,e,r){var n=e.length-1;if(n<r)return 0;var o=_Re(e[n]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--n<r||o===-2?0:(o=_Re(e[n]),o>=0?(o>0&&(t.lastNeed=o-2),o):--n<r||o===-2?0:(o=_Re(e[n]),o>=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function aUr(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 sUr(t){var e=this.lastTotal-this.lastNeed,r=aUr(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 uUr(t,e){var r=iUr(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 lUr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function cUr(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 dUr(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 fUr(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 pUr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function mUr(t){return t.toString(this.encoding)}function hUr(t){return t&&t.length?this.write(t):""}});var wRe=x((c2o,cRt)=>{"use strict";var sRt=lM(),{PromisePrototypeThen:gUr,SymbolAsyncIterator:uRt,SymbolIterator:lRt}=ps(),{Buffer:yUr}=Tm(),{ERR_INVALID_ARG_TYPE:bUr,ERR_STREAM_NULL_VALUES:_Ur}=$p().codes;function vUr(t,e,r){let n;if(typeof e=="string"||e instanceof yUr)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[uRt])o=!0,n=e[uRt]();else if(e&&e[lRt])o=!1,n=e[lRt]();else throw new bUr("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){gUr(s(l),()=>sRt.nextTick(c,l),d=>sRt.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 _Ur;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}cRt.exports=vUr});var HW=x((d2o,TRt)=>{var Jb=lM(),{ArrayPrototypeIndexOf:wUr,NumberIsInteger:xUr,NumberIsNaN:SUr,NumberParseInt:CUr,ObjectDefineProperties:ARe,ObjectKeys:OUr,ObjectSetPrototypeOf:pRt,Promise:mRt,SafeSet:EUr,SymbolAsyncDispose:PUr,SymbolAsyncIterator:TUr,Symbol:AUr}=ps();TRt.exports=Mn;Mn.ReadableState=Aae;var{EventEmitter:IUr}=$W(),{Stream:dM,prependListener:MUr}=xae(),{Buffer:xRe}=Tm(),{addAbortSignal:RUr}=BW(),hRt=aP(),Qn=qf().debuglog("stream",t=>{Qn=t}),NUr=ZMt(),VU=zD(),{getHighWaterMark:jUr,getDefaultHighWaterMark:DUr}=zW(),{aggregateTwoErrors:dRt,codes:{ERR_INVALID_ARG_TYPE:LUr,ERR_METHOD_NOT_IMPLEMENTED:FUr,ERR_OUT_OF_RANGE:kUr,ERR_STREAM_PUSH_AFTER_EOF:$Ur,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:BUr},AbortError:zUr}=$p(),{validateObject:UUr}=BU(),qD=AUr("kPaused"),{StringDecoder:gRt}=aRt(),qUr=wRe();pRt(Mn.prototype,dM.prototype);pRt(Mn,dM);var SRe=()=>{},{errorOrDestroy:qU}=VU,HU=1,HUr=2,yRt=4,qW=8,bRt=16,Eae=32,Pae=64,_Rt=128,VUr=256,WUr=512,KUr=1024,PRe=2048,TRe=4096,GUr=8192,JUr=16384,ZUr=32768,vRt=65536,YUr=1<<17,XUr=1<<18;function lc(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}ARe(Aae.prototype,{objectMode:lc(HU),ended:lc(HUr),endEmitted:lc(yRt),reading:lc(qW),constructed:lc(bRt),sync:lc(Eae),needReadable:lc(Pae),emittedReadable:lc(_Rt),readableListening:lc(VUr),resumeScheduled:lc(WUr),errorEmitted:lc(KUr),emitClose:lc(PRe),autoDestroy:lc(TRe),destroyed:lc(GUr),closed:lc(JUr),closeEmitted:lc(ZUr),multiAwaitDrain:lc(vRt),readingMore:lc(YUr),dataEmitted:lc(XUr)});function Aae(t,e,r){typeof r!="boolean"&&(r=e instanceof ww()),this.state=PRe|TRe|bRt|Eae,t&&t.objectMode&&(this.state|=HU),r&&t&&t.readableObjectMode&&(this.state|=HU),this.highWaterMark=t?jUr(this,t,"readableHighWaterMark",r):DUr(!1),this.buffer=new NUr,this.length=0,this.pipes=[],this.flowing=null,this[qD]=null,t&&t.emitClose===!1&&(this.state&=~PRe),t&&t.autoDestroy===!1&&(this.state&=~TRe),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new gRt(t.encoding),this.encoding=t.encoding)}function Mn(t){if(!(this instanceof Mn))return new Mn(t);let e=this instanceof ww();this._readableState=new Aae(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&&RUr(t.signal,this)),dM.call(this,t),VU.construct(this,()=>{this._readableState.needReadable&&Tae(this,this._readableState)})}Mn.prototype.destroy=VU.destroy;Mn.prototype._undestroy=VU.undestroy;Mn.prototype._destroy=function(t,e){e(t)};Mn.prototype[IUr.captureRejectionSymbol]=function(t){this.destroy(t)};Mn.prototype[PUr]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new zUr,this.destroy(t)),new mRt((e,r)=>hRt(this,n=>n&&n!==t?r(n):e(null)))};Mn.prototype.push=function(t,e){return wRt(this,t,e,!1)};Mn.prototype.unshift=function(t,e){return wRt(this,t,e,!0)};function wRt(t,e,r,n){Qn("readableAddChunk",e);let o=t._readableState,i;if((o.state&HU)===0&&(typeof e=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?e=xRe.from(e,r).toString(o.encoding):(e=xRe.from(e,r),r=""))):e instanceof xRe?r="":dM._isUint8Array(e)?(e=dM._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new LUr("chunk",["string","Buffer","Uint8Array"],e))),i)qU(t,i);else if(e===null)o.state&=~qW,tqr(t,o);else if((o.state&HU)!==0||e&&e.length>0)if(n)if((o.state&yRt)!==0)qU(t,new BUr);else{if(o.destroyed||o.errored)return!1;CRe(t,o,e,!0)}else if(o.ended)qU(t,new $Ur);else{if(o.destroyed||o.errored)return!1;o.state&=~qW,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?CRe(t,o,e,!1):Tae(t,o)):CRe(t,o,e,!1)}else n||(o.state&=~qW,Tae(t,o));return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function CRe(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&vRt)!==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&Pae)!==0&&Iae(t)),Tae(t,e)}Mn.prototype.isPaused=function(){let t=this._readableState;return t[qD]===!0||t.flowing===!1};Mn.prototype.setEncoding=function(t){let e=new gRt(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 QUr=1073741824;function eqr(t){if(t>QUr)throw new kUr("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function fRt(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&HU)!==0?1:SUr(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}Mn.prototype.read=function(t){Qn("read",t),t===void 0?t=NaN:xUr(t)||(t=CUr(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=eqr(t)),t!==0&&(e.state&=~_Rt),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Qn("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?ORe(this):Iae(this),null;if(t=fRt(t,e),t===0&&e.ended)return e.length===0&&ORe(this),null;let n=(e.state&Pae)!==0;if(Qn("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,Qn("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,Qn("reading, ended or constructing",n);else if(n){Qn("do read"),e.state|=qW|Eae,e.length===0&&(e.state|=Pae);try{this._read(e.highWaterMark)}catch(i){qU(this,i)}e.state&=~Eae,e.reading||(t=fRt(r,e))}let o;return t>0?o=ERt(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&&ORe(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function tqr(t,e){if(Qn("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?Iae(t):(e.needReadable=!1,e.emittedReadable=!0,xRt(t))}}function Iae(t){let e=t._readableState;Qn("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Qn("emitReadable",e.flowing),e.emittedReadable=!0,Jb.nextTick(xRt,t))}function xRt(t){let e=t._readableState;Qn("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,CRt(t)}function Tae(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Jb.nextTick(rqr,t,e))}function rqr(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(Qn("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Mn.prototype._read=function(t){throw new FUr("_read()")};Mn.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new EUr(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),Qn("pipe count=%d opts=%j",n.pipes.length,e);let i=(!e||e.end!==!1)&&t!==Jb.stdout&&t!==Jb.stderr?s:g;n.endEmitted?Jb.nextTick(i):r.once("end",i),t.on("unpipe",a);function a(y,_){Qn("onunpipe"),y===r&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,c())}function s(){Qn("onend"),t.end()}let u,l=!1;function c(){Qn("cleanup"),t.removeListener("close",h),t.removeListener("finish",m),u&&t.removeListener("drain",u),t.removeListener("error",p),t.removeListener("unpipe",a),r.removeListener("end",s),r.removeListener("end",g),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?(Qn("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(Qn("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=nqr(r,t),t.on("drain",u))}r.on("data",f);function f(y){Qn("ondata");let _=t.write(y);Qn("dest.write",_),_===!1&&d()}function p(y){if(Qn("onerror",y),g(),t.removeListener("error",p),t.listenerCount("error")===0){let _=t._writableState||t._readableState;_&&!_.errorEmitted?qU(t,y):t.emit("error",y)}}MUr(t,"error",p);function h(){t.removeListener("finish",m),g()}t.once("close",h);function m(){Qn("onfinish"),t.removeListener("close",h),g()}t.once("finish",m);function g(){Qn("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||(Qn("pipe resume"),r.resume()),t};function nqr(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(Qn("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(Qn("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}Mn.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=wUr(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};Mn.prototype.on=function(t,e){let r=dM.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,Qn("on readable",n.length,n.reading),n.length?Iae(this):n.reading||Jb.nextTick(oqr,this)),r};Mn.prototype.addListener=Mn.prototype.on;Mn.prototype.removeListener=function(t,e){let r=dM.prototype.removeListener.call(this,t,e);return t==="readable"&&Jb.nextTick(SRt,this),r};Mn.prototype.off=Mn.prototype.removeListener;Mn.prototype.removeAllListeners=function(t){let e=dM.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Jb.nextTick(SRt,this),e};function SRt(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[qD]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function oqr(t){Qn("readable nexttick read 0"),t.read(0)}Mn.prototype.resume=function(){let t=this._readableState;return t.flowing||(Qn("resume"),t.flowing=!t.readableListening,iqr(this,t)),t[qD]=!1,this};function iqr(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Jb.nextTick(aqr,t,e))}function aqr(t,e){Qn("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),CRt(t),e.flowing&&!e.reading&&t.read(0)}Mn.prototype.pause=function(){return Qn("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Qn("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[qD]=!0,this};function CRt(t){let e=t._readableState;for(Qn("flow",e.flowing);e.flowing&&t.read()!==null;);}Mn.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=>{qU(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=OUr(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};Mn.prototype[TUr]=function(){return ORt(this)};Mn.prototype.iterator=function(t){return t!==void 0&&UUr(t,"options"),ORt(this,t)};function ORt(t,e){typeof t.read!="function"&&(t=Mn.wrap(t,{objectMode:!0}));let r=sqr(t,e);return r.stream=t,r}async function*sqr(t,e){let r=SRe;function n(a){this===t?(r(),r=SRe):r=a}t.on("readable",n);let o,i=hRt(t,{writable:!1},a=>{o=a?dRt(o,a):null,r(),r=SRe});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 mRt(n)}}}catch(a){throw o=dRt(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?VU.destroyer(t,null):(t.off("readable",n),i())}}ARe(Mn.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}}});ARe(Aae.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[qD]!==!1},set(t){this[qD]=!!t}}});Mn._fromList=ERt;function ERt(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 ORe(t){let e=t._readableState;Qn("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Jb.nextTick(uqr,e,t))}function uqr(t,e){if(Qn("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)Jb.nextTick(lqr,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function lqr(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}Mn.from=function(t,e){return qUr(Mn,t,e)};var ERe;function PRt(){return ERe===void 0&&(ERe={}),ERe}Mn.fromWeb=function(t,e){return PRt().newStreamReadableFromReadableStream(t,e)};Mn.toWeb=function(t,e){return PRt().newReadableStreamFromStreamReadable(t,e)};Mn.wrap=function(t,e){var r,n;return new Mn({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){VU.destroyer(t,o),i(o)}}).wrap(t)}});var Dae=x((f2o,BRt)=>{var HD=lM(),{ArrayPrototypeSlice:MRt,Error:cqr,FunctionPrototypeSymbolHasInstance:RRt,ObjectDefineProperty:NRt,ObjectDefineProperties:dqr,ObjectSetPrototypeOf:jRt,StringPrototypeToLowerCase:fqr,Symbol:pqr,SymbolHasInstance:mqr}=ps();BRt.exports=ms;ms.WritableState=KW;var{EventEmitter:hqr}=$W(),VW=xae().Stream,{Buffer:Mae}=Tm(),jae=zD(),{addAbortSignal:gqr}=BW(),{getHighWaterMark:yqr,getDefaultHighWaterMark:bqr}=zW(),{ERR_INVALID_ARG_TYPE:_qr,ERR_METHOD_NOT_IMPLEMENTED:vqr,ERR_MULTIPLE_CALLBACK:DRt,ERR_STREAM_CANNOT_PIPE:wqr,ERR_STREAM_DESTROYED:WW,ERR_STREAM_ALREADY_FINISHED:xqr,ERR_STREAM_NULL_VALUES:Sqr,ERR_STREAM_WRITE_AFTER_END:Cqr,ERR_UNKNOWN_ENCODING:LRt}=$p().codes,{errorOrDestroy:WU}=jae;jRt(ms.prototype,VW.prototype);jRt(ms,VW);function RRe(){}var KU=pqr("kOnFinished");function KW(t,e,r){typeof r!="boolean"&&(r=e instanceof ww()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?yqr(this,t,"writableHighWaterMark",r):bqr(!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=Eqr.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Nae(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[KU]=[]}function Nae(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}KW.prototype.getBuffer=function(){return MRt(this.buffered,this.bufferedIndex)};NRt(KW.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function ms(t){let e=this instanceof ww();if(!e&&!RRt(ms,this))return new ms(t);this._writableState=new KW(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&&gqr(t.signal,this)),VW.call(this,t),jae.construct(this,()=>{let r=this._writableState;r.writing||jRe(this,r),DRe(this,r)})}NRt(ms,mqr,{__proto__:null,value:function(t){return RRt(this,t)?!0:this!==ms?!1:t&&t._writableState instanceof KW}});ms.prototype.pipe=function(){WU(this,new wqr)};function FRt(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"&&!Mae.isEncoding(r))throw new LRt(r);typeof n!="function"&&(n=RRe)}if(e===null)throw new Sqr;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=Mae.from(e,r),r="buffer");else if(e instanceof Mae)r="buffer";else if(VW._isUint8Array(e))e=VW._uint8ArrayToBuffer(e),r="buffer";else throw new _qr("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new Cqr:o.destroyed&&(i=new WW("write")),i?(HD.nextTick(n,i),WU(t,i,!0),i):(o.pendingcb++,Oqr(t,o,e,r,n))}ms.prototype.write=function(t,e,r){return FRt(this,t,e,r)===!0};ms.prototype.cork=function(){this._writableState.corked++};ms.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||jRe(this,t))};ms.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=fqr(e)),!Mae.isEncoding(e))throw new LRt(e);return this._writableState.defaultEncoding=e,this};function Oqr(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!==RRe&&(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 ARt(t,e,r,n,o,i,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new WW("write")):r?t._writev(o,e.onwrite):t._write(o,i,e.onwrite),e.sync=!1}function IRt(t,e,r,n){--e.pendingcb,n(r),NRe(e),WU(t,r)}function Eqr(t,e){let r=t._writableState,n=r.sync,o=r.writecb;if(typeof o!="function"){WU(t,new DRt);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?HD.nextTick(IRt,t,r,e,o):IRt(t,r,e,o)):(r.buffered.length>r.bufferedIndex&&jRe(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},HD.nextTick(Pqr,r.afterWriteTickInfo)):kRt(t,r,1,o))}function Pqr({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,kRt(t,e,r,n)}function kRt(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&&NRe(e),DRe(t,e)}function NRe(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 WW("write"))}let r=t[KU].splice(0);for(let o=0;o<r.length;o++){var n;r[o]((n=t.errored)!==null&&n!==void 0?n:new WW("end"))}Nae(t)}function jRe(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?RRe:l=>{for(let c=a;c<r.length;++c)r[c].callback(l)},u=e.allNoop&&a===0?r:MRt(r,a);u.allBuffers=e.allBuffers,ARt(t,e,!0,e.length,u,"",s),Nae(e)}else{do{let{chunk:s,encoding:u,callback:l}=r[a];r[a++]=null;let c=o?1:s.length;ARt(t,e,!1,c,s,u,l)}while(a<r.length&&!e.writing);a===r.length?Nae(e):a>256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}ms.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new vqr("_write()")};ms.prototype._writev=null;ms.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=FRt(this,t,e);i instanceof cqr&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,DRe(this,n,!0),n.ended=!0):n.finished?o=new xqr("end"):n.destroyed&&(o=new WW("end"))),typeof r=="function"&&(o||n.finished?HD.nextTick(r,o):n[KU].push(r)),this};function Rae(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 Tqr(t,e){let r=!1;function n(o){if(r){WU(t,o??DRt());return}if(r=!0,e.pendingcb--,o){let i=e[KU].splice(0);for(let a=0;a<i.length;a++)i[a](o);WU(t,o,e.sync)}else Rae(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,HD.nextTick(MRe,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(o){n(o)}e.sync=!1}function Aqr(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Tqr(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function DRe(t,e,r){Rae(e)&&(Aqr(t,e),e.pendingcb===0&&(r?(e.pendingcb++,HD.nextTick((n,o)=>{Rae(o)?MRe(n,o):o.pendingcb--},t,e)):Rae(e)&&(e.pendingcb++,MRe(t,e))))}function MRe(t,e){e.pendingcb--,e.finished=!0;let r=e[KU].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()}}dqr(ms.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 Iqr=jae.destroy;ms.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[KU].length)&&HD.nextTick(NRe,r),Iqr.call(this,t,e),this};ms.prototype._undestroy=jae.undestroy;ms.prototype._destroy=function(t,e){e(t)};ms.prototype[hqr.captureRejectionSymbol]=function(t){this.destroy(t)};var IRe;function $Rt(){return IRe===void 0&&(IRe={}),IRe}ms.fromWeb=function(t,e){return $Rt().newStreamWritableFromWritableStream(t,e)};ms.toWeb=function(t){return $Rt().newWritableStreamFromStreamWritable(t)}});var t1t=x((p2o,e1t)=>{var LRe=lM(),Mqr=Tm(),{isReadable:Rqr,isWritable:Nqr,isIterable:zRt,isNodeStream:jqr,isReadableNodeStream:URt,isWritableNodeStream:qRt,isDuplexNodeStream:Dqr,isReadableStream:HRt,isWritableStream:VRt}=bw(),WRt=aP(),{AbortError:XRt,codes:{ERR_INVALID_ARG_TYPE:Lqr,ERR_INVALID_RETURN_VALUE:KRt}}=$p(),{destroyer:JU}=zD(),Fqr=ww(),QRt=HW(),kqr=Dae(),{createDeferredPromise:GRt}=qf(),JRt=wRe(),ZRt=globalThis.Blob||Mqr.Blob,$qr=typeof ZRt<"u"?function(e){return e instanceof ZRt}:function(e){return!1},Bqr=globalThis.AbortController||FU().AbortController,{FunctionPrototypeCall:YRt}=ps(),fM=class extends Fqr{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)}};e1t.exports=function t(e,r){if(Dqr(e))return e;if(URt(e))return GU({readable:e});if(qRt(e))return GU({writable:e});if(jqr(e))return GU({writable:!1,readable:!1});if(HRt(e))return GU({readable:QRt.fromWeb(e)});if(VRt(e))return GU({writable:kqr.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=zqr(e);if(zRt(o))return JRt(fM,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=YRt(u,o,d=>{if(d!=null)throw new KRt("nully","body",d)},d=>{JU(l,d)});return l=new fM({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,LRe.nextTick(d,null)}catch(f){LRe.nextTick(d,f)}})},destroy:s})}throw new KRt("Iterable, AsyncIterable or AsyncFunction",r,o)}if($qr(e))return t(e.arrayBuffer());if(zRt(e))return JRt(fM,e,{objectMode:!0,writable:!1});if(HRt(e?.readable)&&VRt(e?.writable))return fM.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?URt(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?qRt(e?.writable)?e?.writable:t(e.writable):void 0;return GU({readable:o,writable:i})}let n=e?.then;if(typeof n=="function"){let o;return YRt(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{JU(o,i)}),o=new fM({objectMode:!0,writable:!1,read(){}})}throw new Lqr(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function zqr(t){let{promise:e,resolve:r}=GRt(),n=new Bqr,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if(LRe.nextTick(l),u)return;if(o.aborted)throw new XRt(void 0,{cause:o.reason});({promise:e,resolve:r}=GRt()),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 GU(t){let e=t.readable&&typeof t.readable.read!="function"?QRt.wrap(t.readable):t.readable,r=t.writable,n=!!Rqr(e),o=!!Nqr(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new fM({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(WRt(r,d=>{o=!1,d&&JU(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&&(WRt(e,d=>{n=!1,d&&JU(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 XRt),s=null,i=null,a=null,u===null?f(d):(u=f,JU(r,d),JU(e,d))},l}});var ww=x((m2o,o1t)=>{"use strict";var{ObjectDefineProperties:Uqr,ObjectGetOwnPropertyDescriptor:sP,ObjectKeys:qqr,ObjectSetPrototypeOf:r1t}=ps();o1t.exports=Zb;var $Re=HW(),gy=Dae();r1t(Zb.prototype,$Re.prototype);r1t(Zb,$Re);{let t=qqr(gy.prototype);for(let e=0;e<t.length;e++){let r=t[e];Zb.prototype[r]||(Zb.prototype[r]=gy.prototype[r])}}function Zb(t){if(!(this instanceof Zb))return new Zb(t);$Re.call(this,t),gy.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}Uqr(Zb.prototype,{writable:{__proto__:null,...sP(gy.prototype,"writable")},writableHighWaterMark:{__proto__:null,...sP(gy.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...sP(gy.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...sP(gy.prototype,"writableBuffer")},writableLength:{__proto__:null,...sP(gy.prototype,"writableLength")},writableFinished:{__proto__:null,...sP(gy.prototype,"writableFinished")},writableCorked:{__proto__:null,...sP(gy.prototype,"writableCorked")},writableEnded:{__proto__:null,...sP(gy.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...sP(gy.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 FRe;function n1t(){return FRe===void 0&&(FRe={}),FRe}Zb.fromWeb=function(t,e){return n1t().newStreamDuplexFromReadableWritablePair(t,e)};Zb.toWeb=function(t){return n1t().newReadableWritablePairFromDuplex(t)};var kRe;Zb.from=function(t){return kRe||(kRe=t1t()),kRe(t,"body")}});var URe=x((h2o,a1t)=>{"use strict";var{ObjectSetPrototypeOf:i1t,Symbol:Hqr}=ps();a1t.exports=uP;var{ERR_METHOD_NOT_IMPLEMENTED:Vqr}=$p().codes,zRe=ww(),{getHighWaterMark:Wqr}=zW();i1t(uP.prototype,zRe.prototype);i1t(uP,zRe);var GW=Hqr("kCallback");function uP(t){if(!(this instanceof uP))return new uP(t);let e=t?Wqr(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),zRe.call(this,t),this._readableState.sync=!1,this[GW]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Kqr)}function BRe(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 Kqr(){this._final!==BRe&&BRe.call(this)}uP.prototype._final=BRe;uP.prototype._transform=function(t,e,r){throw new Vqr("_transform()")};uP.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[GW]=r})};uP.prototype._read=function(){if(this[GW]){let t=this[GW];this[GW]=null,t()}}});var HRe=x((g2o,u1t)=>{"use strict";var{ObjectSetPrototypeOf:s1t}=ps();u1t.exports=ZU;var qRe=URe();s1t(ZU.prototype,qRe.prototype);s1t(ZU,qRe);function ZU(t){if(!(this instanceof ZU))return new ZU(t);qRe.call(this,t)}ZU.prototype._transform=function(t,e,r){r(null,t)}});var $ae=x((y2o,p1t)=>{var JW=lM(),{ArrayIsArray:Gqr,Promise:Jqr,SymbolAsyncIterator:Zqr,SymbolDispose:Yqr}=ps(),kae=aP(),{once:Xqr}=qf(),Qqr=zD(),l1t=ww(),{aggregateTwoErrors:e2r,codes:{ERR_INVALID_ARG_TYPE:QRe,ERR_INVALID_RETURN_VALUE:VRe,ERR_MISSING_ARGS:t2r,ERR_STREAM_DESTROYED:r2r,ERR_STREAM_PREMATURE_CLOSE:n2r},AbortError:o2r}=$p(),{validateFunction:i2r,validateAbortSignal:a2r}=BU(),{isIterable:VD,isReadable:WRe,isReadableNodeStream:Fae,isNodeStream:c1t,isTransformStream:YU,isWebStream:s2r,isReadableStream:KRe,isReadableFinished:u2r}=bw(),l2r=globalThis.AbortController||FU().AbortController,GRe,JRe,ZRe;function d1t(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=kae(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,Qqr.destroyer(t,i||new r2r("pipe")))},cleanup:o}}function c2r(t){return i2r(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function YRe(t){if(VD(t))return t;if(Fae(t))return d2r(t);throw new QRe("val",["Readable","Iterable","AsyncIterable"],t)}async function*d2r(t){JRe||(JRe=HW()),yield*JRe.prototype[Zqr].call(t)}async function Lae(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new Jqr((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=kae(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?e2r(o,l):l)}finally{u(),e.off("drain",a)}}async function XRe(t,e,r,{end:n}){YU(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 f2r(...t){return f1t(t,Xqr(c2r(t)))}function f1t(t,e,r){if(t.length===1&&Gqr(t[0])&&(t=t[0]),t.length<2)throw new t2r("streams");let n=new l2r,o=n.signal,i=r?.signal,a=[];a2r(i,"options.signal");function s(){h(new o2r)}ZRe=ZRe||qf().addAbortListener;let u;i&&(u=ZRe(i,s));let l,c,d=[],f=0;function p(w){h(w,--f===0)}function h(w,S){var C;if(w&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=w),!(!l&&!S)){for(;d.length;)d.shift()(l);(C=u)===null||C===void 0||C[Yqr](),n.abort(),S&&(l||a.forEach(E=>E()),JW.nextTick(e,l,c))}}let m;for(let w=0;w<t.length;w++){let S=t[w],C=w<t.length-1,E=w>0,P=C||r?.end!==!1,T=w===t.length-1;if(c1t(S)){let I=function(N){N&&N.name!=="AbortError"&&N.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(N)};var _=I;if(P){let{destroy:N,cleanup:M}=d1t(S,C,E);d.push(N),WRe(S)&&T&&a.push(M)}S.on("error",I),WRe(S)&&T&&a.push(()=>{S.removeListener("error",I)})}if(w===0)if(typeof S=="function"){if(m=S({signal:o}),!VD(m))throw new VRe("Iterable, AsyncIterable or Stream","source",m)}else VD(S)||Fae(S)||YU(S)?m=S:m=l1t.from(S);else if(typeof S=="function"){if(YU(m)){var g;m=YRe((g=m)===null||g===void 0?void 0:g.readable)}else m=YRe(m);if(m=S(m,{signal:o}),C){if(!VD(m,!0))throw new VRe("AsyncIterable",`transform[${w-1}]`,m)}else{var y;GRe||(GRe=HRe());let I=new GRe({objectMode:!0}),N=(y=m)===null||y===void 0?void 0:y.then;if(typeof N=="function")f++,N.call(m,k=>{c=k,k!=null&&I.write(k),P&&I.end(),JW.nextTick(p)},k=>{I.destroy(k),JW.nextTick(p,k)});else if(VD(m,!0))f++,Lae(m,I,p,{end:P});else if(KRe(m)||YU(m)){let k=m.readable||m;f++,Lae(k,I,p,{end:P})}else throw new VRe("AsyncIterable or Promise","destination",m);m=I;let{destroy:M,cleanup:D}=d1t(m,!1,!0);d.push(M),T&&a.push(D)}}else if(c1t(S)){if(Fae(m)){f+=2;let I=p2r(m,S,p,{end:P});WRe(S)&&T&&a.push(I)}else if(YU(m)||KRe(m)){let I=m.readable||m;f++,Lae(I,S,p,{end:P})}else if(VD(m))f++,Lae(m,S,p,{end:P});else throw new QRe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],m);m=S}else if(s2r(S)){if(Fae(m))f++,XRe(YRe(m),S,p,{end:P});else if(KRe(m)||VD(m))f++,XRe(m,S,p,{end:P});else if(YU(m))f++,XRe(m.readable,S,p,{end:P});else throw new QRe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],m);m=S}else m=l1t.from(S)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&JW.nextTick(s),m}function p2r(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new n2r)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;u2r(t)?JW.nextTick(a):t.once("end",a)}else r();return kae(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)}),kae(e,{readable:!1,writable:!0},r)}p1t.exports={pipelineImpl:f1t,pipeline:f2r}});var t1e=x((b2o,_1t)=>{"use strict";var{pipeline:m2r}=$ae(),Bae=ww(),{destroyer:h2r}=zD(),{isNodeStream:zae,isReadable:m1t,isWritable:h1t,isWebStream:e1e,isTransformStream:WD,isWritableStream:g1t,isReadableStream:y1t}=bw(),{AbortError:g2r,codes:{ERR_INVALID_ARG_VALUE:b1t,ERR_MISSING_ARGS:y2r}}=$p(),b2r=aP();_1t.exports=function(...e){if(e.length===0)throw new y2r("streams");if(e.length===1)return Bae.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Bae.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=Bae.from(e[p])}for(let p=0;p<e.length;++p)if(!(!zae(e[p])&&!e1e(e[p]))){if(p<e.length-1&&!(m1t(e[p])||y1t(e[p])||WD(e[p])))throw new b1t(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(h1t(e[p])||g1t(e[p])||WD(e[p])))throw new b1t(`streams[${p}]`,r[p],"must be writable")}let n,o,i,a,s;function u(p){let h=a;a=null,h?h(p):p?s.destroy(p):!f&&!d&&s.destroy()}let l=e[0],c=m2r(e,u),d=!!(h1t(l)||g1t(l)||WD(l)),f=!!(m1t(c)||y1t(c)||WD(c));if(s=new Bae({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(zae(l))s._write=function(h,m,g){l.write(h,m)?g():n=g},s._final=function(h){l.end(),o=h},l.on("drain",function(){if(n){let h=n;n=null,h()}});else if(e1e(l)){let m=(WD(l)?l.writable:l).getWriter();s._write=async function(g,y,_){try{await m.ready,m.write(g).catch(()=>{}),_()}catch(w){_(w)}},s._final=async function(g){try{await m.ready,m.close().catch(()=>{}),o=g}catch(y){g(y)}}}let p=WD(c)?c.readable:c;b2r(p,()=>{if(o){let h=o;o=null,h()}})}if(f){if(zae(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(e1e(c)){let h=(WD(c)?c.readable:c).getReader();s._read=async function(){for(;;)try{let{value:m,done:g}=await h.read();if(!s.push(m))return;if(g){s.push(null);return}}catch{return}}}}return s._destroy=function(p,h){!p&&a!==null&&(p=new g2r),i=null,n=null,o=null,a===null?h(p):(a=h,zae(c)&&h2r(c,p))},s}});var A1t=x((_2o,o1e)=>{"use strict";var _2r=globalThis.AbortController||FU().AbortController,{codes:{ERR_INVALID_ARG_VALUE:v2r,ERR_INVALID_ARG_TYPE:ZW,ERR_MISSING_ARGS:w2r,ERR_OUT_OF_RANGE:x2r},AbortError:xw}=$p(),{validateAbortSignal:KD,validateInteger:v1t,validateObject:GD}=BU(),S2r=ps().Symbol("kWeak"),C2r=ps().Symbol("kResistStopPropagation"),{finished:O2r}=aP(),E2r=t1e(),{addAbortSignalNoValidate:P2r}=BW(),{isWritable:T2r,isNodeStream:A2r}=bw(),{deprecate:I2r}=qf(),{ArrayPrototypePush:M2r,Boolean:R2r,MathFloor:w1t,Number:N2r,NumberIsNaN:j2r,Promise:x1t,PromiseReject:S1t,PromiseResolve:D2r,PromisePrototypeThen:C1t,Symbol:E1t}=ps(),Uae=E1t("kEmpty"),O1t=E1t("kEof");function L2r(t,e){if(e!=null&&GD(e,"options"),e?.signal!=null&&KD(e.signal,"options.signal"),A2r(t)&&!T2r(t))throw new v2r("stream",t,"must be writable");let r=E2r(this,t);return e!=null&&e.signal&&P2r(e.signal,r),r}function qae(t,e){if(typeof t!="function")throw new ZW("fn",["Function","AsyncFunction"],t);e!=null&&GD(e,"options"),e?.signal!=null&&KD(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=w1t(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=w1t(e.highWaterMark)),v1t(r,"options.concurrency",1),v1t(n,"options.highWaterMark",0),n+=r,async function*(){let i=qf().AbortSignalAny([e?.signal].filter(R2r)),a=this,s=[],u={signal:i},l,c,d=!1,f=0;function p(){d=!0,h()}function h(){f-=1,m()}function m(){c&&!d&&f<r&&s.length<n&&(c(),c=null)}async function g(){try{for await(let y of a){if(d)return;if(i.aborted)throw new xw;try{if(y=t(y,u),y===Uae)continue;y=D2r(y)}catch(_){y=S1t(_)}f+=1,C1t(y,h,p),s.push(y),l&&(l(),l=null),!d&&(s.length>=n||f>=r)&&await new x1t(_=>{c=_})}s.push(O1t)}catch(y){let _=S1t(y);C1t(_,h,p),s.push(_)}finally{d=!0,l&&(l(),l=null)}}g();try{for(;;){for(;s.length>0;){let y=await s[0];if(y===O1t)return;if(i.aborted)throw new xw;y!==Uae&&(yield y),s.shift(),m()}await new x1t(y=>{l=y})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function F2r(t=void 0){return t!=null&&GD(t,"options"),t?.signal!=null&&KD(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 xw({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function P1t(t,e=void 0){for await(let r of n1e.call(this,t,e))return!0;return!1}async function k2r(t,e=void 0){if(typeof t!="function")throw new ZW("fn",["Function","AsyncFunction"],t);return!await P1t.call(this,async(...r)=>!await t(...r),e)}async function $2r(t,e){for await(let r of n1e.call(this,t,e))return r}async function B2r(t,e){if(typeof t!="function")throw new ZW("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),Uae}for await(let n of qae.call(this,r,e));}function n1e(t,e){if(typeof t!="function")throw new ZW("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:Uae}return qae.call(this,r,e)}var r1e=class extends w2r{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function z2r(t,e,r){var n;if(typeof t!="function")throw new ZW("reducer",["Function","AsyncFunction"],t);r!=null&&GD(r,"options"),r?.signal!=null&&KD(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new xw(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await O2r(this.destroy(l)),l}let i=new _2r,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[S2r]:this,[C2r]:!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 xw;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new r1e}finally{i.abort()}return e}async function U2r(t){t!=null&&GD(t,"options"),t?.signal!=null&&KD(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 xw(void 0,{cause:t.signal.reason});M2r(e,n)}return e}function q2r(t,e){let r=qae.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function T1t(t){if(t=N2r(t),j2r(t))return 0;if(t<0)throw new x2r("number",">= 0",t);return t}function H2r(t,e=void 0){return e!=null&&GD(e,"options"),e?.signal!=null&&KD(e.signal,"options.signal"),t=T1t(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new xw;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new xw;t--<=0&&(yield i)}}.call(this)}function V2r(t,e=void 0){return e!=null&&GD(e,"options"),e?.signal!=null&&KD(e.signal,"options.signal"),t=T1t(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new xw;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new xw;if(t-- >0&&(yield i),t<=0)return}}.call(this)}o1e.exports.streamReturningOperators={asIndexedPairs:I2r(F2r,"readable.asIndexedPairs will be removed in a future version."),drop:H2r,filter:n1e,flatMap:q2r,map:qae,take:V2r,compose:L2r};o1e.exports.promiseReturningOperators={every:k2r,forEach:B2r,reduce:z2r,toArray:U2r,some:P1t,find:$2r}});var i1e=x((v2o,I1t)=>{"use strict";var{ArrayPrototypePop:W2r,Promise:K2r}=ps(),{isIterable:G2r,isNodeStream:J2r,isWebStream:Z2r}=bw(),{pipelineImpl:Y2r}=$ae(),{finished:X2r}=aP();a1e();function Q2r(...t){return new K2r((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!J2r(i)&&!G2r(i)&&!Z2r(i)){let a=W2r(t);n=a.signal,o=a.end}Y2r(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}I1t.exports={finished:X2r,pipeline:Q2r}});var a1e=x((w2o,$1t)=>{var{Buffer:e4r}=Tm(),{ObjectDefineProperty:lP,ObjectKeys:N1t,ReflectApply:j1t}=ps(),{promisify:{custom:D1t}}=qf(),{streamReturningOperators:M1t,promiseReturningOperators:R1t}=A1t(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:L1t}}=$p(),t4r=t1e(),{setDefaultHighWaterMark:r4r,getDefaultHighWaterMark:n4r}=zW(),{pipeline:F1t}=$ae(),{destroyer:o4r}=zD(),k1t=aP(),s1e=i1e(),YW=bw(),Oa=$1t.exports=xae().Stream;Oa.isDestroyed=YW.isDestroyed;Oa.isDisturbed=YW.isDisturbed;Oa.isErrored=YW.isErrored;Oa.isReadable=YW.isReadable;Oa.isWritable=YW.isWritable;Oa.Readable=HW();for(let t of N1t(M1t)){let r=function(...n){if(new.target)throw L1t();return Oa.Readable.from(j1t(e,this,n))};u1e=r;let e=M1t[t];lP(r,"name",{__proto__:null,value:e.name}),lP(r,"length",{__proto__:null,value:e.length}),lP(Oa.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var u1e;for(let t of N1t(R1t)){let r=function(...o){if(new.target)throw L1t();return j1t(e,this,o)};u1e=r;let e=R1t[t];lP(r,"name",{__proto__:null,value:e.name}),lP(r,"length",{__proto__:null,value:e.length}),lP(Oa.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var u1e;Oa.Writable=Dae();Oa.Duplex=ww();Oa.Transform=URe();Oa.PassThrough=HRe();Oa.pipeline=F1t;var{addAbortSignal:i4r}=BW();Oa.addAbortSignal=i4r;Oa.finished=k1t;Oa.destroy=o4r;Oa.compose=t4r;Oa.setDefaultHighWaterMark=r4r;Oa.getDefaultHighWaterMark=n4r;lP(Oa,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return s1e}});lP(F1t,D1t,{__proto__:null,enumerable:!0,get(){return s1e.pipeline}});lP(k1t,D1t,{__proto__:null,enumerable:!0,get(){return s1e.finished}});Oa.Stream=Oa;Oa._isUint8Array=function(e){return e instanceof Uint8Array};Oa._uint8ArrayToBuffer=function(e){return e4r.from(e.buffer,e.byteOffset,e.byteLength)}});var XW=x((x2o,au)=>{"use strict";var cc=a1e(),a4r=i1e(),s4r=cc.Readable.destroy;au.exports=cc.Readable;au.exports._uint8ArrayToBuffer=cc._uint8ArrayToBuffer;au.exports._isUint8Array=cc._isUint8Array;au.exports.isDisturbed=cc.isDisturbed;au.exports.isErrored=cc.isErrored;au.exports.isReadable=cc.isReadable;au.exports.Readable=cc.Readable;au.exports.Writable=cc.Writable;au.exports.Duplex=cc.Duplex;au.exports.Transform=cc.Transform;au.exports.PassThrough=cc.PassThrough;au.exports.addAbortSignal=cc.addAbortSignal;au.exports.finished=cc.finished;au.exports.destroy=cc.destroy;au.exports.destroy=s4r;au.exports.pipeline=cc.pipeline;au.exports.compose=cc.compose;Object.defineProperty(cc,"promises",{configurable:!0,enumerable:!0,get(){return a4r}});au.exports.Stream=cc.Stream;au.exports.default=au.exports});var JD=x((S2o,B1t)=>{"use strict";B1t.exports=TypeError});var z1t=x(()=>{});var r9=x((E2o,sNt)=>{var b1e=typeof Map=="function"&&Map.prototype,l1e=Object.getOwnPropertyDescriptor&&b1e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Vae=b1e&&l1e&&typeof l1e.get=="function"?l1e.get:null,U1t=b1e&&Map.prototype.forEach,_1e=typeof Set=="function"&&Set.prototype,c1e=Object.getOwnPropertyDescriptor&&_1e?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Wae=_1e&&c1e&&typeof c1e.get=="function"?c1e.get:null,q1t=_1e&&Set.prototype.forEach,u4r=typeof WeakMap=="function"&&WeakMap.prototype,e9=u4r?WeakMap.prototype.has:null,l4r=typeof WeakSet=="function"&&WeakSet.prototype,t9=l4r?WeakSet.prototype.has:null,c4r=typeof WeakRef=="function"&&WeakRef.prototype,H1t=c4r?WeakRef.prototype.deref:null,d4r=Boolean.prototype.valueOf,f4r=Object.prototype.toString,p4r=Function.prototype.toString,m4r=String.prototype.match,v1e=String.prototype.slice,pM=String.prototype.replace,h4r=String.prototype.toUpperCase,V1t=String.prototype.toLowerCase,eNt=RegExp.prototype.test,W1t=Array.prototype.concat,Sw=Array.prototype.join,g4r=Array.prototype.slice,K1t=Math.floor,p1e=typeof BigInt=="function"?BigInt.prototype.valueOf:null,d1e=Object.getOwnPropertySymbols,m1e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,XU=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Vf=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===XU||!0)?Symbol.toStringTag:null,tNt=Object.prototype.propertyIsEnumerable,G1t=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function J1t(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||eNt.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-K1t(-t):K1t(t);if(n!==t){var o=String(n),i=v1e.call(e,o.length+1);return pM.call(o,r,"$&_")+"."+pM.call(pM.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return pM.call(e,r,"$&_")}var h1e=z1t(),Z1t=h1e.custom,Y1t=oNt(Z1t)?Z1t:null,rNt={__proto__:null,double:'"',single:"'"},y4r={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};sNt.exports=function t(e,r,n,o){var i=r||{};if(cP(i,"quoteStyle")&&!cP(rNt,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(cP(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=cP(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(cP(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(cP(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 aNt(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?J1t(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?J1t(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 g1e(e)?"[Array]":"[Object]";var d=D4r(i,n);if(typeof o>"u")o=[];else if(iNt(o,e)>=0)return"[Circular]";function f(k,F,K){if(F&&(o=g4r.call(o),o.push(F)),K){var U={depth:i.depth};return cP(i,"quoteStyle")&&(U.quoteStyle=i.quoteStyle),t(k,U,n+1,o)}return t(k,i,n+1,o)}if(typeof e=="function"&&!X1t(e)){var p=E4r(e),h=Hae(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(h.length>0?" { "+Sw.call(h,", ")+" }":"")}if(oNt(e)){var m=XU?pM.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):m1e.call(e);return typeof e=="object"&&!XU?QW(m):m}if(R4r(e)){for(var g="<"+V1t.call(String(e.nodeName)),y=e.attributes||[],_=0;_<y.length;_++)g+=" "+y[_].name+"="+nNt(b4r(y[_].value),"double",i);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+V1t.call(String(e.nodeName))+">",g}if(g1e(e)){if(e.length===0)return"[]";var w=Hae(e,f);return d&&!j4r(w)?"["+y1e(w,d)+"]":"[ "+Sw.call(w,", ")+" ]"}if(v4r(e)){var S=Hae(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!tNt.call(e,"cause")?"{ ["+String(e)+"] "+Sw.call(W1t.call("[cause]: "+f(e.cause),S),", ")+" }":S.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Sw.call(S,", ")+" }"}if(typeof e=="object"&&a){if(Y1t&&typeof e[Y1t]=="function"&&h1e)return h1e(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(P4r(e)){var C=[];return U1t&&U1t.call(e,function(k,F){C.push(f(F,e,!0)+" => "+f(k,e))}),Q1t("Map",Vae.call(e),C,d)}if(I4r(e)){var E=[];return q1t&&q1t.call(e,function(k){E.push(f(k,e))}),Q1t("Set",Wae.call(e),E,d)}if(T4r(e))return f1e("WeakMap");if(M4r(e))return f1e("WeakSet");if(A4r(e))return f1e("WeakRef");if(x4r(e))return QW(f(Number(e)));if(C4r(e))return QW(f(p1e.call(e)));if(S4r(e))return QW(d4r.call(e));if(w4r(e))return QW(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(!_4r(e)&&!X1t(e)){var P=Hae(e,f),T=G1t?G1t(e)===Object.prototype:e instanceof Object||e.constructor===Object,I=e instanceof Object?"":"null prototype",N=!T&&Vf&&Object(e)===e&&Vf in e?v1e.call(mM(e),8,-1):I?"Object":"",M=T||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",D=M+(N||I?"["+Sw.call(W1t.call([],N||[],I||[]),": ")+"] ":"");return P.length===0?D+"{}":d?D+"{"+y1e(P,d)+"}":D+"{ "+Sw.call(P,", ")+" }"}return String(e)};function nNt(t,e,r){var n=r.quoteStyle||e,o=rNt[n];return o+t+o}function b4r(t){return pM.call(String(t),/"/g,"&quot;")}function g1e(t){return mM(t)==="[object Array]"&&(!Vf||!(typeof t=="object"&&Vf in t))}function _4r(t){return mM(t)==="[object Date]"&&(!Vf||!(typeof t=="object"&&Vf in t))}function X1t(t){return mM(t)==="[object RegExp]"&&(!Vf||!(typeof t=="object"&&Vf in t))}function v4r(t){return mM(t)==="[object Error]"&&(!Vf||!(typeof t=="object"&&Vf in t))}function w4r(t){return mM(t)==="[object String]"&&(!Vf||!(typeof t=="object"&&Vf in t))}function x4r(t){return mM(t)==="[object Number]"&&(!Vf||!(typeof t=="object"&&Vf in t))}function S4r(t){return mM(t)==="[object Boolean]"&&(!Vf||!(typeof t=="object"&&Vf in t))}function oNt(t){if(XU)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!m1e)return!1;try{return m1e.call(t),!0}catch{}return!1}function C4r(t){if(!t||typeof t!="object"||!p1e)return!1;try{return p1e.call(t),!0}catch{}return!1}var O4r=Object.prototype.hasOwnProperty||function(t){return t in this};function cP(t,e){return O4r.call(t,e)}function mM(t){return f4r.call(t)}function E4r(t){if(t.name)return t.name;var e=m4r.call(p4r.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function iNt(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 P4r(t){if(!Vae||!t||typeof t!="object")return!1;try{Vae.call(t);try{Wae.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function T4r(t){if(!e9||!t||typeof t!="object")return!1;try{e9.call(t,e9);try{t9.call(t,t9)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function A4r(t){if(!H1t||!t||typeof t!="object")return!1;try{return H1t.call(t),!0}catch{}return!1}function I4r(t){if(!Wae||!t||typeof t!="object")return!1;try{Wae.call(t);try{Vae.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function M4r(t){if(!t9||!t||typeof t!="object")return!1;try{t9.call(t,t9);try{e9.call(t,e9)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function R4r(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function aNt(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return aNt(v1e.call(t,0,e.maxStringLength),e)+n}var o=y4r[e.quoteStyle||"single"];o.lastIndex=0;var i=pM.call(pM.call(t,o,"\\$1"),/[\x00-\x1f]/g,N4r);return nNt(i,"single",e)}function N4r(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":"")+h4r.call(e.toString(16))}function QW(t){return"Object("+t+")"}function f1e(t){return t+" { ? }"}function Q1t(t,e,r,n){var o=n?y1e(r,n):Sw.call(r,", ");return t+" ("+e+") {"+o+"}"}function j4r(t){for(var e=0;e<t.length;e++)if(iNt(t[e],`
`)>=0)return!1;return!0}function D4r(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Sw.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Sw.call(Array(e+1),r)}}function y1e(t,e){if(t.length===0)return"";var r=`
`+e.prev+e.base;return r+Sw.call(t,","+r)+`
`+e.prev}function Hae(t,e){var r=g1e(t),n=[];if(r){n.length=t.length;for(var o=0;o<t.length;o++)n[o]=cP(t,o)?e(t[o],t):""}var i=typeof d1e=="function"?d1e(t):[],a;if(XU){a={};for(var s=0;s<i.length;s++)a["$"+i[s]]=i[s]}for(var u in t)cP(t,u)&&(r&&String(Number(u))===u&&u<t.length||XU&&a["$"+u]instanceof Symbol||(eNt.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if(typeof d1e=="function")for(var l=0;l<i.length;l++)tNt.call(t,i[l])&&n.push("["+e(i[l])+"]: "+e(t[i[l]],t));return n}});var lNt=x((P2o,uNt)=>{"use strict";var L4r=r9(),F4r=JD(),Kae=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},k4r=function(t,e){if(t){var r=Kae(t,e);return r&&r.value}},$4r=function(t,e,r){var n=Kae(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},B4r=function(t,e){return t?!!Kae(t,e):!1},z4r=function(t,e){if(t)return Kae(t,e,!0)};uNt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new F4r("Side channel does not contain "+L4r(n))},delete:function(n){var o=e&&e.next,i=z4r(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return k4r(e,n)},has:function(n){return B4r(e,n)},set:function(n,o){e||(e={next:void 0}),$4r(e,n,o)}};return r}});var w1e=x((T2o,cNt)=>{"use strict";cNt.exports=Object});var fNt=x((A2o,dNt)=>{"use strict";dNt.exports=Error});var mNt=x((I2o,pNt)=>{"use strict";pNt.exports=EvalError});var gNt=x((M2o,hNt)=>{"use strict";hNt.exports=RangeError});var bNt=x((R2o,yNt)=>{"use strict";yNt.exports=ReferenceError});var vNt=x((N2o,_Nt)=>{"use strict";_Nt.exports=SyntaxError});var xNt=x((j2o,wNt)=>{"use strict";wNt.exports=URIError});var CNt=x((D2o,SNt)=>{"use strict";SNt.exports=Math.abs});var ENt=x((L2o,ONt)=>{"use strict";ONt.exports=Math.floor});var TNt=x((F2o,PNt)=>{"use strict";PNt.exports=Math.max});var INt=x((k2o,ANt)=>{"use strict";ANt.exports=Math.min});var RNt=x(($2o,MNt)=>{"use strict";MNt.exports=Math.pow});var jNt=x((B2o,NNt)=>{"use strict";NNt.exports=Math.round});var LNt=x((z2o,DNt)=>{"use strict";DNt.exports=Number.isNaN||function(e){return e!==e}});var kNt=x((U2o,FNt)=>{"use strict";var U4r=LNt();FNt.exports=function(e){return U4r(e)||e===0?e:e<0?-1:1}});var BNt=x((q2o,$Nt)=>{"use strict";$Nt.exports=Object.getOwnPropertyDescriptor});var x1e=x((H2o,zNt)=>{"use strict";var Gae=BNt();if(Gae)try{Gae([],"length")}catch{Gae=null}zNt.exports=Gae});var qNt=x((V2o,UNt)=>{"use strict";var Jae=Object.defineProperty||!1;if(Jae)try{Jae({},"a",{value:1})}catch{Jae=!1}UNt.exports=Jae});var VNt=x((W2o,HNt)=>{"use strict";HNt.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 GNt=x((K2o,KNt)=>{"use strict";var WNt=typeof Symbol<"u"&&Symbol,q4r=VNt();KNt.exports=function(){return typeof WNt!="function"||typeof Symbol!="function"||typeof WNt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:q4r()}});var S1e=x((G2o,JNt)=>{"use strict";JNt.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var C1e=x((J2o,ZNt)=>{"use strict";var H4r=w1e();ZNt.exports=H4r.getPrototypeOf||null});var QNt=x((Z2o,XNt)=>{"use strict";var V4r="Function.prototype.bind called on incompatible ",W4r=Object.prototype.toString,K4r=Math.max,G4r="[object Function]",YNt=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},J4r=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},Z4r=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};XNt.exports=function(e){var r=this;if(typeof r!="function"||W4r.apply(r)!==G4r)throw new TypeError(V4r+r);for(var n=J4r(arguments,1),o,i=function(){if(this instanceof o){var c=r.apply(this,YNt(n,arguments));return Object(c)===c?c:this}return r.apply(e,YNt(n,arguments))},a=K4r(0,r.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(o=Function("binder","return function ("+Z4r(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 n9=x((Y2o,ejt)=>{"use strict";var Y4r=QNt();ejt.exports=Function.prototype.bind||Y4r});var Zae=x((X2o,tjt)=>{"use strict";tjt.exports=Function.prototype.call});var O1e=x((Q2o,rjt)=>{"use strict";rjt.exports=Function.prototype.apply});var ojt=x((e4o,njt)=>{"use strict";njt.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var ajt=x((t4o,ijt)=>{"use strict";var X4r=n9(),Q4r=O1e(),e3r=Zae(),t3r=ojt();ijt.exports=t3r||X4r.call(e3r,Q4r)});var E1e=x((r4o,sjt)=>{"use strict";var r3r=n9(),n3r=JD(),o3r=Zae(),i3r=ajt();sjt.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new n3r("a function is required");return i3r(r3r,o3r,e)}});var pjt=x((n4o,fjt)=>{"use strict";var a3r=E1e(),ujt=x1e(),cjt;try{cjt=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var P1e=!!cjt&&ujt&&ujt(Object.prototype,"__proto__"),djt=Object,ljt=djt.getPrototypeOf;fjt.exports=P1e&&typeof P1e.get=="function"?a3r([P1e.get]):typeof ljt=="function"?function(e){return ljt(e==null?e:djt(e))}:!1});var bjt=x((o4o,yjt)=>{"use strict";var mjt=S1e(),hjt=C1e(),gjt=pjt();yjt.exports=mjt?function(e){return mjt(e)}:hjt?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return hjt(e)}:gjt?function(e){return gjt(e)}:null});var vjt=x((i4o,_jt)=>{"use strict";var s3r=Function.prototype.call,u3r=Object.prototype.hasOwnProperty,l3r=n9();_jt.exports=l3r.call(s3r,u3r)});var Qae=x((a4o,Ejt)=>{"use strict";var eo,c3r=w1e(),d3r=fNt(),f3r=mNt(),p3r=gNt(),m3r=bNt(),rq=vNt(),tq=JD(),h3r=xNt(),g3r=CNt(),y3r=ENt(),b3r=TNt(),_3r=INt(),v3r=RNt(),w3r=jNt(),x3r=kNt(),Cjt=Function,T1e=function(t){try{return Cjt('"use strict"; return ('+t+").constructor;")()}catch{}},o9=x1e(),S3r=qNt(),A1e=function(){throw new tq},C3r=o9?function(){try{return arguments.callee,A1e}catch{try{return o9(arguments,"callee").get}catch{return A1e}}}():A1e,QU=GNt()(),kc=bjt(),O3r=C1e(),E3r=S1e(),Ojt=O1e(),i9=Zae(),eq={},P3r=typeof Uint8Array>"u"||!kc?eo:kc(Uint8Array),ZD={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?eo:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?eo:ArrayBuffer,"%ArrayIteratorPrototype%":QU&&kc?kc([][Symbol.iterator]()):eo,"%AsyncFromSyncIteratorPrototype%":eo,"%AsyncFunction%":eq,"%AsyncGenerator%":eq,"%AsyncGeneratorFunction%":eq,"%AsyncIteratorPrototype%":eq,"%Atomics%":typeof Atomics>"u"?eo:Atomics,"%BigInt%":typeof BigInt>"u"?eo:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?eo:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?eo:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?eo:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":d3r,"%eval%":eval,"%EvalError%":f3r,"%Float32Array%":typeof Float32Array>"u"?eo:Float32Array,"%Float64Array%":typeof Float64Array>"u"?eo:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?eo:FinalizationRegistry,"%Function%":Cjt,"%GeneratorFunction%":eq,"%Int8Array%":typeof Int8Array>"u"?eo:Int8Array,"%Int16Array%":typeof Int16Array>"u"?eo:Int16Array,"%Int32Array%":typeof Int32Array>"u"?eo:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":QU&&kc?kc(kc([][Symbol.iterator]())):eo,"%JSON%":typeof JSON=="object"?JSON:eo,"%Map%":typeof Map>"u"?eo:Map,"%MapIteratorPrototype%":typeof Map>"u"||!QU||!kc?eo:kc(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":c3r,"%Object.getOwnPropertyDescriptor%":o9,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?eo:Promise,"%Proxy%":typeof Proxy>"u"?eo:Proxy,"%RangeError%":p3r,"%ReferenceError%":m3r,"%Reflect%":typeof Reflect>"u"?eo:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?eo:Set,"%SetIteratorPrototype%":typeof Set>"u"||!QU||!kc?eo:kc(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?eo:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":QU&&kc?kc(""[Symbol.iterator]()):eo,"%Symbol%":QU?Symbol:eo,"%SyntaxError%":rq,"%ThrowTypeError%":C3r,"%TypedArray%":P3r,"%TypeError%":tq,"%Uint8Array%":typeof Uint8Array>"u"?eo:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?eo:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?eo:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?eo:Uint32Array,"%URIError%":h3r,"%WeakMap%":typeof WeakMap>"u"?eo:WeakMap,"%WeakRef%":typeof WeakRef>"u"?eo:WeakRef,"%WeakSet%":typeof WeakSet>"u"?eo:WeakSet,"%Function.prototype.call%":i9,"%Function.prototype.apply%":Ojt,"%Object.defineProperty%":S3r,"%Object.getPrototypeOf%":O3r,"%Math.abs%":g3r,"%Math.floor%":y3r,"%Math.max%":b3r,"%Math.min%":_3r,"%Math.pow%":v3r,"%Math.round%":w3r,"%Math.sign%":x3r,"%Reflect.getPrototypeOf%":E3r};if(kc)try{null.error}catch(t){wjt=kc(kc(t)),ZD["%Error.prototype%"]=wjt}var wjt,T3r=function t(e){var r;if(e==="%AsyncFunction%")r=T1e("async function () {}");else if(e==="%GeneratorFunction%")r=T1e("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=T1e("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&kc&&(r=kc(o.prototype))}return ZD[e]=r,r},xjt={__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"]},a9=n9(),Yae=vjt(),A3r=a9.call(i9,Array.prototype.concat),I3r=a9.call(Ojt,Array.prototype.splice),Sjt=a9.call(i9,String.prototype.replace),Xae=a9.call(i9,String.prototype.slice),M3r=a9.call(i9,RegExp.prototype.exec),R3r=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,N3r=/\\(\\)?/g,j3r=function(e){var r=Xae(e,0,1),n=Xae(e,-1);if(r==="%"&&n!=="%")throw new rq("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new rq("invalid intrinsic syntax, expected opening `%`");var o=[];return Sjt(e,R3r,function(i,a,s,u){o[o.length]=s?Sjt(u,N3r,"$1"):a||i}),o},D3r=function(e,r){var n=e,o;if(Yae(xjt,n)&&(o=xjt[n],n="%"+o[0]+"%"),Yae(ZD,n)){var i=ZD[n];if(i===eq&&(i=T3r(n)),typeof i>"u"&&!r)throw new tq("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new rq("intrinsic "+e+" does not exist!")};Ejt.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new tq("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new tq('"allowMissing" argument must be a boolean');if(M3r(/^%?[^%]*%?$/,e)===null)throw new rq("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=j3r(e),o=n.length>0?n[0]:"",i=D3r("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],I3r(n,A3r([0,1],l)));for(var c=1,d=!0;c<n.length;c+=1){var f=n[c],p=Xae(f,0,1),h=Xae(f,-1);if((p==='"'||p==="'"||p==="`"||h==='"'||h==="'"||h==="`")&&p!==h)throw new rq("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(u=!0),o+="."+f,a="%"+o+"%",Yae(ZD,a))s=ZD[a];else if(s!=null){if(!(f in s)){if(!r)throw new tq("base intrinsic for "+e+" exists, but the property is not available.");return}if(o9&&c+1>=n.length){var m=o9(s,f);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?s=m.get:s=s[f]}else d=Yae(s,f),s=s[f];d&&!u&&(ZD[a]=s)}}return s}});var I1e=x((s4o,Ajt)=>{"use strict";var Pjt=Qae(),Tjt=E1e(),L3r=Tjt([Pjt("%String.prototype.indexOf%")]);Ajt.exports=function(e,r){var n=Pjt(e,!!r);return typeof n=="function"&&L3r(e,".prototype.")>-1?Tjt([n]):n}});var M1e=x((u4o,Mjt)=>{"use strict";var F3r=Qae(),s9=I1e(),k3r=r9(),$3r=JD(),Ijt=F3r("%Map%",!0),B3r=s9("Map.prototype.get",!0),z3r=s9("Map.prototype.set",!0),U3r=s9("Map.prototype.has",!0),q3r=s9("Map.prototype.delete",!0),H3r=s9("Map.prototype.size",!0);Mjt.exports=!!Ijt&&function(){var e,r={assert:function(n){if(!r.has(n))throw new $3r("Side channel does not contain "+k3r(n))},delete:function(n){if(e){var o=q3r(e,n);return H3r(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return B3r(e,n)},has:function(n){return e?U3r(e,n):!1},set:function(n,o){e||(e=new Ijt),z3r(e,n,o)}};return r}});var Njt=x((l4o,Rjt)=>{"use strict";var V3r=Qae(),tse=I1e(),W3r=r9(),ese=M1e(),K3r=JD(),nq=V3r("%WeakMap%",!0),G3r=tse("WeakMap.prototype.get",!0),J3r=tse("WeakMap.prototype.set",!0),Z3r=tse("WeakMap.prototype.has",!0),Y3r=tse("WeakMap.prototype.delete",!0);Rjt.exports=nq?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new K3r("Side channel does not contain "+W3r(o))},delete:function(o){if(nq&&o&&(typeof o=="object"||typeof o=="function")){if(e)return Y3r(e,o)}else if(ese&&r)return r.delete(o);return!1},get:function(o){return nq&&o&&(typeof o=="object"||typeof o=="function")&&e?G3r(e,o):r&&r.get(o)},has:function(o){return nq&&o&&(typeof o=="object"||typeof o=="function")&&e?Z3r(e,o):!!r&&r.has(o)},set:function(o,i){nq&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new nq),J3r(e,o,i)):ese&&(r||(r=ese()),r.set(o,i))}};return n}:ese});var Djt=x((c4o,jjt)=>{"use strict";var X3r=JD(),Q3r=r9(),eHr=lNt(),tHr=M1e(),rHr=Njt(),nHr=rHr||tHr||eHr;jjt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new X3r("Side channel does not contain "+Q3r(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=nHr()),e.set(n,o)}};return r}});var rse=x((d4o,Ljt)=>{"use strict";var oHr=String.prototype.replace,iHr=/%20/g,R1e={RFC1738:"RFC1738",RFC3986:"RFC3986"};Ljt.exports={default:R1e.RFC3986,formatters:{RFC1738:function(t){return oHr.call(t,iHr,"+")},RFC3986:function(t){return String(t)}},RFC1738:R1e.RFC1738,RFC3986:R1e.RFC3986}});var j1e=x((f4o,kjt)=>{"use strict";var aHr=rse(),N1e=Object.prototype.hasOwnProperty,YD=Array.isArray,Cw=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),sHr=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(YD(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);r.obj[r.prop]=o}}},Fjt=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},uHr=function t(e,r,n){if(!r)return e;if(typeof r!="object"){if(YD(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!N1e.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 YD(e)&&!YD(r)&&(o=Fjt(e,n)),YD(e)&&YD(r)?(r.forEach(function(i,a){if(N1e.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 N1e.call(i,a)?i[a]=t(i[a],s,n):i[a]=s,i},o)},lHr=function(e,r){return Object.keys(r).reduce(function(n,o){return n[o]=r[o],n},e)},cHr=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}},dHr=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===aHr.RFC1738&&(l===40||l===41)){s+=a.charAt(u);continue}if(l<128){s=s+Cw[l];continue}if(l<2048){s=s+(Cw[192|l>>6]+Cw[128|l&63]);continue}if(l<55296||l>=57344){s=s+(Cw[224|l>>12]+Cw[128|l>>6&63]+Cw[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|a.charCodeAt(u)&1023),s+=Cw[240|l>>18]+Cw[128|l>>12&63]+Cw[128|l>>6&63]+Cw[128|l&63]}return s},fHr=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 sHr(r),e},pHr=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},mHr=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},hHr=function(e,r){return[].concat(e,r)},gHr=function(e,r){if(YD(e)){for(var n=[],o=0;o<e.length;o+=1)n.push(r(e[o]));return n}return r(e)};kjt.exports={arrayToObject:Fjt,assign:lHr,combine:hHr,compact:fHr,decode:cHr,encode:dHr,isBuffer:mHr,isRegExp:pHr,maybeMap:gHr,merge:uHr}});var Hjt=x((p4o,qjt)=>{"use strict";var zjt=Djt(),nse=j1e(),u9=rse(),yHr=Object.prototype.hasOwnProperty,$jt={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},dP=Array.isArray,bHr=Array.prototype.push,Ujt=function(t,e){bHr.apply(t,dP(e)?e:[e])},_Hr=Date.prototype.toISOString,Bjt=u9.default,Wf={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:nse.encode,encodeValuesOnly:!1,format:Bjt,formatter:u9.formatters[Bjt],indices:!1,serializeDate:function(e){return _Hr.call(e)},skipNulls:!1,strictNullHandling:!1},vHr=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},D1e={},wHr=function t(e,r,n,o,i,a,s,u,l,c,d,f,p,h,m,g){for(var y=e,_=g,w=0,S=!1;(_=_.get(D1e))!==void 0&&!S;){var C=_.get(e);if(w+=1,typeof C<"u"){if(C===w)throw new RangeError("Cyclic object value");S=!0}typeof _.get(D1e)>"u"&&(w=0)}if(typeof u=="function"?y=u(r,y):y instanceof Date?y=d(y):n==="comma"&&dP(y)&&(y=nse.maybeMap(y,function(U){return U instanceof Date?d(U):U})),y===null){if(i)return s&&!h?s(r,Wf.encoder,m,"key",f):r;y=""}if(vHr(y)||nse.isBuffer(y)){if(s){var E=h?r:s(r,Wf.encoder,m,"key",f);return[p(E)+"="+p(s(y,Wf.encoder,m,"value",f))]}return[p(r)+"="+p(String(y))]}var P=[];if(typeof y>"u")return P;var T;if(n==="comma"&&dP(y))h&&s&&(y=nse.maybeMap(y,s)),T=[{value:y.length>0?y.join(",")||null:void 0}];else if(dP(u))T=u;else{var I=Object.keys(y);T=l?I.sort(l):I}for(var N=o&&dP(y)&&y.length===1?r+"[]":r,M=0;M<T.length;++M){var D=T[M],k=typeof D=="object"&&typeof D.value<"u"?D.value:y[D];if(!(a&&k===null)){var F=dP(y)?typeof n=="function"?n(N,D):N:N+(c?"."+D:"["+D+"]");g.set(e,w);var K=zjt();K.set(D1e,g),Ujt(P,t(k,F,n,o,i,a,n==="comma"&&h&&dP(y)?null:s,u,l,c,d,f,p,h,m,K))}}return P},xHr=function(e){if(!e)return Wf;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||Wf.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=u9.default;if(typeof e.format<"u"){if(!yHr.call(u9.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var o=u9.formatters[n],i=Wf.filter;return(typeof e.filter=="function"||dP(e.filter))&&(i=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Wf.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Wf.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Wf.charsetSentinel,delimiter:typeof e.delimiter>"u"?Wf.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Wf.encode,encoder:typeof e.encoder=="function"?e.encoder:Wf.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Wf.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Wf.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Wf.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Wf.strictNullHandling}};qjt.exports=function(t,e){var r=t,n=xHr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):dP(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s;e&&e.arrayFormat in $jt?s=e.arrayFormat:e&&"indices"in e?s=e.indices?"indices":"repeat":s="indices";var u=$jt[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=zjt(),d=0;d<o.length;++d){var f=o[d];n.skipNulls&&r[f]===null||Ujt(a,wHr(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),h=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),p.length>0?h+p:""}});var Kjt=x((m4o,Wjt)=>{"use strict";var oq=j1e(),L1e=Object.prototype.hasOwnProperty,SHr=Array.isArray,$c={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:oq.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},CHr=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},Vjt=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},OHr="utf8=%26%2310003%3B",EHr="utf8=%E2%9C%93",PHr=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]===EHr?l="utf-8":a[u]===OHr&&(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,h;f===-1?(p=r.decoder(c,$c.decoder,l,"key"),h=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,f),$c.decoder,l,"key"),h=oq.maybeMap(Vjt(c.slice(f+1),r),function(m){return r.decoder(m,$c.decoder,l,"value")})),h&&r.interpretNumericEntities&&l==="iso-8859-1"&&(h=CHr(h)),c.indexOf("[]=")>-1&&(h=SHr(h)?[h]:h),L1e.call(n,p)?n[p]=oq.combine(n[p],h):n[p]=h}return n},THr=function(t,e,r,n){for(var o=n?e:Vjt(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},AHr=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&&L1e.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&&L1e.call(Object.prototype,u[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(u[1])}return u&&c.push("["+i.slice(u.index)+"]"),THr(c,r,n,o)}},IHr=function(e){if(!e)return $c;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"?$c.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?$c.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:$c.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:$c.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:$c.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:$c.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:$c.comma,decoder:typeof e.decoder=="function"?e.decoder:$c.decoder,delimiter:typeof e.delimiter=="string"||oq.isRegExp(e.delimiter)?e.delimiter:$c.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:$c.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:$c.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:$c.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:$c.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:$c.strictNullHandling}};Wjt.exports=function(t,e){var r=IHr(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?PHr(t,r):t,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],u=AHr(s,n[s],r,typeof t=="string");o=oq.merge(o,u,r)}return r.allowSparse===!0?o:oq.compact(o)}});var Jjt=x((h4o,Gjt)=>{"use strict";var MHr=Hjt(),RHr=Kjt(),NHr=rse();Gjt.exports={formats:NHr,parse:RHr,stringify:MHr}});var Zjt=x(iq=>{"use strict";var jHr=iq&&iq.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(iq,"__esModule",{value:!0});iq.createRequestUrl=void 0;var DHr=jHr(Jjt());function LHr(t,e){return Object.keys(e??{}).length>0?`${t}?${DHr.default.stringify(e,{arrayFormat:"repeat"})}`:t}iq.createRequestUrl=LHr});var Qjt=x(ose=>{"use strict";var F1e,k1e,$1e,B1e,z1e;Object.defineProperty(ose,"__esModule",{value:!0});ose.RUNTIME=void 0;var FHr=typeof window<"u"&&typeof window.document<"u",kHr=typeof self=="object"&&typeof self?.importScripts=="function"&&(((F1e=self.constructor)===null||F1e===void 0?void 0:F1e.name)==="DedicatedWorkerGlobalScope"||((k1e=self.constructor)===null||k1e===void 0?void 0:k1e.name)==="ServiceWorkerGlobalScope"||(($1e=self.constructor)===null||$1e===void 0?void 0:$1e.name)==="SharedWorkerGlobalScope"),Yjt=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",Xjt=typeof Bun<"u"&&typeof Bun.version<"u",$Hr=typeof process<"u"&&!!process.version&&!!(!((B1e=process.versions)===null||B1e===void 0)&&B1e.node)&&!Yjt&&!Xjt,BHr=typeof navigator<"u"&&navigator?.product==="ReactNative",zHr=typeof globalThis<"u"&&((z1e=globalThis?.navigator)===null||z1e===void 0?void 0:z1e.userAgent)==="Cloudflare-Workers";ose.RUNTIME=UHr();function UHr(){return FHr?{type:"browser",version:window.navigator.userAgent}:zHr?{type:"workerd"}:kHr?{type:"web-worker"}:Yjt?{type:"deno",version:Deno.version.deno}:Xjt?{type:"bun",version:Bun.version}:$Hr?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:BHr?{type:"react-native"}:{type:"unknown"}}});var aq=x(ise=>{"use strict";Object.defineProperty(ise,"__esModule",{value:!0});ise.RUNTIME=void 0;var qHr=Qjt();Object.defineProperty(ise,"RUNTIME",{enumerable:!0,get:function(){return qHr.RUNTIME}})});var U1e=x((sq,eDt)=>{"use strict";var HHr=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},XD=HHr();eDt.exports=sq=XD.fetch;XD.fetch&&(sq.default=XD.fetch.bind(XD));sq.Headers=XD.Headers;sq.Request=XD.Request;sq.Response=XD.Response});var rDt=x(yy=>{"use strict";var VHr=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]}),WHr=yy&&yy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tDt=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)&&VHr(e,t,r);return WHr(e,t),e},KHr=yy&&yy.__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(yy,"__esModule",{value:!0});yy.getFetchFn=void 0;var ase=aq();function GHr(){return KHr(this,void 0,void 0,function*(){return ase.RUNTIME.type==="node"&&ase.RUNTIME.parsedVersion!=null&&ase.RUNTIME.parsedVersion>=18?fetch:ase.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>tDt(U1e()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>tDt(U1e()))).default})}yy.getFetchFn=GHr});var nDt=x(uq=>{"use strict";var JHr=uq&&uq.__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(uq,"__esModule",{value:!0});uq.getRequestBody=void 0;function ZHr({body:t,type:e}){return JHr(this,void 0,void 0,function*(){return e.includes("json")?JSON.stringify(t):t})}uq.getRequestBody=ZHr});var oDt=x(lq=>{"use strict";var Yb=lq&&lq.__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(lq,"__esModule",{value:!0});lq.Node18UniversalStreamWrapper=void 0;var q1e=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=>Yb(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",()=>Yb(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>Yb(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=>Yb(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",()=>Yb(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>Yb(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 Yb(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 Yb(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 Yb(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 Yb(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:()=>Yb(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}}}};lq.Node18UniversalStreamWrapper=q1e});var iDt=x(cq=>{"use strict";var l9=cq&&cq.__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(cq,"__esModule",{value:!0});cq.UndiciStreamWrapper=void 0;var H1e=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 l9(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 l9(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 l9(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 l9(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:()=>l9(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}}}};cq.UndiciStreamWrapper=H1e});var aDt=x(hM=>{"use strict";var sse=hM&&hM.__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())})},YHr=hM&&hM.__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(hM,"__esModule",{value:!0});hM.NodePre18StreamWrapper=void 0;var V1e=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 sse(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 sse(this,void 0,void 0,function*(){let n=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");try{for(var i=YHr(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 sse(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 sse(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};hM.NodePre18StreamWrapper=V1e});var sDt=x(by=>{"use strict";var XHr=by&&by.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QHr=by&&by.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W1e=by&&by.__importStar||function(t){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 QHr(e,t),e},eVr=by&&by.__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(by,"__esModule",{value:!0});by.chooseStreamWrapper=void 0;var use=aq();function tVr(t){return eVr(this,void 0,void 0,function*(){return use.RUNTIME.type==="node"&&use.RUNTIME.parsedVersion!=null&&use.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>W1e(oDt()))).Node18UniversalStreamWrapper(t):use.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>W1e(iDt()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>W1e(aDt()))).NodePre18StreamWrapper(t)})}by.chooseStreamWrapper=tVr});var uDt=x(dq=>{"use strict";var rVr=dq&&dq.__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(dq,"__esModule",{value:!0});dq.getResponseBody=void 0;var nVr=sDt();function oVr(t,e){return rVr(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,nVr.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}})}dq.getResponseBody=oVr});var lDt=x(fq=>{"use strict";Object.defineProperty(fq,"__esModule",{value:!0});fq.anySignal=fq.getTimeoutSignal=void 0;var iVr="timeout";function aVr(t){let e=new AbortController,r=setTimeout(()=>e.abort(iVr),t);return{signal:e.signal,abortId:r}}fq.getTimeoutSignal=aVr;function sVr(...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}fq.anySignal=sVr});var dDt=x(pq=>{"use strict";var uVr=pq&&pq.__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(pq,"__esModule",{value:!0});pq.makeRequest=void 0;var cDt=lDt(),lVr=(t,e,r,n,o,i,a,s,u)=>uVr(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:h}=(0,cDt.getTimeoutSignal)(i);c=h,l.push(p)}a!=null&&l.push(a);let d=(0,cDt.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});pq.makeRequest=lVr});var fDt=x(mq=>{"use strict";var cVr=mq&&mq.__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(mq,"__esModule",{value:!0});mq.requestWithRetries=void 0;var dVr=1,fVr=60,pVr=2;function mVr(t,e=pVr){return cVr(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(dVr*Math.pow(2,n),fVr);yield new Promise(i=>setTimeout(i,o)),r=yield t()}return r})}mq.requestWithRetries=mVr});var hDt=x(gM=>{"use strict";var pDt=gM&&gM.__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(gM,"__esModule",{value:!0});gM.fetcher=gM.fetcherImpl=void 0;var hVr=Zjt(),gVr=rDt(),yVr=nDt(),bVr=uDt(),_Vr=dDt(),vVr=fDt();function mDt(t){return pDt(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,hVr.createRequestUrl)(t.url,t.queryParameters),n=yield(0,yVr.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,gVr.getFetchFn)();try{let i=yield(0,vVr.requestWithRetries)(()=>pDt(this,void 0,void 0,function*(){return(0,_Vr.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,bVr.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)}}}})}gM.fetcherImpl=mDt;gM.fetcher=mDt});var gDt=x(lse=>{"use strict";Object.defineProperty(lse,"__esModule",{value:!0});lse.getHeader=void 0;function wVr(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}lse.getHeader=wVr});var yDt=x(hq=>{"use strict";var xVr=hq&&hq.__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(hq,"__esModule",{value:!0});hq.Supplier=void 0;hq.Supplier={get:t=>xVr(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var bDt=x(yM=>{"use strict";Object.defineProperty(yM,"__esModule",{value:!0});yM.Supplier=yM.getHeader=yM.fetcher=void 0;var SVr=hDt();Object.defineProperty(yM,"fetcher",{enumerable:!0,get:function(){return SVr.fetcher}});var CVr=gDt();Object.defineProperty(yM,"getHeader",{enumerable:!0,get:function(){return CVr.getHeader}});var OVr=yDt();Object.defineProperty(yM,"Supplier",{enumerable:!0,get:function(){return OVr.Supplier}})});var _Dt=x((K1e,G1e)=>{(function(t,e){typeof K1e=="object"&&typeof G1e<"u"?G1e.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:K1e,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(H){var G={};return H.forEach(function(Z,de){return G[Z]=de}),G}(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(H,G){return G===void 0&&(G=function(Z){return Z}),new Uint8Array(Array.prototype.slice.call(H,0).map(G))},p=function(H){return H.replace(/=/g,"").replace(/[+\/]/g,function(G){return G=="+"?"-":"_"})},h=function(H){return H.replace(/[^A-Za-z0-9\+\/]/g,"")},m=function(H){for(var G,Z,de,pe,ae="",Te=H.length%3,Ae=0;Ae<H.length;){if((Z=H.charCodeAt(Ae++))>255||(de=H.charCodeAt(Ae++))>255||(pe=H.charCodeAt(Ae++))>255)throw new TypeError("invalid character found");G=Z<<16|de<<8|pe,ae+=u[G>>18&63]+u[G>>12&63]+u[G>>6&63]+u[G&63]}return Te?ae.slice(0,Te-3)+"===".substring(Te):ae},g=n?function(H){return btoa(H)}:o?function(H){return Buffer.from(H,"binary").toString("base64")}:m,y=o?function(H){return Buffer.from(H).toString("base64")}:function(H){for(var G=4096,Z=[],de=0,pe=H.length;de<pe;de+=G)Z.push(d.apply(null,H.subarray(de,de+G)));return g(Z.join(""))},_=function(H,G){return G===void 0&&(G=!1),G?p(y(H)):y(H)},w=function(H){if(H.length<2){var G=H.charCodeAt(0);return G<128?H:G<2048?d(192|G>>>6)+d(128|G&63):d(224|G>>>12&15)+d(128|G>>>6&63)+d(128|G&63)}else{var G=65536+(H.charCodeAt(0)-55296)*1024+(H.charCodeAt(1)-56320);return d(240|G>>>18&7)+d(128|G>>>12&63)+d(128|G>>>6&63)+d(128|G&63)}},S=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,C=function(H){return H.replace(S,w)},E=o?function(H){return Buffer.from(H,"utf8").toString("base64")}:a?function(H){return y(a.encode(H))}:function(H){return g(C(H))},P=function(H,G){return G===void 0&&(G=!1),G?p(E(H)):E(H)},T=function(H){return P(H,!0)},I=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,N=function(H){switch(H.length){case 4:var G=(7&H.charCodeAt(0))<<18|(63&H.charCodeAt(1))<<12|(63&H.charCodeAt(2))<<6|63&H.charCodeAt(3),Z=G-65536;return d((Z>>>10)+55296)+d((Z&1023)+56320);case 3:return d((15&H.charCodeAt(0))<<12|(63&H.charCodeAt(1))<<6|63&H.charCodeAt(2));default:return d((31&H.charCodeAt(0))<<6|63&H.charCodeAt(1))}},M=function(H){return H.replace(I,N)},D=function(H){if(H=H.replace(/\s+/g,""),!c.test(H))throw new TypeError("malformed base64.");H+="==".slice(2-(H.length&3));for(var G,Z="",de,pe,ae=0;ae<H.length;)G=l[H.charAt(ae++)]<<18|l[H.charAt(ae++)]<<12|(de=l[H.charAt(ae++)])<<6|(pe=l[H.charAt(ae++)]),Z+=de===64?d(G>>16&255):pe===64?d(G>>16&255,G>>8&255):d(G>>16&255,G>>8&255,G&255);return Z},k=r?function(H){return atob(h(H))}:o?function(H){return Buffer.from(H,"base64").toString("binary")}:D,F=o?function(H){return f(Buffer.from(H,"base64"))}:function(H){return f(k(H),function(G){return G.charCodeAt(0)})},K=function(H){return F(Y(H))},U=o?function(H){return Buffer.from(H,"base64").toString("utf8")}:i?function(H){return i.decode(F(H))}:function(H){return M(k(H))},Y=function(H){return h(H.replace(/[-_]/g,function(G){return G=="-"?"+":"/"}))},ee=function(H){return U(Y(H))},L=function(H){if(typeof H!="string")return!1;var G=H.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(G)||!/[^\s0-9a-zA-Z\-_]/.test(G)},Q=function(H){return{value:H,enumerable:!1,writable:!0,configurable:!0}},z=function(){var H=function(G,Z){return Object.defineProperty(String.prototype,G,Q(Z))};H("fromBase64",function(){return ee(this)}),H("toBase64",function(G){return P(this,G)}),H("toBase64URI",function(){return P(this,!0)}),H("toBase64URL",function(){return P(this,!0)}),H("toUint8Array",function(){return K(this)})},W=function(){var H=function(G,Z){return Object.defineProperty(Uint8Array.prototype,G,Q(Z))};H("toBase64",function(G){return _(this,G)}),H("toBase64URI",function(){return _(this,!0)}),H("toBase64URL",function(){return _(this,!0)})},V=function(){z(),W()},q={version:t,VERSION:e,atob:k,atobPolyfill:D,btoa:g,btoaPolyfill:m,fromBase64:ee,toBase64:P,encode:P,encodeURI:T,encodeURL:T,utob:C,btou:M,decode:ee,isValid:L,fromUint8Array:_,toUint8Array:K,extendString:z,extendUint8Array:W,extendBuiltins:V};return q.Base64={},Object.keys(q).forEach(function(H){return q.Base64[H]=q[H]}),q})});var wDt=x(cse=>{"use strict";Object.defineProperty(cse,"__esModule",{value:!0});cse.BasicAuth=void 0;var vDt=_Dt(),EVr=/^Basic /i;cse.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${vDt.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(EVr,""),r=vDt.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 xDt=x(dse=>{"use strict";Object.defineProperty(dse,"__esModule",{value:!0});dse.BearerToken=void 0;var PVr=/^Bearer /i;dse.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(PVr,"").trim()}});var SDt=x(gq=>{"use strict";Object.defineProperty(gq,"__esModule",{value:!0});gq.BearerToken=gq.BasicAuth=void 0;var TVr=wDt();Object.defineProperty(gq,"BasicAuth",{enumerable:!0,get:function(){return TVr.BasicAuth}});var AVr=xDt();Object.defineProperty(gq,"BearerToken",{enumerable:!0,get:function(){return AVr.BearerToken}})});var Z1e=x($m=>{"use strict";var CDt=$m&&$m.__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())})},ODt=$m&&$m.__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)}},Xb=$m&&$m.__await||function(t){return this instanceof Xb?(this.v=t,this):new Xb(t)},EDt=$m&&$m.__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(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Xb?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($m,"__esModule",{value:!0});$m.readableStreamAsyncIterable=$m.Stream=void 0;var IVr=aq(),MVr="data:",J1e=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=MVr,this.messageTerminator=`
`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return EDt(this,arguments,function*(){var r,n;this.controller.signal;let o=PDt(this.stream),i="",a=!1;try{for(var s=ODt(o),u;u=yield Xb(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 Xb(void 0);let f=yield Xb(this.parse(JSON.parse(d)));yield yield Xb(f),a=!1}}}catch(l){r={error:l}}finally{try{u&&!u.done&&(n=s.return)&&(yield Xb(n.call(s)))}finally{if(r)throw r.error}}})}[Symbol.asyncIterator](){return EDt(this,arguments,function*(){var r,n;try{for(var o=ODt(this.iterMessages()),i;i=yield Xb(o.next()),!i.done;){let a=i.value;yield yield Xb(a)}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&(yield Xb(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 IVr.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};$m.Stream=J1e;function PDt(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return CDt(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 CDt(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}$m.readableStreamAsyncIterable=PDt});var TDt=x(fse=>{"use strict";Object.defineProperty(fse,"__esModule",{value:!0});fse.Stream=void 0;var RVr=Z1e();Object.defineProperty(fse,"Stream",{enumerable:!0,get:function(){return RVr.Stream}})});var MDt=x((k4o,IDt)=>{"use strict";var Y1e=Object.defineProperty,NVr=Object.getOwnPropertyDescriptor,jVr=Object.getOwnPropertyNames,DVr=Object.prototype.hasOwnProperty,LVr=(t,e)=>{for(var r in e)Y1e(t,r,{get:e[r],enumerable:!0})},FVr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of jVr(e))!DVr.call(t,o)&&o!==r&&Y1e(t,o,{get:()=>e[o],enumerable:!(n=NVr(e,o))||n.enumerable});return t},kVr=t=>FVr(Y1e({},"__esModule",{value:!0}),t),ADt={};LVr(ADt,{Blob:()=>zVr,File:()=>UVr,FormData:()=>BVr});IDt.exports=kVr(ADt);var $Vr=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:BVr,Blob:zVr,File:UVr}=$Vr});var HDt=x(($4o,qDt)=>{"use strict";var eNe=Object.defineProperty,qVr=Object.getOwnPropertyDescriptor,HVr=Object.getOwnPropertyNames,VVr=Object.prototype.hasOwnProperty,WVr=(t,e)=>{for(var r in e)eNe(t,r,{get:e[r],enumerable:!0})},KVr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of HVr(e))!VVr.call(t,o)&&o!==r&&eNe(t,o,{get:()=>e[o],enumerable:!(n=qVr(e,o))||n.enumerable});return t},GVr=t=>KVr(eNe({},"__esModule",{value:!0}),t),tNe=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},Ns=(t,e,r)=>(tNe(t,e,"read from private field"),r?r.call(t):e.get(t)),Ow=(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)},c9=(t,e,r,n)=>(tNe(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),X1e=(t,e,r)=>(tNe(t,e,"access private method"),r),kDt={};WVr(kDt,{FormDataEncoder:()=>r6r,isFile:()=>eL,isFormData:()=>zDt});qDt.exports=GVr(kDt);var fP=t=>typeof t=="function",JVr=t=>fP(t[Symbol.asyncIterator]),RDt=65536;function*$Dt(t){if(t.byteLength<=RDt){yield t;return}let e=0;for(;e<t.byteLength;){let r=Math.min(t.byteLength-e,RDt),n=t.buffer.slice(e,e+r);e+=n.byteLength,yield new Uint8Array(n)}}async function*ZVr(t){let e=t.getReader();for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}async function*NDt(t){for await(let e of t)yield*$Dt(e)}var YVr=t=>{if(JVr(t))return NDt(t);if(fP(t.getReader))return NDt(ZVr(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},jDt="abcdefghijklmnopqrstuvwxyz0123456789";function XVr(){let t=16,e="";for(;t--;)e+=jDt[Math.random()*jDt.length<<0];return e}var BDt=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==`
`||e===`
`&&n[r-1]!=="\r"?`\r
`:e),QVr=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function DDt(t){if(QVr(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function LDt(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var e6r=t=>new Proxy(t,{get:(e,r)=>LDt(e,r),has:(e,r)=>LDt(e,r)!==void 0}),zDt=t=>!!(t&&fP(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&fP(t.append)&&fP(t.getAll)&&fP(t.entries)&&fP(t[Symbol.iterator])),FDt=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),eL=t=>!!(t&&typeof t=="object"&&fP(t.constructor)&&t[Symbol.toStringTag]==="File"&&fP(t.stream)&&t.name!=null),t6r={enableAdditionalHeaders:!1},pse={writable:!1,configurable:!1},bM,d9,mse,f9,QD,p9,m9,hse,gse,rNe,Q1e,UDt,r6r=class{constructor(t,e,r){if(Ow(this,gse),Ow(this,Q1e),Ow(this,bM,`\r
`),Ow(this,d9,void 0),Ow(this,mse,void 0),Ow(this,f9,"-".repeat(2)),Ow(this,QD,new TextEncoder),Ow(this,p9,void 0),Ow(this,m9,void 0),Ow(this,hse,void 0),!zDt(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(DDt(e)?r=e:n=e,n||(n=XVr()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!DDt(r))throw new TypeError("Expected options argument to be an object.");c9(this,m9,Array.from(t.entries())),c9(this,hse,{...t6r,...r}),c9(this,d9,Ns(this,QD).encode(Ns(this,bM))),c9(this,mse,Ns(this,d9).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,c9(this,p9,Ns(this,QD).encode(`${Ns(this,f9)}${this.boundary}${Ns(this,f9)}${Ns(this,bM).repeat(2)}`));let o={"Content-Type":this.contentType},i=X1e(this,Q1e,UDt).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=e6r(Object.freeze(o)),Object.defineProperties(this,{boundary:pse,contentType:pse,contentLength:pse,headers:pse})}*values(){for(let[t,e]of Ns(this,m9)){let r=eL(e)?e:Ns(this,QD).encode(BDt(e));yield X1e(this,gse,rNe).call(this,t,r),yield r,yield Ns(this,d9)}yield Ns(this,p9)}async*encode(){for(let t of this.values())eL(t)?yield*YVr(t.stream()):yield*$Dt(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};bM=new WeakMap;d9=new WeakMap;mse=new WeakMap;f9=new WeakMap;QD=new WeakMap;p9=new WeakMap;m9=new WeakMap;hse=new WeakMap;gse=new WeakSet;rNe=function(t,e){let r="";if(r+=`${Ns(this,f9)}${this.boundary}${Ns(this,bM)}`,r+=`Content-Disposition: form-data; name="${FDt(t)}"`,eL(e)&&(r+=`; filename="${FDt(e.name)}"${Ns(this,bM)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),Ns(this,hse).enableAdditionalHeaders===!0){let n=eL(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${Ns(this,bM)}Content-Length: ${n}`)}return Ns(this,QD).encode(`${r}${Ns(this,bM).repeat(2)}`)};Q1e=new WeakSet;UDt=function(){let t=0;for(let[e,r]of Ns(this,m9)){let n=eL(r)?r:Ns(this,QD).encode(BDt(r)),o=eL(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=X1e(this,gse,rNe).call(this,e,n).byteLength,t+=o,t+=Ns(this,mse)}return String(t+Ns(this,p9).byteLength)}});var WDt=x((z4o,VDt)=>{"use strict";VDt.exports=typeof self=="object"?self.FormData:window.FormData});var KDt=x(Bc=>{"use strict";var n6r=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]}),o6r=Bc&&Bc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yq=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)&&n6r(e,t,r);return o6r(e,t),e},_M=Bc&&Bc.__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(Bc,"__esModule",{value:!0});Bc.WebFormData=Bc.Node16FormData=Bc.Node18FormData=Bc.newFormData=void 0;var yse=aq();function nNe(t){return typeof t=="object"&&t!=null&&"name"in t}function i6r(){return _M(this,void 0,void 0,function*(){let t;return yse.RUNTIME.type==="node"&&yse.RUNTIME.parsedVersion!=null&&yse.RUNTIME.parsedVersion>=18?t=new bse:yse.RUNTIME.type==="node"?t=new _se:t=new vse,yield t.setup(),t})}Bc.newFormData=i6r;var bse=class{setup(){return _M(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>yq(MDt()))).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 _M(this,void 0,void 0,function*(){n==null&&nNe(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>yq(XW()))).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 _M(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>yq(HDt()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>yq(XW()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};Bc.Node18FormData=bse;var _se=class{setup(){return _M(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>yq(WDt()))).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 _M(this,void 0,void 0,function*(){n==null&&nNe(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>yq(XW()))).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():{}}}};Bc.Node16FormData=_se;var vse=class{setup(){return _M(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 _M(this,void 0,void 0,function*(){n==null&&nNe(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};Bc.WebFormData=vse});var GDt=x(tL=>{"use strict";var a6r=tL&&tL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s6r=tL&&tL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&a6r(e,t,r)};Object.defineProperty(tL,"__esModule",{value:!0});s6r(KDt(),tL)});var jd=x(wse=>{"use strict";Object.defineProperty(wse,"__esModule",{value:!0});wse.SchemaType=void 0;wse.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 Bm=x(xse=>{"use strict";Object.defineProperty(xse,"__esModule",{value:!0});xse.getErrorMessageForIncorrectType=void 0;function u6r(t,e){return`Expected ${e}. Received ${l6r(t)}.`}xse.getErrorMessageForIncorrectType=u6r;function l6r(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 pP=x(Sse=>{"use strict";Object.defineProperty(Sse,"__esModule",{value:!0});Sse.maybeSkipValidation=void 0;function c6r(t){return Object.assign(Object.assign({},t),{json:JDt(t.json),parse:JDt(t.parse)})}Sse.maybeSkipValidation=c6r;function JDt(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 oNe=x(Cse=>{"use strict";Object.defineProperty(Cse,"__esModule",{value:!0});Cse.stringifyValidationError=void 0;function d6r(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}Cse.stringifyValidationError=d6r});var aNe=x(Ose=>{"use strict";Object.defineProperty(Ose,"__esModule",{value:!0});Ose.JsonError=void 0;var f6r=oNe(),iNe=class t extends Error{constructor(e){super(e.map(f6r.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};Ose.JsonError=iNe});var uNe=x(Ese=>{"use strict";Object.defineProperty(Ese,"__esModule",{value:!0});Ese.ParseError=void 0;var p6r=oNe(),sNe=class t extends Error{constructor(e){super(e.map(p6r.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};Ese.ParseError=sNe});var XDt=x(vM=>{"use strict";Object.defineProperty(vM,"__esModule",{value:!0});vM.transform=vM.optional=vM.getSchemaUtils=void 0;var m6r=jd(),h6r=aNe(),g6r=uNe();function lNe(t){return{optional:()=>ZDt(t),transform:e=>YDt(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new g6r.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new h6r.JsonError(n.errors)}}}vM.getSchemaUtils=lNe;function ZDt(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:()=>m6r.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),lNe(e))}vM.optional=ZDt;function YDt(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),lNe(r))}vM.transform=YDt});var Vh=x(_y=>{"use strict";Object.defineProperty(_y,"__esModule",{value:!0});_y.ParseError=_y.JsonError=_y.transform=_y.optional=_y.getSchemaUtils=void 0;var cNe=XDt();Object.defineProperty(_y,"getSchemaUtils",{enumerable:!0,get:function(){return cNe.getSchemaUtils}});Object.defineProperty(_y,"optional",{enumerable:!0,get:function(){return cNe.optional}});Object.defineProperty(_y,"transform",{enumerable:!0,get:function(){return cNe.transform}});var y6r=aNe();Object.defineProperty(_y,"JsonError",{enumerable:!0,get:function(){return y6r.JsonError}});var b6r=uNe();Object.defineProperty(_y,"ParseError",{enumerable:!0,get:function(){return b6r.ParseError}})});var QDt=x(Pse=>{"use strict";Object.defineProperty(Pse,"__esModule",{value:!0});Pse.date=void 0;var _6r=jd(),dNe=Bm(),v6r=pP(),w6r=Vh(),x6r=/^([+-]?\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 S6r(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,dNe.getErrorMessageForIncorrectType)(e,"string")}]}:x6r.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,dNe.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,dNe.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>_6r.SchemaType.DATE};return Object.assign(Object.assign({},(0,v6r.maybeSkipValidation)(t)),(0,w6r.getSchemaUtils)(t))}Pse.date=S6r});var eLt=x(Tse=>{"use strict";Object.defineProperty(Tse,"__esModule",{value:!0});Tse.date=void 0;var C6r=QDt();Object.defineProperty(Tse,"date",{enumerable:!0,get:function(){return C6r.date}})});var mP=x(Ase=>{"use strict";Object.defineProperty(Ase,"__esModule",{value:!0});Ase.createIdentitySchemaCreator=void 0;var O6r=Vh(),E6r=pP();function P6r(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,E6r.maybeSkipValidation)(r)),(0,O6r.getSchemaUtils)(r))}}Ase.createIdentitySchemaCreator=P6r});var rLt=x(Ise=>{"use strict";Object.defineProperty(Ise,"__esModule",{value:!0});Ise.enum_=void 0;var T6r=jd(),A6r=mP(),tLt=Bm();function I6r(t){let e=new Set(t);return(0,A6r.createIdentitySchemaCreator)(T6r.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,tLt.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,tLt.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}Ise.enum_=I6r});var fNe=x(Mse=>{"use strict";Object.defineProperty(Mse,"__esModule",{value:!0});Mse.enum_=void 0;var M6r=rLt();Object.defineProperty(Mse,"enum_",{enumerable:!0,get:function(){return M6r.enum_}})});var pNe=x(wM=>{"use strict";Object.defineProperty(wM,"__esModule",{value:!0});wM.getMemoizedSchema=wM.constructLazyBaseSchema=wM.lazy=void 0;var R6r=Vh();function N6r(t){let e=nLt(t);return Object.assign(Object.assign({},e),(0,R6r.getSchemaUtils)(e))}wM.lazy=N6r;function nLt(t){return{parse:(e,r)=>Rse(t).parse(e,r),json:(e,r)=>Rse(t).json(e,r),getType:()=>Rse(t).getType()}}wM.constructLazyBaseSchema=nLt;function Rse(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}wM.getMemoizedSchema=Rse});var mNe=x(Nse=>{"use strict";Object.defineProperty(Nse,"__esModule",{value:!0});Nse.entries=void 0;function j6r(t){return Object.entries(t)}Nse.entries=j6r});var hNe=x(jse=>{"use strict";Object.defineProperty(jse,"__esModule",{value:!0});jse.filterObject=void 0;function D6r(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}jse.filterObject=D6r});var h9=x(Dse=>{"use strict";Object.defineProperty(Dse,"__esModule",{value:!0});Dse.isPlainObject=void 0;function L6r(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}Dse.isPlainObject=L6r});var gNe=x(Lse=>{"use strict";Object.defineProperty(Lse,"__esModule",{value:!0});Lse.keys=void 0;function F6r(t){return Object.keys(t)}Lse.keys=F6r});var oLt=x(Fse=>{"use strict";Object.defineProperty(Fse,"__esModule",{value:!0});Fse.partition=void 0;function k6r(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}Fse.partition=k6r});var sLt=x(bq=>{"use strict";Object.defineProperty(bq,"__esModule",{value:!0});bq.withParsedProperties=bq.getObjectLikeUtils=void 0;var $6r=hNe(),B6r=Bm(),z6r=h9(),U6r=Vh();function iLt(t){return{withParsedProperties:e=>aLt(t,e)}}bq.getObjectLikeUtils=iLt;function aLt(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,z6r.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,B6r.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,$6r.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,U6r.getSchemaUtils)(r)),iLt(r))}bq.withParsedProperties=aLt});var g9=x(_q=>{"use strict";Object.defineProperty(_q,"__esModule",{value:!0});_q.withParsedProperties=_q.getObjectLikeUtils=void 0;var uLt=sLt();Object.defineProperty(_q,"getObjectLikeUtils",{enumerable:!0,get:function(){return uLt.getObjectLikeUtils}});Object.defineProperty(_q,"withParsedProperties",{enumerable:!0,get:function(){return uLt.withParsedProperties}})});var yNe=x(vq=>{"use strict";Object.defineProperty(vq,"__esModule",{value:!0});vq.isProperty=vq.property=void 0;function q6r(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}vq.property=q6r;function H6r(t){return t.isProperty}vq.isProperty=H6r});var _Ne=x(wq=>{"use strict";Object.defineProperty(wq,"__esModule",{value:!0});wq.getObjectUtils=wq.object=void 0;var b9=jd(),lLt=mNe(),cLt=hNe(),V6r=Bm(),W6r=h9(),mLt=gNe(),K6r=pP(),G6r=oLt(),hLt=g9(),gLt=Vh(),y9=yNe();function J6r(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,y9.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,mLt.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,lLt.entries)(t)){let u=(0,y9.isProperty)(s)?s.rawKey:a,l=(0,y9.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,pLt(l)&&i.push(u)}return dLt({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,lLt.entries)(t)){let s=(0,y9.isProperty)(a)?a.valueSchema:a;pLt(s)&&o.push(i)}return dLt({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,y9.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:()=>b9.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,K6r.maybeSkipValidation)(e)),(0,gLt.getSchemaUtils)(e)),(0,hLt.getObjectLikeUtils)(e)),bNe(e))}wq.object=J6r;function dLt({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,W6r.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,V6r.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 bNe(t){return{extend:e=>{let r={_getParsedProperties:()=>[...t._getParsedProperties(),...e._getParsedProperties()],_getRawProperties:()=>[...t._getRawProperties(),...e._getRawProperties()],parse:(n,o)=>fLt({extensionKeys:e._getRawProperties(),value:n,transformBase:i=>t.parse(i,o),transformExtension:i=>e.parse(i,o)}),json:(n,o)=>fLt({extensionKeys:e._getParsedProperties(),value:n,transformBase:i=>t.json(i,o),transformExtension:i=>e.json(i,o)}),getType:()=>b9.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,gLt.getSchemaUtils)(r)),(0,hLt.getObjectLikeUtils)(r)),bNe(r))}}}wq.getObjectUtils=bNe;function fLt({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,G6r.partition)((0,mLt.keys)(e),l=>o.has(l)),s=r((0,cLt.filterObject)(e,a)),u=n((0,cLt.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 pLt(t){return!Z6r(t)}function Z6r(t){switch(t.getType()){case b9.SchemaType.ANY:case b9.SchemaType.UNKNOWN:case b9.SchemaType.OPTIONAL:return!0;default:return!1}}});var yLt=x(kse=>{"use strict";Object.defineProperty(kse,"__esModule",{value:!0});kse.objectWithoutOptionalProperties=void 0;var Y6r=_Ne();function X6r(t){return(0,Y6r.object)(t)}kse.objectWithoutOptionalProperties=X6r});var vNe=x(vy=>{"use strict";Object.defineProperty(vy,"__esModule",{value:!0});vy.property=vy.isProperty=vy.objectWithoutOptionalProperties=vy.object=vy.getObjectUtils=void 0;var bLt=_Ne();Object.defineProperty(vy,"getObjectUtils",{enumerable:!0,get:function(){return bLt.getObjectUtils}});Object.defineProperty(vy,"object",{enumerable:!0,get:function(){return bLt.object}});var Q6r=yLt();Object.defineProperty(vy,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return Q6r.objectWithoutOptionalProperties}});var _Lt=yNe();Object.defineProperty(vy,"isProperty",{enumerable:!0,get:function(){return _Lt.isProperty}});Object.defineProperty(vy,"property",{enumerable:!0,get:function(){return _Lt.property}})});var vLt=x($se=>{"use strict";Object.defineProperty($se,"__esModule",{value:!0});$se.lazyObject=void 0;var e8r=vNe(),t8r=g9(),r8r=Vh(),wNe=pNe();function n8r(t){let e=Object.assign(Object.assign({},(0,wNe.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,wNe.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,wNe.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,r8r.getSchemaUtils)(e)),(0,t8r.getObjectLikeUtils)(e)),(0,e8r.getObjectUtils)(e))}$se.lazyObject=n8r});var wLt=x(xq=>{"use strict";Object.defineProperty(xq,"__esModule",{value:!0});xq.lazyObject=xq.lazy=void 0;var o8r=pNe();Object.defineProperty(xq,"lazy",{enumerable:!0,get:function(){return o8r.lazy}});var i8r=vLt();Object.defineProperty(xq,"lazyObject",{enumerable:!0,get:function(){return i8r.lazyObject}})});var SLt=x(Bse=>{"use strict";Object.defineProperty(Bse,"__esModule",{value:!0});Bse.list=void 0;var a8r=jd(),s8r=Bm(),u8r=pP(),l8r=Vh();function c8r(t){let e={parse:(r,n)=>xLt(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)=>xLt(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:()=>a8r.SchemaType.LIST};return Object.assign(Object.assign({},(0,u8r.maybeSkipValidation)(e)),(0,l8r.getSchemaUtils)(e))}Bse.list=c8r;function xLt(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,s8r.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var xNe=x(zse=>{"use strict";Object.defineProperty(zse,"__esModule",{value:!0});zse.list=void 0;var d8r=SLt();Object.defineProperty(zse,"list",{enumerable:!0,get:function(){return d8r.list}})});var CLt=x(Use=>{"use strict";Object.defineProperty(Use,"__esModule",{value:!0});Use.stringLiteral=void 0;var f8r=jd(),p8r=mP(),m8r=Bm();function h8r(t){return(0,p8r.createIdentitySchemaCreator)(f8r.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,m8r.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}Use.stringLiteral=h8r});var OLt=x(qse=>{"use strict";Object.defineProperty(qse,"__esModule",{value:!0});qse.booleanLiteral=void 0;var g8r=jd(),y8r=mP(),b8r=Bm();function _8r(t){return(0,y8r.createIdentitySchemaCreator)(g8r.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,b8r.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}qse.booleanLiteral=_8r});var ELt=x(Sq=>{"use strict";Object.defineProperty(Sq,"__esModule",{value:!0});Sq.booleanLiteral=Sq.stringLiteral=void 0;var v8r=CLt();Object.defineProperty(Sq,"stringLiteral",{enumerable:!0,get:function(){return v8r.stringLiteral}});var w8r=OLt();Object.defineProperty(Sq,"booleanLiteral",{enumerable:!0,get:function(){return w8r.booleanLiteral}})});var PLt=x(Hse=>{"use strict";Object.defineProperty(Hse,"__esModule",{value:!0});Hse.any=void 0;var x8r=jd(),S8r=mP();Hse.any=(0,S8r.createIdentitySchemaCreator)(x8r.SchemaType.ANY,t=>({ok:!0,value:t}))});var TLt=x(Vse=>{"use strict";Object.defineProperty(Vse,"__esModule",{value:!0});Vse.boolean=void 0;var C8r=jd(),O8r=mP(),E8r=Bm();Vse.boolean=(0,O8r.createIdentitySchemaCreator)(C8r.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,E8r.getErrorMessageForIncorrectType)(t,"boolean")}]})});var ALt=x(Wse=>{"use strict";Object.defineProperty(Wse,"__esModule",{value:!0});Wse.number=void 0;var P8r=jd(),T8r=mP(),A8r=Bm();Wse.number=(0,T8r.createIdentitySchemaCreator)(P8r.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,A8r.getErrorMessageForIncorrectType)(t,"number")}]})});var ILt=x(Kse=>{"use strict";Object.defineProperty(Kse,"__esModule",{value:!0});Kse.string=void 0;var I8r=jd(),M8r=mP(),R8r=Bm();Kse.string=(0,M8r.createIdentitySchemaCreator)(I8r.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,R8r.getErrorMessageForIncorrectType)(t,"string")}]})});var MLt=x(Gse=>{"use strict";Object.defineProperty(Gse,"__esModule",{value:!0});Gse.unknown=void 0;var N8r=jd(),j8r=mP();Gse.unknown=(0,j8r.createIdentitySchemaCreator)(N8r.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var RLt=x(wy=>{"use strict";Object.defineProperty(wy,"__esModule",{value:!0});wy.unknown=wy.string=wy.number=wy.boolean=wy.any=void 0;var D8r=PLt();Object.defineProperty(wy,"any",{enumerable:!0,get:function(){return D8r.any}});var L8r=TLt();Object.defineProperty(wy,"boolean",{enumerable:!0,get:function(){return L8r.boolean}});var F8r=ALt();Object.defineProperty(wy,"number",{enumerable:!0,get:function(){return F8r.number}});var k8r=ILt();Object.defineProperty(wy,"string",{enumerable:!0,get:function(){return k8r.string}});var $8r=MLt();Object.defineProperty(wy,"unknown",{enumerable:!0,get:function(){return $8r.unknown}})});var jLt=x(Jse=>{"use strict";Object.defineProperty(Jse,"__esModule",{value:!0});Jse.record=void 0;var SNe=jd(),B8r=mNe(),z8r=Bm(),U8r=h9(),q8r=pP(),H8r=Vh();function V8r(t,e){let r={parse:(n,o)=>NLt({value:n,isKeyNumeric:t.getType()===SNe.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)=>NLt({value:n,isKeyNumeric:t.getType()===SNe.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:()=>SNe.SchemaType.RECORD};return Object.assign(Object.assign({},(0,q8r.maybeSkipValidation)(r)),(0,H8r.getSchemaUtils)(r))}Jse.record=V8r;function NLt({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,U8r.isPlainObject)(t)?(0,B8r.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,z8r.getErrorMessageForIncorrectType)(t,"object")}]}}});var DLt=x(Zse=>{"use strict";Object.defineProperty(Zse,"__esModule",{value:!0});Zse.record=void 0;var W8r=jLt();Object.defineProperty(Zse,"record",{enumerable:!0,get:function(){return W8r.record}})});var LLt=x(Yse=>{"use strict";Object.defineProperty(Yse,"__esModule",{value:!0});Yse.set=void 0;var K8r=jd(),G8r=Bm(),J8r=pP(),Z8r=xNe(),Y8r=Vh();function X8r(t){let e=(0,Z8r.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,G8r.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>K8r.SchemaType.SET};return Object.assign(Object.assign({},(0,J8r.maybeSkipValidation)(r)),(0,Y8r.getSchemaUtils)(r))}Yse.set=X8r});var FLt=x(Xse=>{"use strict";Object.defineProperty(Xse,"__esModule",{value:!0});Xse.set=void 0;var Q8r=LLt();Object.defineProperty(Xse,"set",{enumerable:!0,get:function(){return Q8r.set}})});var $Lt=x(Qse=>{"use strict";Object.defineProperty(Qse,"__esModule",{value:!0});Qse.undiscriminatedUnion=void 0;var e5r=jd(),t5r=pP(),r5r=Vh();function n5r(t){let e={parse:(r,n)=>kLt((o,i)=>o.parse(r,i),t,n),json:(r,n)=>kLt((o,i)=>o.json(r,i),t,n),getType:()=>e5r.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,t5r.maybeSkipValidation)(e)),(0,r5r.getSchemaUtils)(e))}Qse.undiscriminatedUnion=n5r;function kLt(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 BLt=x(eue=>{"use strict";Object.defineProperty(eue,"__esModule",{value:!0});eue.undiscriminatedUnion=void 0;var o5r=$Lt();Object.defineProperty(eue,"undiscriminatedUnion",{enumerable:!0,get:function(){return o5r.undiscriminatedUnion}})});var zLt=x(tue=>{"use strict";Object.defineProperty(tue,"__esModule",{value:!0});tue.discriminant=void 0;function i5r(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}tue.discriminant=i5r});var qLt=x(Cq=>{"use strict";var a5r=Cq&&Cq.__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(Cq,"__esModule",{value:!0});Cq.union=void 0;var s5r=jd(),u5r=Bm(),l5r=h9(),c5r=gNe(),d5r=pP(),f5r=fNe(),p5r=g9(),m5r=Vh();function h5r(t,e){let r=typeof t=="string"?t:t.rawDiscriminant,n=typeof t=="string"?t:t.parsedDiscriminant,o=(0,f5r.enum_)((0,c5r.keys)(e)),i={parse:(a,s)=>ULt({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)=>ULt({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:()=>s5r.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,d5r.maybeSkipValidation)(i)),(0,m5r.getSchemaUtils)(i)),(0,p5r.getObjectLikeUtils)(i))}Cq.union=h5r;function ULt({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,l5r.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,u5r.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=a5r(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 h=a(d,p);return h.ok?{ok:!0,value:Object.assign({[r]:c},h.value)}:h}});var HLt=x(Oq=>{"use strict";Object.defineProperty(Oq,"__esModule",{value:!0});Oq.union=Oq.discriminant=void 0;var g5r=zLt();Object.defineProperty(Oq,"discriminant",{enumerable:!0,get:function(){return g5r.discriminant}});var y5r=qLt();Object.defineProperty(Oq,"union",{enumerable:!0,get:function(){return y5r.union}})});var VLt=x(dc=>{"use strict";var b5r=dc&&dc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wh=dc&&dc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&b5r(e,t,r)};Object.defineProperty(dc,"__esModule",{value:!0});Wh(eLt(),dc);Wh(fNe(),dc);Wh(wLt(),dc);Wh(xNe(),dc);Wh(ELt(),dc);Wh(vNe(),dc);Wh(g9(),dc);Wh(RLt(),dc);Wh(DLt(),dc);Wh(Vh(),dc);Wh(FLt(),dc);Wh(BLt(),dc);Wh(HLt(),dc)});var WLt=x(rL=>{"use strict";var _5r=rL&&rL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v5r=rL&&rL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_5r(e,t,r)};Object.defineProperty(rL,"__esModule",{value:!0});v5r(VLt(),rL)});var J=x(Dd=>{"use strict";var KLt=Dd&&Dd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Dd&&Dd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_9=Dd&&Dd.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KLt(e,t,r)},x5r=Dd&&Dd.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KLt(e,t,r);return w5r(e,t),e};Object.defineProperty(Dd,"__esModule",{value:!0});Dd.serialization=void 0;_9(bDt(),Dd);_9(SDt(),Dd);_9(TDt(),Dd);_9(aq(),Dd);_9(GDt(),Dd);Dd.serialization=x5r(WLt())});var JLt=x(wu=>{"use strict";var v9=wu&&wu.__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())})},w9=wu&&wu.__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)}},Ha=wu&&wu.__await||function(t){return this instanceof Ha?(this.v=t,this):new Ha(t)},x9=wu&&wu.__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(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Ha?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(wu,"__esModule",{value:!0});wu.readableStreamAsyncIterable=wu._decodeChunks=wu.LineDecoder=wu._iterSSEMessages=wu.StreamUtils=void 0;var Eq=ru(),CNe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return x9(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=w9(GLt(e,r)),c;c=yield Ha(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 Eq.CohereError({message:`Error: ${f.error}`});yield yield Ha(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 Eq.CohereError({message:`Error: ${f.message}, ${f.error}`});yield yield Ha({event:d.event,data:f})}}}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=l.return)&&(yield Ha(s.call(l)))}finally{if(a)throw a.error}}u=!0}catch(d){if(d instanceof Error&&d.name==="AbortError")return yield Ha(void 0);throw d}finally{u||r?.abort()}})}return new t(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return x9(this,arguments,function*(){var s,u;let l=new xM,c=ENe(e);try{for(var d=w9(c),f;f=yield Ha(d.next()),!f.done;){let p=f.value;for(let h of l.decode(p))yield yield Ha(h)}}catch(p){s={error:p}}finally{try{f&&!f.done&&(u=d.return)&&(yield Ha(u.call(d)))}finally{if(s)throw s.error}}for(let p of l.flush())yield yield Ha(p)})}function i(){return x9(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=w9(o()),d;d=yield Ha(c.next()),!d.done;){let f=d.value;l||f&&(yield yield Ha(JSON.parse(f)))}}catch(f){s={error:f}}finally{try{d&&!d.done&&(u=c.return)&&(yield Ha(u.call(c)))}finally{if(s)throw s.error}}l=!0}catch(f){if(f instanceof Error&&f.name==="AbortError")return yield Ha(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 v9(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return v9(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 v9(this,void 0,void 0,function*(){yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};wu.StreamUtils=CNe;function GLt(t,e){return x9(this,arguments,function*(){var n,o;if(!t.body)throw e?.abort(),new Eq.CohereError({message:"Attempted to iterate over a response with no body"});let i=new ONe,a=new xM,s=ENe(t.body);try{for(var u=w9(S5r(s)),l;l=yield Ha(u.next()),!l.done;){let c=l.value;for(let d of a.decode(c)){let f=i.decode(d);f&&(yield yield Ha(f))}}}catch(c){n={error:c}}finally{try{l&&!l.done&&(o=u.return)&&(yield Ha(o.call(u)))}finally{if(n)throw n.error}}for(let c of a.flush()){let d=i.decode(c);d&&(yield yield Ha(d))}})}wu._iterSSEMessages=GLt;function S5r(t){return x9(this,arguments,function*(){var r,n;let o=new Uint8Array;try{for(var i=w9(t),a;a=yield Ha(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=C5r(o))!==-1;)yield yield Ha(o.slice(0,c)),o=o.slice(c)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&(yield Ha(n.call(i)))}finally{if(r)throw r.error}}o.length>0&&(yield yield Ha(o))})}function C5r(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 ONe=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]=E5r(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},xM=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 Eq.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 Eq.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new Eq.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}};wu.LineDecoder=xM;xM.NEWLINE_CHARS=new Set([`
`,"\r"]);xM.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function O5r(t){let e=new xM,r=[];for(let n of t)r.push(...e.decode(n));return r}wu._decodeChunks=O5r;function E5r(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function ENe(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return v9(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 v9(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}wu.readableStreamAsyncIterable=ENe});var PNe=x(Ew=>{"use strict";var P5r=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]}),T5r=Ew&&Ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A5r=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)&&P5r(e,t,r);return T5r(e,t),e};Object.defineProperty(Ew,"__esModule",{value:!0});Ew.V2ChatStreamRequestCitationMode=void 0;var I5r=A5r(J());Ew.V2ChatStreamRequestCitationMode=I5r.serialization.enum_(["FAST","ACCURATE","OFF"])});var TNe=x(Pw=>{"use strict";var M5r=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]}),R5r=Pw&&Pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N5r=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)&&M5r(e,t,r);return R5r(e,t),e};Object.defineProperty(Pw,"__esModule",{value:!0});Pw.V2ChatRequestCitationMode=void 0;var j5r=N5r(J());Pw.V2ChatRequestCitationMode=j5r.serialization.enum_(["FAST","ACCURATE","OFF"])});var Pq=x(Tw=>{"use strict";var D5r=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]}),L5r=Tw&&Tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F5r=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)&&D5r(e,t,r);return L5r(e,t),e};Object.defineProperty(Tw,"__esModule",{value:!0});Tw.TextContent=void 0;var ZLt=F5r(J());Tw.TextContent=ZLt.serialization.object({text:ZLt.serialization.string()})});var ANe=x(Aw=>{"use strict";var k5r=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]}),$5r=Aw&&Aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B5r=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)&&k5r(e,t,r);return $5r(e,t),e};Object.defineProperty(Aw,"__esModule",{value:!0});Aw.Content=void 0;var z5r=B5r(J()),U5r=Pq();Aw.Content=z5r.serialization.union("type",{text:U5r.TextContent}).transform({transform:t=>t,untransform:t=>t})});var MNe=x(Iw=>{"use strict";var q5r=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]}),H5r=Iw&&Iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V5r=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)&&q5r(e,t,r);return H5r(e,t),e};Object.defineProperty(Iw,"__esModule",{value:!0});Iw.UserMessageContent=void 0;var INe=V5r(J()),W5r=ANe();Iw.UserMessageContent=INe.serialization.undiscriminatedUnion([INe.serialization.string(),INe.serialization.list(W5r.Content)])});var nL=x(Mw=>{"use strict";var K5r=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]}),G5r=Mw&&Mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J5r=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)&&K5r(e,t,r);return G5r(e,t),e};Object.defineProperty(Mw,"__esModule",{value:!0});Mw.ChatDocument=void 0;var RNe=J5r(J());Mw.ChatDocument=RNe.serialization.record(RNe.serialization.string(),RNe.serialization.string())});var NNe=x(Rw=>{"use strict";var Z5r=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]}),Y5r=Rw&&Rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X5r=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)&&Z5r(e,t,r);return Y5r(e,t),e};Object.defineProperty(Rw,"__esModule",{value:!0});Rw.UserMessage=void 0;var YLt=X5r(J()),Q5r=MNe(),eWr=nL();Rw.UserMessage=YLt.serialization.object({content:Q5r.UserMessageContent,documents:YLt.serialization.list(eWr.ChatDocument).optional()})});var DNe=x(Nw=>{"use strict";var tWr=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]}),rWr=Nw&&Nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nWr=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)&&tWr(e,t,r);return rWr(e,t),e};Object.defineProperty(Nw,"__esModule",{value:!0});Nw.ToolCall2Function=void 0;var jNe=nWr(J());Nw.ToolCall2Function=jNe.serialization.object({name:jNe.serialization.string().optional(),arguments:jNe.serialization.string().optional()})});var rue=x(jw=>{"use strict";var oWr=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]}),iWr=jw&&jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aWr=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)&&oWr(e,t,r);return iWr(e,t),e};Object.defineProperty(jw,"__esModule",{value:!0});jw.ToolCall2=void 0;var LNe=aWr(J()),sWr=DNe();jw.ToolCall2=LNe.serialization.object({id:LNe.serialization.string().optional(),type:LNe.serialization.stringLiteral("function").optional(),function:sWr.ToolCall2Function.optional()})});var FNe=x(Dw=>{"use strict";var uWr=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]}),lWr=Dw&&Dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cWr=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)&&uWr(e,t,r);return lWr(e,t),e};Object.defineProperty(Dw,"__esModule",{value:!0});Dw.ToolSource=void 0;var Tq=cWr(J());Dw.ToolSource=Tq.serialization.object({id:Tq.serialization.string().optional(),toolOutput:Tq.serialization.property("tool_output",Tq.serialization.record(Tq.serialization.string(),Tq.serialization.unknown()).optional())})});var kNe=x(Lw=>{"use strict";var dWr=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]}),fWr=Lw&&Lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pWr=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)&&dWr(e,t,r);return fWr(e,t),e};Object.defineProperty(Lw,"__esModule",{value:!0});Lw.DocumentSource=void 0;var S9=pWr(J());Lw.DocumentSource=S9.serialization.object({id:S9.serialization.string().optional(),document:S9.serialization.record(S9.serialization.string(),S9.serialization.unknown()).optional()})});var $Ne=x(Fw=>{"use strict";var mWr=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]}),hWr=Fw&&Fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gWr=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)&&mWr(e,t,r);return hWr(e,t),e};Object.defineProperty(Fw,"__esModule",{value:!0});Fw.Source=void 0;var yWr=gWr(J()),bWr=FNe(),_Wr=kNe();Fw.Source=yWr.serialization.union("type",{tool:bWr.ToolSource,document:_Wr.DocumentSource}).transform({transform:t=>t,untransform:t=>t})});var O9=x(kw=>{"use strict";var vWr=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]}),wWr=kw&&kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xWr=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)&&vWr(e,t,r);return wWr(e,t),e};Object.defineProperty(kw,"__esModule",{value:!0});kw.Citation=void 0;var C9=xWr(J()),SWr=$Ne();kw.Citation=C9.serialization.object({start:C9.serialization.number().optional(),end:C9.serialization.number().optional(),text:C9.serialization.string().optional(),sources:C9.serialization.list(SWr.Source).optional()})});var BNe=x($w=>{"use strict";var CWr=$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]}),OWr=$w&&$w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EWr=$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)&&CWr(e,t,r);return OWr(e,t),e};Object.defineProperty($w,"__esModule",{value:!0});$w.AssistantMessageContentItem=void 0;var PWr=EWr(J()),TWr=Pq();$w.AssistantMessageContentItem=PWr.serialization.union("type",{text:TWr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var UNe=x(Bw=>{"use strict";var AWr=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]}),IWr=Bw&&Bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MWr=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)&&AWr(e,t,r);return IWr(e,t),e};Object.defineProperty(Bw,"__esModule",{value:!0});Bw.AssistantMessageContent=void 0;var zNe=MWr(J()),RWr=BNe();Bw.AssistantMessageContent=zNe.serialization.undiscriminatedUnion([zNe.serialization.string(),zNe.serialization.list(RWr.AssistantMessageContentItem)])});var qNe=x(zw=>{"use strict";var NWr=zw&&zw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jWr=zw&&zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DWr=zw&&zw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NWr(e,t,r);return jWr(e,t),e};Object.defineProperty(zw,"__esModule",{value:!0});zw.AssistantMessage=void 0;var Aq=DWr(J()),LWr=rue(),FWr=UNe(),kWr=O9();zw.AssistantMessage=Aq.serialization.object({toolCalls:Aq.serialization.property("tool_calls",Aq.serialization.list(LWr.ToolCall2).optional()),toolPlan:Aq.serialization.property("tool_plan",Aq.serialization.string().optional()),content:FWr.AssistantMessageContent.optional(),citations:Aq.serialization.list(kWr.Citation).optional()})});var HNe=x(Uw=>{"use strict";var $Wr=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]}),BWr=Uw&&Uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zWr=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)&&$Wr(e,t,r);return BWr(e,t),e};Object.defineProperty(Uw,"__esModule",{value:!0});Uw.SystemMessageContentItem=void 0;var UWr=zWr(J()),qWr=Pq();Uw.SystemMessageContentItem=UWr.serialization.union("type",{text:qWr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var WNe=x(qw=>{"use strict";var HWr=qw&&qw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VWr=qw&&qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WWr=qw&&qw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HWr(e,t,r);return VWr(e,t),e};Object.defineProperty(qw,"__esModule",{value:!0});qw.SystemMessageContent=void 0;var VNe=WWr(J()),KWr=HNe();qw.SystemMessageContent=VNe.serialization.undiscriminatedUnion([VNe.serialization.string(),VNe.serialization.list(KWr.SystemMessageContentItem)])});var KNe=x(Hw=>{"use strict";var GWr=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]}),JWr=Hw&&Hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZWr=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)&&GWr(e,t,r);return JWr(e,t),e};Object.defineProperty(Hw,"__esModule",{value:!0});Hw.SystemMessage=void 0;var YWr=ZWr(J()),XWr=WNe();Hw.SystemMessage=YWr.serialization.object({content:XWr.SystemMessageContent})});var GNe=x(Vw=>{"use strict";var QWr=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]}),e9r=Vw&&Vw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t9r=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)&&QWr(e,t,r);return e9r(e,t),e};Object.defineProperty(Vw,"__esModule",{value:!0});Vw.ToolContent=void 0;var nue=t9r(J());Vw.ToolContent=nue.serialization.object({output:nue.serialization.record(nue.serialization.string(),nue.serialization.unknown())})});var JNe=x(Ww=>{"use strict";var r9r=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]}),n9r=Ww&&Ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o9r=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)&&r9r(e,t,r);return n9r(e,t),e};Object.defineProperty(Ww,"__esModule",{value:!0});Ww.ToolMessage2ToolContentItem=void 0;var i9r=o9r(J()),a9r=GNe();Ww.ToolMessage2ToolContentItem=i9r.serialization.union("type",{tool_result_object:a9r.ToolContent}).transform({transform:t=>t,untransform:t=>t})});var ZNe=x(Kw=>{"use strict";var s9r=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]}),u9r=Kw&&Kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l9r=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)&&s9r(e,t,r);return u9r(e,t),e};Object.defineProperty(Kw,"__esModule",{value:!0});Kw.ToolMessage2=void 0;var E9=l9r(J()),c9r=JNe();Kw.ToolMessage2=E9.serialization.object({toolCallId:E9.serialization.property("tool_call_id",E9.serialization.string()),toolContent:E9.serialization.property("tool_content",E9.serialization.list(c9r.ToolMessage2ToolContentItem))})});var YNe=x(Gw=>{"use strict";var d9r=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]}),f9r=Gw&&Gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p9r=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)&&d9r(e,t,r);return f9r(e,t),e};Object.defineProperty(Gw,"__esModule",{value:!0});Gw.ChatMessage2=void 0;var m9r=p9r(J()),h9r=NNe(),g9r=qNe(),y9r=KNe(),b9r=ZNe();Gw.ChatMessage2=m9r.serialization.union("role",{user:h9r.UserMessage,assistant:g9r.AssistantMessage,system:y9r.SystemMessage,tool:b9r.ToolMessage2}).transform({transform:t=>t,untransform:t=>t})});var oue=x(Jw=>{"use strict";var _9r=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]}),v9r=Jw&&Jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w9r=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)&&_9r(e,t,r);return v9r(e,t),e};Object.defineProperty(Jw,"__esModule",{value:!0});Jw.ChatMessages=void 0;var x9r=w9r(J()),S9r=YNe();Jw.ChatMessages=x9r.serialization.list(S9r.ChatMessage2)});var XNe=x(Zw=>{"use strict";var C9r=Zw&&Zw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Zw&&Zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E9r=Zw&&Zw.__importStar||function(t){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(Zw,"__esModule",{value:!0});Zw.Tool2Function=void 0;var Iq=E9r(J());Zw.Tool2Function=Iq.serialization.object({name:Iq.serialization.string().optional(),description:Iq.serialization.string().optional(),parameters:Iq.serialization.record(Iq.serialization.string(),Iq.serialization.unknown()).optional()})});var iue=x(Yw=>{"use strict";var P9r=Yw&&Yw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T9r=Yw&&Yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A9r=Yw&&Yw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P9r(e,t,r);return T9r(e,t),e};Object.defineProperty(Yw,"__esModule",{value:!0});Yw.Tool2=void 0;var XLt=A9r(J()),I9r=XNe();Yw.Tool2=XLt.serialization.object({type:XLt.serialization.stringLiteral("function").optional(),function:I9r.Tool2Function.optional()})});var aue=x(Xw=>{"use strict";var M9r=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]}),R9r=Xw&&Xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N9r=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)&&M9r(e,t,r);return R9r(e,t),e};Object.defineProperty(Xw,"__esModule",{value:!0});Xw.ChatFinishReason=void 0;var j9r=N9r(J());Xw.ChatFinishReason=j9r.serialization.enum_(["complete","stop_sequence","max_tokens","tool_call","error","content_blocked","error_limit"])});var QNe=x(Qw=>{"use strict";var D9r=Qw&&Qw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L9r=Qw&&Qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F9r=Qw&&Qw.__importStar||function(t){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 L9r(e,t),e};Object.defineProperty(Qw,"__esModule",{value:!0});Qw.AssistantMessageResponseContentItem=void 0;var k9r=F9r(J()),$9r=Pq();Qw.AssistantMessageResponseContentItem=k9r.serialization.union("type",{text:$9r.TextContent}).transform({transform:t=>t,untransform:t=>t})});var eje=x(e0=>{"use strict";var B9r=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]}),z9r=e0&&e0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U9r=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)&&B9r(e,t,r);return z9r(e,t),e};Object.defineProperty(e0,"__esModule",{value:!0});e0.AssistantMessageResponse=void 0;var SM=U9r(J()),q9r=rue(),H9r=QNe(),V9r=O9();e0.AssistantMessageResponse=SM.serialization.object({role:SM.serialization.stringLiteral("assistant"),toolCalls:SM.serialization.property("tool_calls",SM.serialization.list(q9r.ToolCall2).optional()),toolPlan:SM.serialization.property("tool_plan",SM.serialization.string().optional()),content:SM.serialization.list(H9r.AssistantMessageResponseContentItem).optional(),citations:SM.serialization.list(V9r.Citation).optional()})});var tje=x(t0=>{"use strict";var W9r=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]}),K9r=t0&&t0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G9r=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)&&W9r(e,t,r);return K9r(e,t),e};Object.defineProperty(t0,"__esModule",{value:!0});t0.UsageBilledUnits=void 0;var CM=G9r(J());t0.UsageBilledUnits=CM.serialization.object({inputTokens:CM.serialization.property("input_tokens",CM.serialization.number().optional()),outputTokens:CM.serialization.property("output_tokens",CM.serialization.number().optional()),searchUnits:CM.serialization.property("search_units",CM.serialization.number().optional()),classifications:CM.serialization.number().optional()})});var rje=x(r0=>{"use strict";var J9r=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]}),Z9r=r0&&r0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y9r=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)&&J9r(e,t,r);return Z9r(e,t),e};Object.defineProperty(r0,"__esModule",{value:!0});r0.UsageTokens=void 0;var P9=Y9r(J());r0.UsageTokens=P9.serialization.object({inputTokens:P9.serialization.property("input_tokens",P9.serialization.number().optional()),outputTokens:P9.serialization.property("output_tokens",P9.serialization.number().optional())})});var sue=x(n0=>{"use strict";var X9r=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]}),Q9r=n0&&n0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eKr=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)&&X9r(e,t,r);return Q9r(e,t),e};Object.defineProperty(n0,"__esModule",{value:!0});n0.Usage=void 0;var QLt=eKr(J()),tKr=tje(),rKr=rje();n0.Usage=QLt.serialization.object({billedUnits:QLt.serialization.property("billed_units",tKr.UsageBilledUnits.optional()),tokens:rKr.UsageTokens.optional()})});var eFt=x(o0=>{"use strict";var nKr=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]}),oKr=o0&&o0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iKr=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)&&nKr(e,t,r);return oKr(e,t),e};Object.defineProperty(o0,"__esModule",{value:!0});o0.NonStreamedChatResponse2=void 0;var uue=iKr(J()),aKr=aue(),sKr=eje(),uKr=sue();o0.NonStreamedChatResponse2=uue.serialization.object({id:uue.serialization.string(),finishReason:uue.serialization.property("finish_reason",aKr.ChatFinishReason),prompt:uue.serialization.string().optional(),message:sKr.AssistantMessageResponse.optional(),usage:uKr.Usage.optional()})});var Kh=x(i0=>{"use strict";var lKr=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]}),cKr=i0&&i0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dKr=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)&&lKr(e,t,r);return cKr(e,t),e};Object.defineProperty(i0,"__esModule",{value:!0});i0.ChatStreamEventType=void 0;var fKr=dKr(J());i0.ChatStreamEventType=fKr.serialization.object({})});var nje=x(a0=>{"use strict";var pKr=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]}),mKr=a0&&a0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hKr=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)&&pKr(e,t,r);return mKr(e,t),e};Object.defineProperty(a0,"__esModule",{value:!0});a0.ChatMessageStartEventDeltaMessage=void 0;var tFt=hKr(J());a0.ChatMessageStartEventDeltaMessage=tFt.serialization.object({role:tFt.serialization.stringLiteral("assistant").optional()})});var oje=x(s0=>{"use strict";var gKr=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]}),yKr=s0&&s0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bKr=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)&&gKr(e,t,r);return yKr(e,t),e};Object.defineProperty(s0,"__esModule",{value:!0});s0.ChatMessageStartEventDelta=void 0;var _Kr=bKr(J()),vKr=nje();s0.ChatMessageStartEventDelta=_Kr.serialization.object({message:vKr.ChatMessageStartEventDeltaMessage.optional()})});var ije=x(u0=>{"use strict";var wKr=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]}),xKr=u0&&u0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SKr=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)&&wKr(e,t,r);return xKr(e,t),e};Object.defineProperty(u0,"__esModule",{value:!0});u0.ChatMessageStartEvent=void 0;var rFt=SKr(J()),CKr=oje(),OKr=Kh();u0.ChatMessageStartEvent=rFt.serialization.object({id:rFt.serialization.string().optional(),delta:CKr.ChatMessageStartEventDelta.optional()}).extend(OKr.ChatStreamEventType)});var sje=x(l0=>{"use strict";var EKr=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]}),PKr=l0&&l0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TKr=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)&&EKr(e,t,r);return PKr(e,t),e};Object.defineProperty(l0,"__esModule",{value:!0});l0.ChatContentStartEventDeltaMessageContent=void 0;var aje=TKr(J());l0.ChatContentStartEventDeltaMessageContent=aje.serialization.object({text:aje.serialization.string().optional(),type:aje.serialization.stringLiteral("text").optional()})});var uje=x(c0=>{"use strict";var AKr=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]}),IKr=c0&&c0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MKr=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)&&AKr(e,t,r);return IKr(e,t),e};Object.defineProperty(c0,"__esModule",{value:!0});c0.ChatContentStartEventDeltaMessage=void 0;var RKr=MKr(J()),NKr=sje();c0.ChatContentStartEventDeltaMessage=RKr.serialization.object({content:NKr.ChatContentStartEventDeltaMessageContent.optional()})});var lje=x(d0=>{"use strict";var jKr=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]}),DKr=d0&&d0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LKr=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)&&jKr(e,t,r);return DKr(e,t),e};Object.defineProperty(d0,"__esModule",{value:!0});d0.ChatContentStartEventDelta=void 0;var FKr=LKr(J()),kKr=uje();d0.ChatContentStartEventDelta=FKr.serialization.object({message:kKr.ChatContentStartEventDeltaMessage.optional()})});var cje=x(f0=>{"use strict";var $Kr=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]}),BKr=f0&&f0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zKr=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)&&$Kr(e,t,r);return BKr(e,t),e};Object.defineProperty(f0,"__esModule",{value:!0});f0.ChatContentStartEvent=void 0;var nFt=zKr(J()),UKr=lje(),qKr=Kh();f0.ChatContentStartEvent=nFt.serialization.object({index:nFt.serialization.number().optional(),delta:UKr.ChatContentStartEventDelta.optional()}).extend(qKr.ChatStreamEventType)});var dje=x(p0=>{"use strict";var HKr=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]}),VKr=p0&&p0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WKr=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)&&HKr(e,t,r);return VKr(e,t),e};Object.defineProperty(p0,"__esModule",{value:!0});p0.ChatContentDeltaEventDeltaMessageContent=void 0;var oFt=WKr(J());p0.ChatContentDeltaEventDeltaMessageContent=oFt.serialization.object({text:oFt.serialization.string().optional()})});var fje=x(m0=>{"use strict";var KKr=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]}),GKr=m0&&m0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JKr=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)&&KKr(e,t,r);return GKr(e,t),e};Object.defineProperty(m0,"__esModule",{value:!0});m0.ChatContentDeltaEventDeltaMessage=void 0;var ZKr=JKr(J()),YKr=dje();m0.ChatContentDeltaEventDeltaMessage=ZKr.serialization.object({content:YKr.ChatContentDeltaEventDeltaMessageContent.optional()})});var pje=x(h0=>{"use strict";var XKr=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]}),QKr=h0&&h0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eGr=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)&&XKr(e,t,r);return QKr(e,t),e};Object.defineProperty(h0,"__esModule",{value:!0});h0.ChatContentDeltaEventDelta=void 0;var tGr=eGr(J()),rGr=fje();h0.ChatContentDeltaEventDelta=tGr.serialization.object({message:rGr.ChatContentDeltaEventDeltaMessage.optional()})});var mje=x(g0=>{"use strict";var nGr=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]}),oGr=g0&&g0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iGr=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)&&nGr(e,t,r);return oGr(e,t),e};Object.defineProperty(g0,"__esModule",{value:!0});g0.ChatContentDeltaEvent=void 0;var iFt=iGr(J()),aGr=pje(),sGr=Kh();g0.ChatContentDeltaEvent=iFt.serialization.object({index:iFt.serialization.number().optional(),delta:aGr.ChatContentDeltaEventDelta.optional()}).extend(sGr.ChatStreamEventType)});var hje=x(y0=>{"use strict";var uGr=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]}),lGr=y0&&y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cGr=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)&&uGr(e,t,r);return lGr(e,t),e};Object.defineProperty(y0,"__esModule",{value:!0});y0.ChatContentEndEvent=void 0;var aFt=cGr(J()),dGr=Kh();y0.ChatContentEndEvent=aFt.serialization.object({index:aFt.serialization.number().optional()}).extend(dGr.ChatStreamEventType)});var yje=x(b0=>{"use strict";var fGr=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]}),pGr=b0&&b0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mGr=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)&&fGr(e,t,r);return pGr(e,t),e};Object.defineProperty(b0,"__esModule",{value:!0});b0.ChatToolPlanDeltaEventDelta=void 0;var gje=mGr(J());b0.ChatToolPlanDeltaEventDelta=gje.serialization.object({toolPlan:gje.serialization.property("tool_plan",gje.serialization.string().optional())})});var bje=x(_0=>{"use strict";var hGr=_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]}),gGr=_0&&_0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yGr=_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)&&hGr(e,t,r);return gGr(e,t),e};Object.defineProperty(_0,"__esModule",{value:!0});_0.ChatToolPlanDeltaEvent=void 0;var bGr=yGr(J()),_Gr=yje(),vGr=Kh();_0.ChatToolPlanDeltaEvent=bGr.serialization.object({delta:_Gr.ChatToolPlanDeltaEventDelta.optional()}).extend(vGr.ChatStreamEventType)});var vje=x(v0=>{"use strict";var wGr=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]}),xGr=v0&&v0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SGr=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)&&wGr(e,t,r);return xGr(e,t),e};Object.defineProperty(v0,"__esModule",{value:!0});v0.ChatToolCallStartEventDeltaToolCallFunction=void 0;var _je=SGr(J());v0.ChatToolCallStartEventDeltaToolCallFunction=_je.serialization.object({name:_je.serialization.string().optional(),arguments:_je.serialization.string().optional()})});var xje=x(w0=>{"use strict";var CGr=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]}),OGr=w0&&w0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EGr=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)&&CGr(e,t,r);return OGr(e,t),e};Object.defineProperty(w0,"__esModule",{value:!0});w0.ChatToolCallStartEventDeltaToolCall=void 0;var wje=EGr(J()),PGr=vje();w0.ChatToolCallStartEventDeltaToolCall=wje.serialization.object({id:wje.serialization.string().optional(),type:wje.serialization.stringLiteral("function").optional(),function:PGr.ChatToolCallStartEventDeltaToolCallFunction.optional()})});var Sje=x(x0=>{"use strict";var TGr=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]}),AGr=x0&&x0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IGr=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)&&TGr(e,t,r);return AGr(e,t),e};Object.defineProperty(x0,"__esModule",{value:!0});x0.ChatToolCallStartEventDelta=void 0;var sFt=IGr(J()),MGr=xje();x0.ChatToolCallStartEventDelta=sFt.serialization.object({toolCall:sFt.serialization.property("tool_call",MGr.ChatToolCallStartEventDeltaToolCall.optional())})});var Cje=x(S0=>{"use strict";var RGr=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]}),NGr=S0&&S0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jGr=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)&&RGr(e,t,r);return NGr(e,t),e};Object.defineProperty(S0,"__esModule",{value:!0});S0.ChatToolCallStartEvent=void 0;var uFt=jGr(J()),DGr=Sje(),LGr=Kh();S0.ChatToolCallStartEvent=uFt.serialization.object({index:uFt.serialization.number().optional(),delta:DGr.ChatToolCallStartEventDelta.optional()}).extend(LGr.ChatStreamEventType)});var Oje=x(C0=>{"use strict";var FGr=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]}),kGr=C0&&C0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Gr=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)&&FGr(e,t,r);return kGr(e,t),e};Object.defineProperty(C0,"__esModule",{value:!0});C0.ChatToolCallDeltaEventDeltaToolCallFunction=void 0;var lFt=$Gr(J());C0.ChatToolCallDeltaEventDeltaToolCallFunction=lFt.serialization.object({arguments:lFt.serialization.string().optional()})});var Eje=x(O0=>{"use strict";var BGr=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]}),zGr=O0&&O0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UGr=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)&&BGr(e,t,r);return zGr(e,t),e};Object.defineProperty(O0,"__esModule",{value:!0});O0.ChatToolCallDeltaEventDeltaToolCall=void 0;var qGr=UGr(J()),HGr=Oje();O0.ChatToolCallDeltaEventDeltaToolCall=qGr.serialization.object({function:HGr.ChatToolCallDeltaEventDeltaToolCallFunction.optional()})});var Pje=x(E0=>{"use strict";var VGr=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]}),WGr=E0&&E0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KGr=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)&&VGr(e,t,r);return WGr(e,t),e};Object.defineProperty(E0,"__esModule",{value:!0});E0.ChatToolCallDeltaEventDelta=void 0;var cFt=KGr(J()),GGr=Eje();E0.ChatToolCallDeltaEventDelta=cFt.serialization.object({toolCall:cFt.serialization.property("tool_call",GGr.ChatToolCallDeltaEventDeltaToolCall.optional())})});var Tje=x(P0=>{"use strict";var JGr=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]}),ZGr=P0&&P0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YGr=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)&&JGr(e,t,r);return ZGr(e,t),e};Object.defineProperty(P0,"__esModule",{value:!0});P0.ChatToolCallDeltaEvent=void 0;var dFt=YGr(J()),XGr=Pje(),QGr=Kh();P0.ChatToolCallDeltaEvent=dFt.serialization.object({index:dFt.serialization.number().optional(),delta:XGr.ChatToolCallDeltaEventDelta.optional()}).extend(QGr.ChatStreamEventType)});var Aje=x(T0=>{"use strict";var eJr=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]}),tJr=T0&&T0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rJr=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)&&eJr(e,t,r);return tJr(e,t),e};Object.defineProperty(T0,"__esModule",{value:!0});T0.ChatToolCallEndEvent=void 0;var fFt=rJr(J()),nJr=Kh();T0.ChatToolCallEndEvent=fFt.serialization.object({index:fFt.serialization.number().optional()}).extend(nJr.ChatStreamEventType)});var Ije=x(A0=>{"use strict";var oJr=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]}),iJr=A0&&A0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aJr=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)&&oJr(e,t,r);return iJr(e,t),e};Object.defineProperty(A0,"__esModule",{value:!0});A0.ChatMessageEndEventDelta=void 0;var pFt=aJr(J()),sJr=aue(),uJr=sue();A0.ChatMessageEndEventDelta=pFt.serialization.object({finishReason:pFt.serialization.property("finish_reason",sJr.ChatFinishReason.optional()),usage:uJr.Usage.optional()})});var Mje=x(I0=>{"use strict";var lJr=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]}),cJr=I0&&I0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dJr=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)&&lJr(e,t,r);return cJr(e,t),e};Object.defineProperty(I0,"__esModule",{value:!0});I0.ChatMessageEndEvent=void 0;var mFt=dJr(J()),fJr=Ije(),pJr=Kh();I0.ChatMessageEndEvent=mFt.serialization.object({id:mFt.serialization.string().optional(),delta:fJr.ChatMessageEndEventDelta.optional()}).extend(pJr.ChatStreamEventType)});var Rje=x(M0=>{"use strict";var mJr=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]}),hJr=M0&&M0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gJr=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)&&mJr(e,t,r);return hJr(e,t),e};Object.defineProperty(M0,"__esModule",{value:!0});M0.CitationStartEventDeltaMessage=void 0;var yJr=gJr(J()),bJr=O9();M0.CitationStartEventDeltaMessage=yJr.serialization.object({citations:bJr.Citation.optional()})});var Nje=x(R0=>{"use strict";var _Jr=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]}),vJr=R0&&R0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wJr=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)&&_Jr(e,t,r);return vJr(e,t),e};Object.defineProperty(R0,"__esModule",{value:!0});R0.CitationStartEventDelta=void 0;var xJr=wJr(J()),SJr=Rje();R0.CitationStartEventDelta=xJr.serialization.object({message:SJr.CitationStartEventDeltaMessage.optional()})});var jje=x(N0=>{"use strict";var CJr=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]}),OJr=N0&&N0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EJr=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)&&CJr(e,t,r);return OJr(e,t),e};Object.defineProperty(N0,"__esModule",{value:!0});N0.CitationStartEvent=void 0;var hFt=EJr(J()),PJr=Nje(),TJr=Kh();N0.CitationStartEvent=hFt.serialization.object({index:hFt.serialization.number().optional(),delta:PJr.CitationStartEventDelta.optional()}).extend(TJr.ChatStreamEventType)});var Dje=x(j0=>{"use strict";var AJr=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]}),IJr=j0&&j0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MJr=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)&&AJr(e,t,r);return IJr(e,t),e};Object.defineProperty(j0,"__esModule",{value:!0});j0.CitationEndEvent=void 0;var gFt=MJr(J()),RJr=Kh();j0.CitationEndEvent=gFt.serialization.object({index:gFt.serialization.number().optional()}).extend(RJr.ChatStreamEventType)});var yFt=x(D0=>{"use strict";var NJr=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]}),jJr=D0&&D0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DJr=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)&&NJr(e,t,r);return jJr(e,t),e};Object.defineProperty(D0,"__esModule",{value:!0});D0.StreamedChatResponse2=void 0;var LJr=DJr(J()),FJr=ije(),kJr=cje(),$Jr=mje(),BJr=hje(),zJr=bje(),UJr=Cje(),qJr=Tje(),HJr=Aje(),VJr=jje(),WJr=Dje(),KJr=Mje();D0.StreamedChatResponse2=LJr.serialization.union("type",{"message-start":FJr.ChatMessageStartEvent,"content-start":kJr.ChatContentStartEvent,"content-delta":$Jr.ChatContentDeltaEvent,"content-end":BJr.ChatContentEndEvent,"tool-plan-delta":zJr.ChatToolPlanDeltaEvent,"tool-call-start":UJr.ChatToolCallStartEvent,"tool-call-delta":qJr.ChatToolCallDeltaEvent,"tool-call-end":HJr.ChatToolCallEndEvent,"citation-start":VJr.CitationStartEvent,"citation-end":WJr.CitationEndEvent,"message-end":KJr.ChatMessageEndEvent}).transform({transform:t=>t,untransform:t=>t})});var Lje=x(Dt=>{"use strict";var GJr=Dt&&Dt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zt=Dt&&Dt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&GJr(e,t,r)};Object.defineProperty(Dt,"__esModule",{value:!0});Zt(PNe(),Dt);Zt(TNe(),Dt);Zt(Pq(),Dt);Zt(ANe(),Dt);Zt(MNe(),Dt);Zt(NNe(),Dt);Zt(DNe(),Dt);Zt(rue(),Dt);Zt(FNe(),Dt);Zt(kNe(),Dt);Zt($Ne(),Dt);Zt(O9(),Dt);Zt(BNe(),Dt);Zt(UNe(),Dt);Zt(qNe(),Dt);Zt(HNe(),Dt);Zt(WNe(),Dt);Zt(KNe(),Dt);Zt(GNe(),Dt);Zt(JNe(),Dt);Zt(ZNe(),Dt);Zt(YNe(),Dt);Zt(oue(),Dt);Zt(XNe(),Dt);Zt(iue(),Dt);Zt(aue(),Dt);Zt(QNe(),Dt);Zt(eje(),Dt);Zt(tje(),Dt);Zt(rje(),Dt);Zt(sue(),Dt);Zt(eFt(),Dt);Zt(Kh(),Dt);Zt(nje(),Dt);Zt(oje(),Dt);Zt(ije(),Dt);Zt(sje(),Dt);Zt(uje(),Dt);Zt(lje(),Dt);Zt(cje(),Dt);Zt(dje(),Dt);Zt(fje(),Dt);Zt(pje(),Dt);Zt(mje(),Dt);Zt(hje(),Dt);Zt(yje(),Dt);Zt(bje(),Dt);Zt(vje(),Dt);Zt(xje(),Dt);Zt(Sje(),Dt);Zt(Cje(),Dt);Zt(Oje(),Dt);Zt(Eje(),Dt);Zt(Pje(),Dt);Zt(Tje(),Dt);Zt(Aje(),Dt);Zt(Ije(),Dt);Zt(Mje(),Dt);Zt(yFt(),Dt)});var lue=x(L0=>{"use strict";var JJr=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]}),ZJr=L0&&L0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YJr=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)&&JJr(e,t,r);return ZJr(e,t),e};Object.defineProperty(L0,"__esModule",{value:!0});L0.TextResponseFormat=void 0;var XJr=YJr(J());L0.TextResponseFormat=XJr.serialization.object({})});var Fje=x(F0=>{"use strict";var QJr=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]}),e7r=F0&&F0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t7r=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)&&QJr(e,t,r);return e7r(e,t),e};Object.defineProperty(F0,"__esModule",{value:!0});F0.JsonResponseFormat2=void 0;var T9=t7r(J());F0.JsonResponseFormat2=T9.serialization.object({jsonSchema:T9.serialization.property("json_schema",T9.serialization.record(T9.serialization.string(),T9.serialization.unknown()).optional())})});var cue=x(k0=>{"use strict";var r7r=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]}),n7r=k0&&k0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o7r=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)&&r7r(e,t,r);return n7r(e,t),e};Object.defineProperty(k0,"__esModule",{value:!0});k0.ResponseFormat2=void 0;var i7r=o7r(J()),a7r=lue(),s7r=Fje();k0.ResponseFormat2=i7r.serialization.union("type",{text:a7r.TextResponseFormat,json_object:s7r.JsonResponseFormat2}).transform({transform:t=>t,untransform:t=>t})});var bFt=x($0=>{"use strict";var u7r=$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]}),l7r=$0&&$0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c7r=$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)&&u7r(e,t,r);return l7r(e,t),e};Object.defineProperty($0,"__esModule",{value:!0});$0.V2ChatStreamRequest=void 0;var xu=c7r(J()),d7r=oue(),f7r=iue(),p7r=PNe(),m7r=cue();$0.V2ChatStreamRequest=xu.serialization.object({model:xu.serialization.string(),messages:d7r.ChatMessages,tools:xu.serialization.list(f7r.Tool2).optional(),citationMode:xu.serialization.property("citation_mode",p7r.V2ChatStreamRequestCitationMode.optional()),responseFormat:xu.serialization.property("response_format",m7r.ResponseFormat2.optional()),maxTokens:xu.serialization.property("max_tokens",xu.serialization.number().optional()),stopSequences:xu.serialization.property("stop_sequences",xu.serialization.list(xu.serialization.string()).optional()),temperature:xu.serialization.number().optional(),seed:xu.serialization.number().optional(),frequencyPenalty:xu.serialization.property("frequency_penalty",xu.serialization.number().optional()),presencePenalty:xu.serialization.property("presence_penalty",xu.serialization.number().optional()),k:xu.serialization.number().optional(),p:xu.serialization.number().optional(),returnPrompt:xu.serialization.property("return_prompt",xu.serialization.boolean().optional())})});var _Ft=x(B0=>{"use strict";var h7r=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]}),g7r=B0&&B0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y7r=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)&&h7r(e,t,r);return g7r(e,t),e};Object.defineProperty(B0,"__esModule",{value:!0});B0.V2ChatRequest=void 0;var Su=y7r(J()),b7r=oue(),_7r=iue(),v7r=TNe(),w7r=cue();B0.V2ChatRequest=Su.serialization.object({model:Su.serialization.string(),messages:b7r.ChatMessages,tools:Su.serialization.list(_7r.Tool2).optional(),citationMode:Su.serialization.property("citation_mode",v7r.V2ChatRequestCitationMode.optional()),responseFormat:Su.serialization.property("response_format",w7r.ResponseFormat2.optional()),maxTokens:Su.serialization.property("max_tokens",Su.serialization.number().optional()),stopSequences:Su.serialization.property("stop_sequences",Su.serialization.list(Su.serialization.string()).optional()),temperature:Su.serialization.number().optional(),seed:Su.serialization.number().optional(),frequencyPenalty:Su.serialization.property("frequency_penalty",Su.serialization.number().optional()),presencePenalty:Su.serialization.property("presence_penalty",Su.serialization.number().optional()),k:Su.serialization.number().optional(),p:Su.serialization.number().optional(),returnPrompt:Su.serialization.property("return_prompt",Su.serialization.boolean().optional())})});var kje=x(Mq=>{"use strict";Object.defineProperty(Mq,"__esModule",{value:!0});Mq.V2ChatRequest=Mq.V2ChatStreamRequest=void 0;var x7r=bFt();Object.defineProperty(Mq,"V2ChatStreamRequest",{enumerable:!0,get:function(){return x7r.V2ChatStreamRequest}});var S7r=_Ft();Object.defineProperty(Mq,"V2ChatRequest",{enumerable:!0,get:function(){return S7r.V2ChatRequest}})});var vFt=x(oL=>{"use strict";var C7r=oL&&oL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O7r=oL&&oL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&C7r(e,t,r)};Object.defineProperty(oL,"__esModule",{value:!0});O7r(kje(),oL)});var xFt=x(OM=>{"use strict";var E7r=OM&&OM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wFt=OM&&OM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&E7r(e,t,r)};Object.defineProperty(OM,"__esModule",{value:!0});wFt(Lje(),OM);wFt(vFt(),OM)});var $je=x(z0=>{"use strict";var P7r=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]}),T7r=z0&&z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A7r=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)&&P7r(e,t,r);return T7r(e,t),e};Object.defineProperty(z0,"__esModule",{value:!0});z0.CreateEmbedJobRequestTruncate=void 0;var I7r=A7r(J());z0.CreateEmbedJobRequestTruncate=I7r.serialization.enum_(["START","END"])});var Bje=x(iL=>{"use strict";var M7r=iL&&iL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R7r=iL&&iL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&M7r(e,t,r)};Object.defineProperty(iL,"__esModule",{value:!0});R7r($je(),iL)});var due=x(U0=>{"use strict";var N7r=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]}),j7r=U0&&U0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D7r=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)&&N7r(e,t,r);return j7r(e,t),e};Object.defineProperty(U0,"__esModule",{value:!0});U0.EmbedInputType=void 0;var L7r=D7r(J());U0.EmbedInputType=L7r.serialization.enum_(["search_document","search_query","classification","clustering"])});var fue=x(q0=>{"use strict";var F7r=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]}),k7r=q0&&q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$7r=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)&&F7r(e,t,r);return k7r(e,t),e};Object.defineProperty(q0,"__esModule",{value:!0});q0.EmbeddingType=void 0;var B7r=$7r(J());q0.EmbeddingType=B7r.serialization.enum_(["float","int8","uint8","binary","ubinary"])});var SFt=x(H0=>{"use strict";var z7r=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]}),U7r=H0&&H0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q7r=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)&&z7r(e,t,r);return U7r(e,t),e};Object.defineProperty(H0,"__esModule",{value:!0});H0.CreateEmbedJobRequest=void 0;var EM=q7r(J()),H7r=due(),V7r=fue(),W7r=$je();H0.CreateEmbedJobRequest=EM.serialization.object({model:EM.serialization.string(),datasetId:EM.serialization.property("dataset_id",EM.serialization.string()),inputType:EM.serialization.property("input_type",H7r.EmbedInputType),name:EM.serialization.string().optional(),embeddingTypes:EM.serialization.property("embedding_types",EM.serialization.list(V7r.EmbeddingType).optional()),truncate:W7r.CreateEmbedJobRequestTruncate.optional()})});var zje=x(pue=>{"use strict";Object.defineProperty(pue,"__esModule",{value:!0});pue.CreateEmbedJobRequest=void 0;var K7r=SFt();Object.defineProperty(pue,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return K7r.CreateEmbedJobRequest}})});var CFt=x(aL=>{"use strict";var G7r=aL&&aL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J7r=aL&&aL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&G7r(e,t,r)};Object.defineProperty(aL,"__esModule",{value:!0});J7r(zje(),aL)});var EFt=x(PM=>{"use strict";var Z7r=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]}),OFt=PM&&PM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Z7r(e,t,r)};Object.defineProperty(PM,"__esModule",{value:!0});OFt(Bje(),PM);OFt(CFt(),PM)});var Uje=x(V0=>{"use strict";var Y7r=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]}),X7r=V0&&V0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q7r=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)&&Y7r(e,t,r);return X7r(e,t),e};Object.defineProperty(V0,"__esModule",{value:!0});V0.DatasetType=void 0;var eZr=Q7r(J());V0.DatasetType=eZr.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 qje=x(W0=>{"use strict";var tZr=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]}),rZr=W0&&W0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nZr=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)&&tZr(e,t,r);return rZr(e,t),e};Object.defineProperty(W0,"__esModule",{value:!0});W0.DatasetValidationStatus=void 0;var oZr=nZr(J());W0.DatasetValidationStatus=oZr.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var Hje=x(K0=>{"use strict";var iZr=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]}),aZr=K0&&K0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sZr=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)&&iZr(e,t,r);return aZr(e,t),e};Object.defineProperty(K0,"__esModule",{value:!0});K0.DatasetPart=void 0;var Gh=sZr(J());K0.DatasetPart=Gh.serialization.object({id:Gh.serialization.string(),name:Gh.serialization.string(),url:Gh.serialization.string().optional(),index:Gh.serialization.number().optional(),sizeBytes:Gh.serialization.property("size_bytes",Gh.serialization.number().optional()),numRows:Gh.serialization.property("num_rows",Gh.serialization.number().optional()),originalUrl:Gh.serialization.property("original_url",Gh.serialization.string().optional()),samples:Gh.serialization.list(Gh.serialization.string()).optional()})});var mue=x(G0=>{"use strict";var uZr=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]}),lZr=G0&&G0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cZr=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)&&uZr(e,t,r);return lZr(e,t),e};Object.defineProperty(G0,"__esModule",{value:!0});G0.Dataset=void 0;var hs=cZr(J()),dZr=Uje(),fZr=qje(),pZr=Hje();G0.Dataset=hs.serialization.object({id:hs.serialization.string(),name:hs.serialization.string(),createdAt:hs.serialization.property("created_at",hs.serialization.date()),updatedAt:hs.serialization.property("updated_at",hs.serialization.date()),datasetType:hs.serialization.property("dataset_type",dZr.DatasetType),validationStatus:hs.serialization.property("validation_status",fZr.DatasetValidationStatus),validationError:hs.serialization.property("validation_error",hs.serialization.string().optional()),schema:hs.serialization.string().optional(),requiredFields:hs.serialization.property("required_fields",hs.serialization.list(hs.serialization.string()).optional()),preserveFields:hs.serialization.property("preserve_fields",hs.serialization.list(hs.serialization.string()).optional()),datasetParts:hs.serialization.property("dataset_parts",hs.serialization.list(pZr.DatasetPart).optional()),validationWarnings:hs.serialization.property("validation_warnings",hs.serialization.list(hs.serialization.string()).optional())})});var TFt=x(J0=>{"use strict";var mZr=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]}),hZr=J0&&J0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gZr=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)&&mZr(e,t,r);return hZr(e,t),e};Object.defineProperty(J0,"__esModule",{value:!0});J0.DatasetsListResponse=void 0;var PFt=gZr(J()),yZr=mue();J0.DatasetsListResponse=PFt.serialization.object({datasets:PFt.serialization.list(yZr.Dataset).optional()})});var AFt=x(Z0=>{"use strict";var bZr=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]}),_Zr=Z0&&Z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vZr=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)&&bZr(e,t,r);return _Zr(e,t),e};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.DatasetsCreateResponseDatasetPartsItem=void 0;var TM=vZr(J());Z0.DatasetsCreateResponseDatasetPartsItem=TM.serialization.object({name:TM.serialization.string().optional(),numRows:TM.serialization.property("num_rows",TM.serialization.number().optional()),samples:TM.serialization.list(TM.serialization.string()).optional(),partKind:TM.serialization.property("part_kind",TM.serialization.string().optional())})});var MFt=x(Y0=>{"use strict";var wZr=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]}),xZr=Y0&&Y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SZr=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)&&wZr(e,t,r);return xZr(e,t),e};Object.defineProperty(Y0,"__esModule",{value:!0});Y0.DatasetsCreateResponse=void 0;var IFt=SZr(J());Y0.DatasetsCreateResponse=IFt.serialization.object({id:IFt.serialization.string().optional()})});var RFt=x(X0=>{"use strict";var CZr=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]}),OZr=X0&&X0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EZr=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)&&CZr(e,t,r);return OZr(e,t),e};Object.defineProperty(X0,"__esModule",{value:!0});X0.DatasetsGetUsageResponse=void 0;var Vje=EZr(J());X0.DatasetsGetUsageResponse=Vje.serialization.object({organizationUsage:Vje.serialization.property("organization_usage",Vje.serialization.number().optional())})});var NFt=x(Q0=>{"use strict";var PZr=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]}),TZr=Q0&&Q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AZr=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)&&PZr(e,t,r);return TZr(e,t),e};Object.defineProperty(Q0,"__esModule",{value:!0});Q0.DatasetsGetResponse=void 0;var IZr=AZr(J()),MZr=mue();Q0.DatasetsGetResponse=IZr.serialization.object({dataset:MZr.Dataset})});var Wje=x(Qb=>{"use strict";var RZr=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]}),A9=Qb&&Qb.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&RZr(e,t,r)};Object.defineProperty(Qb,"__esModule",{value:!0});A9(TFt(),Qb);A9(AFt(),Qb);A9(MFt(),Qb);A9(RFt(),Qb);A9(NFt(),Qb)});var jFt=x(ex=>{"use strict";var NZr=ex&&ex.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jZr=ex&&ex.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DZr=ex&&ex.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NZr(e,t,r);return jZr(e,t),e};Object.defineProperty(ex,"__esModule",{value:!0});ex.Response=void 0;var Kje=DZr(J());ex.Response=Kje.serialization.record(Kje.serialization.string(),Kje.serialization.unknown())});var DFt=x(tx=>{"use strict";var LZr=tx&&tx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=tx&&tx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kZr=tx&&tx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LZr(e,t,r);return FZr(e,t),e};Object.defineProperty(tx,"__esModule",{value:!0});tx.delete=void 0;tx.delete=kZr(jFt())});var FFt=x(AM=>{"use strict";var $Zr=AM&&AM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LFt=AM&&AM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$Zr(e,t,r)};Object.defineProperty(AM,"__esModule",{value:!0});LFt(Wje(),AM);LFt(DFt(),AM)});var Gje=x(rx=>{"use strict";var BZr=rx&&rx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zZr=rx&&rx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UZr=rx&&rx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BZr(e,t,r);return zZr(e,t),e};Object.defineProperty(rx,"__esModule",{value:!0});rx.BaseType=void 0;var qZr=UZr(J());rx.BaseType=qZr.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var Jje=x(nx=>{"use strict";var HZr=nx&&nx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VZr=nx&&nx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WZr=nx&&nx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HZr(e,t,r);return VZr(e,t),e};Object.defineProperty(nx,"__esModule",{value:!0});nx.Strategy=void 0;var KZr=WZr(J());nx.Strategy=KZr.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var Zje=x(ox=>{"use strict";var GZr=ox&&ox.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JZr=ox&&ox.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZZr=ox&&ox.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GZr(e,t,r);return JZr(e,t),e};Object.defineProperty(ox,"__esModule",{value:!0});ox.BaseModel=void 0;var hue=ZZr(J()),YZr=Gje(),XZr=Jje();ox.BaseModel=hue.serialization.object({name:hue.serialization.string().optional(),version:hue.serialization.string().optional(),baseType:hue.serialization.property("base_type",YZr.BaseType),strategy:XZr.Strategy.optional()})});var Yje=x(ix=>{"use strict";var QZr=ix&&ix.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=ix&&ix.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tYr=ix&&ix.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QZr(e,t,r);return eYr(e,t),e};Object.defineProperty(ix,"__esModule",{value:!0});ix.Hyperparameters=void 0;var e_=tYr(J());ix.Hyperparameters=e_.serialization.object({earlyStoppingPatience:e_.serialization.property("early_stopping_patience",e_.serialization.number().optional()),earlyStoppingThreshold:e_.serialization.property("early_stopping_threshold",e_.serialization.number().optional()),trainBatchSize:e_.serialization.property("train_batch_size",e_.serialization.number().optional()),trainEpochs:e_.serialization.property("train_epochs",e_.serialization.number().optional()),learningRate:e_.serialization.property("learning_rate",e_.serialization.number().optional())})});var Xje=x(ax=>{"use strict";var rYr=ax&&ax.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=ax&&ax.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oYr=ax&&ax.__importStar||function(t){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(ax,"__esModule",{value:!0});ax.WandbConfig=void 0;var I9=oYr(J());ax.WandbConfig=I9.serialization.object({project:I9.serialization.string(),apiKey:I9.serialization.property("api_key",I9.serialization.string()),entity:I9.serialization.string().optional()})});var gue=x(sx=>{"use strict";var iYr=sx&&sx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aYr=sx&&sx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sYr=sx&&sx.__importStar||function(t){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 aYr(e,t),e};Object.defineProperty(sx,"__esModule",{value:!0});sx.Settings=void 0;var Rq=sYr(J()),uYr=Zje(),lYr=Yje(),cYr=Xje();sx.Settings=Rq.serialization.object({baseModel:Rq.serialization.property("base_model",uYr.BaseModel),datasetId:Rq.serialization.property("dataset_id",Rq.serialization.string()),hyperparameters:lYr.Hyperparameters.optional(),multiLabel:Rq.serialization.property("multi_label",Rq.serialization.boolean().optional()),wandb:cYr.WandbConfig.optional()})});var M9=x(ux=>{"use strict";var dYr=ux&&ux.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=ux&&ux.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pYr=ux&&ux.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dYr(e,t,r);return fYr(e,t),e};Object.defineProperty(ux,"__esModule",{value:!0});ux.Status=void 0;var mYr=pYr(J());ux.Status=mYr.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var Nq=x(lx=>{"use strict";var hYr=lx&&lx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gYr=lx&&lx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yYr=lx&&lx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hYr(e,t,r);return gYr(e,t),e};Object.defineProperty(lx,"__esModule",{value:!0});lx.FinetunedModel=void 0;var Bp=yYr(J()),bYr=gue(),_Yr=M9();lx.FinetunedModel=Bp.serialization.object({id:Bp.serialization.string().optional(),name:Bp.serialization.string(),creatorId:Bp.serialization.property("creator_id",Bp.serialization.string().optional()),organizationId:Bp.serialization.property("organization_id",Bp.serialization.string().optional()),settings:bYr.Settings,status:_Yr.Status.optional(),createdAt:Bp.serialization.property("created_at",Bp.serialization.date().optional()),updatedAt:Bp.serialization.property("updated_at",Bp.serialization.date().optional()),completedAt:Bp.serialization.property("completed_at",Bp.serialization.date().optional()),lastUsed:Bp.serialization.property("last_used",Bp.serialization.date().optional())})});var kFt=x(cx=>{"use strict";var vYr=cx&&cx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wYr=cx&&cx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xYr=cx&&cx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vYr(e,t,r);return wYr(e,t),e};Object.defineProperty(cx,"__esModule",{value:!0});cx.ListFinetunedModelsResponse=void 0;var sL=xYr(J()),SYr=Nq();cx.ListFinetunedModelsResponse=sL.serialization.object({finetunedModels:sL.serialization.property("finetuned_models",sL.serialization.list(SYr.FinetunedModel).optional()),nextPageToken:sL.serialization.property("next_page_token",sL.serialization.string().optional()),totalSize:sL.serialization.property("total_size",sL.serialization.number().optional())})});var BFt=x(dx=>{"use strict";var CYr=dx&&dx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OYr=dx&&dx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EYr=dx&&dx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CYr(e,t,r);return OYr(e,t),e};Object.defineProperty(dx,"__esModule",{value:!0});dx.CreateFinetunedModelResponse=void 0;var $Ft=EYr(J()),PYr=Nq();dx.CreateFinetunedModelResponse=$Ft.serialization.object({finetunedModel:$Ft.serialization.property("finetuned_model",PYr.FinetunedModel.optional())})});var UFt=x(fx=>{"use strict";var TYr=fx&&fx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AYr=fx&&fx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IYr=fx&&fx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TYr(e,t,r);return AYr(e,t),e};Object.defineProperty(fx,"__esModule",{value:!0});fx.GetFinetunedModelResponse=void 0;var zFt=IYr(J()),MYr=Nq();fx.GetFinetunedModelResponse=zFt.serialization.object({finetunedModel:zFt.serialization.property("finetuned_model",MYr.FinetunedModel.optional())})});var qFt=x(px=>{"use strict";var RYr=px&&px.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=px&&px.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jYr=px&&px.__importStar||function(t){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(px,"__esModule",{value:!0});px.DeleteFinetunedModelResponse=void 0;var Qje=jYr(J());px.DeleteFinetunedModelResponse=Qje.serialization.record(Qje.serialization.string(),Qje.serialization.unknown())});var VFt=x(mx=>{"use strict";var DYr=mx&&mx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LYr=mx&&mx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FYr=mx&&mx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DYr(e,t,r);return LYr(e,t),e};Object.defineProperty(mx,"__esModule",{value:!0});mx.UpdateFinetunedModelResponse=void 0;var HFt=FYr(J()),kYr=Nq();mx.UpdateFinetunedModelResponse=HFt.serialization.object({finetunedModel:HFt.serialization.property("finetuned_model",kYr.FinetunedModel.optional())})});var eDe=x(hx=>{"use strict";var $Yr=hx&&hx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BYr=hx&&hx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zYr=hx&&hx.__importStar||function(t){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 BYr(e,t),e};Object.defineProperty(hx,"__esModule",{value:!0});hx.Event=void 0;var R9=zYr(J()),UYr=M9();hx.Event=R9.serialization.object({userId:R9.serialization.property("user_id",R9.serialization.string().optional()),status:UYr.Status.optional(),createdAt:R9.serialization.property("created_at",R9.serialization.date().optional())})});var WFt=x(gx=>{"use strict";var qYr=gx&&gx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HYr=gx&&gx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VYr=gx&&gx.__importStar||function(t){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 HYr(e,t),e};Object.defineProperty(gx,"__esModule",{value:!0});gx.ListEventsResponse=void 0;var jq=VYr(J()),WYr=eDe();gx.ListEventsResponse=jq.serialization.object({events:jq.serialization.list(WYr.Event).optional(),nextPageToken:jq.serialization.property("next_page_token",jq.serialization.string().optional()),totalSize:jq.serialization.property("total_size",jq.serialization.number().optional())})});var tDe=x(yx=>{"use strict";var KYr=yx&&yx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GYr=yx&&yx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JYr=yx&&yx.__importStar||function(t){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 GYr(e,t),e};Object.defineProperty(yx,"__esModule",{value:!0});yx.TrainingStepMetrics=void 0;var IM=JYr(J());yx.TrainingStepMetrics=IM.serialization.object({createdAt:IM.serialization.property("created_at",IM.serialization.date().optional()),stepNumber:IM.serialization.property("step_number",IM.serialization.number().optional()),metrics:IM.serialization.record(IM.serialization.string(),IM.serialization.number()).optional()})});var KFt=x(bx=>{"use strict";var ZYr=bx&&bx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YYr=bx&&bx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XYr=bx&&bx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZYr(e,t,r);return YYr(e,t),e};Object.defineProperty(bx,"__esModule",{value:!0});bx.ListTrainingStepMetricsResponse=void 0;var N9=XYr(J()),QYr=tDe();bx.ListTrainingStepMetricsResponse=N9.serialization.object({stepMetrics:N9.serialization.property("step_metrics",N9.serialization.list(QYr.TrainingStepMetrics).optional()),nextPageToken:N9.serialization.property("next_page_token",N9.serialization.string().optional())})});var rDe=x(gs=>{"use strict";var eXr=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]}),Ld=gs&&gs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eXr(e,t,r)};Object.defineProperty(gs,"__esModule",{value:!0});Ld(Gje(),gs);Ld(Jje(),gs);Ld(Zje(),gs);Ld(Yje(),gs);Ld(Xje(),gs);Ld(gue(),gs);Ld(M9(),gs);Ld(Nq(),gs);Ld(kFt(),gs);Ld(BFt(),gs);Ld(UFt(),gs);Ld(qFt(),gs);Ld(VFt(),gs);Ld(eDe(),gs);Ld(WFt(),gs);Ld(tDe(),gs);Ld(KFt(),gs)});var GFt=x(uL=>{"use strict";var tXr=uL&&uL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rXr=uL&&uL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tXr(e,t,r)};Object.defineProperty(uL,"__esModule",{value:!0});rXr(rDe(),uL)});var ZFt=x(Jh=>{"use strict";var JFt=Jh&&Jh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nXr=Jh&&Jh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oXr=Jh&&Jh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JFt(e,t,r);return nXr(e,t),e},iXr=Jh&&Jh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&JFt(e,t,r)};Object.defineProperty(Jh,"__esModule",{value:!0});Jh.finetuning=void 0;Jh.finetuning=oXr(GFt());iXr(rDe(),Jh)});var YFt=x(_x=>{"use strict";var aXr=_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]}),sXr=_x&&_x.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uXr=_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)&&aXr(e,t,r);return sXr(e,t),e};Object.defineProperty(_x,"__esModule",{value:!0});_x.FinetuningUpdateFinetunedModelRequest=void 0;var zm=uXr(J()),lXr=gue(),cXr=M9();_x.FinetuningUpdateFinetunedModelRequest=zm.serialization.object({name:zm.serialization.string(),creatorId:zm.serialization.property("creator_id",zm.serialization.string().optional()),organizationId:zm.serialization.property("organization_id",zm.serialization.string().optional()),settings:lXr.Settings,status:cXr.Status.optional(),createdAt:zm.serialization.property("created_at",zm.serialization.date().optional()),updatedAt:zm.serialization.property("updated_at",zm.serialization.date().optional()),completedAt:zm.serialization.property("completed_at",zm.serialization.date().optional()),lastUsed:zm.serialization.property("last_used",zm.serialization.date().optional())})});var nDe=x(yue=>{"use strict";Object.defineProperty(yue,"__esModule",{value:!0});yue.FinetuningUpdateFinetunedModelRequest=void 0;var dXr=YFt();Object.defineProperty(yue,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return dXr.FinetuningUpdateFinetunedModelRequest}})});var XFt=x(lL=>{"use strict";var fXr=lL&&lL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pXr=lL&&lL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fXr(e,t,r)};Object.defineProperty(lL,"__esModule",{value:!0});pXr(nDe(),lL)});var ekt=x(MM=>{"use strict";var mXr=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]}),QFt=MM&&MM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mXr(e,t,r)};Object.defineProperty(MM,"__esModule",{value:!0});QFt(ZFt(),MM);QFt(XFt(),MM)});var bue=x(wx=>{"use strict";var hXr=wx&&wx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gXr=wx&&wx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yXr=wx&&wx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hXr(e,t,r);return gXr(e,t),e};Object.defineProperty(wx,"__esModule",{value:!0});wx.CreateConnectorOAuth=void 0;var vx=yXr(J());wx.CreateConnectorOAuth=vx.serialization.object({clientId:vx.serialization.property("client_id",vx.serialization.string().optional()),clientSecret:vx.serialization.property("client_secret",vx.serialization.string().optional()),authorizeUrl:vx.serialization.property("authorize_url",vx.serialization.string().optional()),tokenUrl:vx.serialization.property("token_url",vx.serialization.string().optional()),scope:vx.serialization.string().optional()})});var oDe=x(xx=>{"use strict";var bXr=xx&&xx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Xr=xx&&xx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vXr=xx&&xx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bXr(e,t,r);return _Xr(e,t),e};Object.defineProperty(xx,"__esModule",{value:!0});xx.AuthTokenType=void 0;var wXr=vXr(J());xx.AuthTokenType=wXr.serialization.enum_(["bearer","basic","noscheme"])});var _ue=x(Sx=>{"use strict";var xXr=Sx&&Sx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SXr=Sx&&Sx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CXr=Sx&&Sx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xXr(e,t,r);return SXr(e,t),e};Object.defineProperty(Sx,"__esModule",{value:!0});Sx.CreateConnectorServiceAuth=void 0;var tkt=CXr(J()),OXr=oDe();Sx.CreateConnectorServiceAuth=tkt.serialization.object({type:OXr.AuthTokenType,token:tkt.serialization.string()})});var rkt=x(Ox=>{"use strict";var EXr=Ox&&Ox.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PXr=Ox&&Ox.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TXr=Ox&&Ox.__importStar||function(t){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 PXr(e,t),e};Object.defineProperty(Ox,"__esModule",{value:!0});Ox.CreateConnectorRequest=void 0;var Cx=TXr(J()),AXr=bue(),IXr=_ue();Ox.CreateConnectorRequest=Cx.serialization.object({name:Cx.serialization.string(),description:Cx.serialization.string().optional(),url:Cx.serialization.string(),excludes:Cx.serialization.list(Cx.serialization.string()).optional(),oauth:AXr.CreateConnectorOAuth.optional(),active:Cx.serialization.boolean().optional(),continueOnFailure:Cx.serialization.property("continue_on_failure",Cx.serialization.boolean().optional()),serviceAuth:Cx.serialization.property("service_auth",IXr.CreateConnectorServiceAuth.optional())})});var nkt=x(Ex=>{"use strict";var MXr=Ex&&Ex.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RXr=Ex&&Ex.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NXr=Ex&&Ex.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MXr(e,t,r);return RXr(e,t),e};Object.defineProperty(Ex,"__esModule",{value:!0});Ex.UpdateConnectorRequest=void 0;var hP=NXr(J()),jXr=bue(),DXr=_ue();Ex.UpdateConnectorRequest=hP.serialization.object({name:hP.serialization.string().optional(),url:hP.serialization.string().optional(),excludes:hP.serialization.list(hP.serialization.string()).optional(),oauth:jXr.CreateConnectorOAuth.optional(),active:hP.serialization.boolean().optional(),continueOnFailure:hP.serialization.property("continue_on_failure",hP.serialization.boolean().optional()),serviceAuth:hP.serialization.property("service_auth",DXr.CreateConnectorServiceAuth.optional())})});var iDe=x(Dq=>{"use strict";Object.defineProperty(Dq,"__esModule",{value:!0});Dq.UpdateConnectorRequest=Dq.CreateConnectorRequest=void 0;var LXr=rkt();Object.defineProperty(Dq,"CreateConnectorRequest",{enumerable:!0,get:function(){return LXr.CreateConnectorRequest}});var FXr=nkt();Object.defineProperty(Dq,"UpdateConnectorRequest",{enumerable:!0,get:function(){return FXr.UpdateConnectorRequest}})});var okt=x(cL=>{"use strict";var kXr=cL&&cL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Xr=cL&&cL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kXr(e,t,r)};Object.defineProperty(cL,"__esModule",{value:!0});$Xr(iDe(),cL)});var ikt=x(dL=>{"use strict";var BXr=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]}),zXr=dL&&dL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BXr(e,t,r)};Object.defineProperty(dL,"__esModule",{value:!0});zXr(okt(),dL)});var skt=x(na=>{"use strict";var akt=na&&na.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UXr=na&&na.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j9=na&&na.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&akt(e,t,r);return UXr(e,t),e},fL=na&&na.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&akt(e,t,r)};Object.defineProperty(na,"__esModule",{value:!0});na.connectors=na.finetuning=na.datasets=na.embedJobs=na.v2=void 0;na.v2=j9(xFt());fL(Lje(),na);na.embedJobs=j9(EFt());fL(Bje(),na);na.datasets=j9(FFt());fL(Wje(),na);na.finetuning=j9(ekt());fL(kje(),na);fL(zje(),na);na.connectors=j9(ikt());fL(iDe(),na);fL(nDe(),na)});var aDe=x(Px=>{"use strict";var qXr=Px&&Px.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HXr=Px&&Px.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VXr=Px&&Px.__importStar||function(t){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 HXr(e,t),e};Object.defineProperty(Px,"__esModule",{value:!0});Px.ChatStreamRequestPromptTruncation=void 0;var WXr=VXr(J());Px.ChatStreamRequestPromptTruncation=WXr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var sDe=x(Tx=>{"use strict";var KXr=Tx&&Tx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GXr=Tx&&Tx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JXr=Tx&&Tx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KXr(e,t,r);return GXr(e,t),e};Object.defineProperty(Tx,"__esModule",{value:!0});Tx.ChatStreamRequestCitationQuality=void 0;var ZXr=JXr(J());Tx.ChatStreamRequestCitationQuality=ZXr.serialization.enum_(["fast","accurate","off"])});var lkt=x(Ax=>{"use strict";var YXr=Ax&&Ax.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XXr=Ax&&Ax.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QXr=Ax&&Ax.__importStar||function(t){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 XXr(e,t),e};Object.defineProperty(Ax,"__esModule",{value:!0});Ax.ChatStreamRequestConnectorsSearchOptions=void 0;var ukt=QXr(J());Ax.ChatStreamRequestConnectorsSearchOptions=ukt.serialization.object({seed:ukt.serialization.number().optional()})});var uDe=x(Ix=>{"use strict";var eQr=Ix&&Ix.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tQr=Ix&&Ix.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rQr=Ix&&Ix.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eQr(e,t,r);return tQr(e,t),e};Object.defineProperty(Ix,"__esModule",{value:!0});Ix.ChatStreamRequestSafetyMode=void 0;var nQr=rQr(J());Ix.ChatStreamRequestSafetyMode=nQr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var dkt=x(Mx=>{"use strict";var oQr=Mx&&Mx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iQr=Mx&&Mx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aQr=Mx&&Mx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oQr(e,t,r);return iQr(e,t),e};Object.defineProperty(Mx,"__esModule",{value:!0});Mx.UnprocessableEntityErrorBody=void 0;var ckt=aQr(J());Mx.UnprocessableEntityErrorBody=ckt.serialization.object({data:ckt.serialization.string().optional()})});var pkt=x(Rx=>{"use strict";var sQr=Rx&&Rx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uQr=Rx&&Rx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lQr=Rx&&Rx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sQr(e,t,r);return uQr(e,t),e};Object.defineProperty(Rx,"__esModule",{value:!0});Rx.TooManyRequestsErrorBody=void 0;var fkt=lQr(J());Rx.TooManyRequestsErrorBody=fkt.serialization.object({data:fkt.serialization.string().optional()})});var hkt=x(Nx=>{"use strict";var cQr=Nx&&Nx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dQr=Nx&&Nx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fQr=Nx&&Nx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cQr(e,t,r);return dQr(e,t),e};Object.defineProperty(Nx,"__esModule",{value:!0});Nx.ClientClosedRequestErrorBody=void 0;var mkt=fQr(J());Nx.ClientClosedRequestErrorBody=mkt.serialization.object({data:mkt.serialization.string().optional()})});var ykt=x(jx=>{"use strict";var pQr=jx&&jx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mQr=jx&&jx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hQr=jx&&jx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pQr(e,t,r);return mQr(e,t),e};Object.defineProperty(jx,"__esModule",{value:!0});jx.NotImplementedErrorBody=void 0;var gkt=hQr(J());jx.NotImplementedErrorBody=gkt.serialization.object({data:gkt.serialization.string().optional()})});var _kt=x(Dx=>{"use strict";var gQr=Dx&&Dx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yQr=Dx&&Dx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bQr=Dx&&Dx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gQr(e,t,r);return yQr(e,t),e};Object.defineProperty(Dx,"__esModule",{value:!0});Dx.GatewayTimeoutErrorBody=void 0;var bkt=bQr(J());Dx.GatewayTimeoutErrorBody=bkt.serialization.object({data:bkt.serialization.string().optional()})});var lDe=x(Lx=>{"use strict";var _Qr=Lx&&Lx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vQr=Lx&&Lx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wQr=Lx&&Lx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Qr(e,t,r);return vQr(e,t),e};Object.defineProperty(Lx,"__esModule",{value:!0});Lx.ChatRequestPromptTruncation=void 0;var xQr=wQr(J());Lx.ChatRequestPromptTruncation=xQr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var cDe=x(Fx=>{"use strict";var SQr=Fx&&Fx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CQr=Fx&&Fx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OQr=Fx&&Fx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SQr(e,t,r);return CQr(e,t),e};Object.defineProperty(Fx,"__esModule",{value:!0});Fx.ChatRequestCitationQuality=void 0;var EQr=OQr(J());Fx.ChatRequestCitationQuality=EQr.serialization.enum_(["fast","accurate","off"])});var wkt=x(kx=>{"use strict";var PQr=kx&&kx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TQr=kx&&kx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AQr=kx&&kx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PQr(e,t,r);return TQr(e,t),e};Object.defineProperty(kx,"__esModule",{value:!0});kx.ChatRequestConnectorsSearchOptions=void 0;var vkt=AQr(J());kx.ChatRequestConnectorsSearchOptions=vkt.serialization.object({seed:vkt.serialization.number().optional()})});var dDe=x($x=>{"use strict";var IQr=$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]}),MQr=$x&&$x.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RQr=$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)&&IQr(e,t,r);return MQr(e,t),e};Object.defineProperty($x,"__esModule",{value:!0});$x.ChatRequestSafetyMode=void 0;var NQr=RQr(J());$x.ChatRequestSafetyMode=NQr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var fDe=x(Bx=>{"use strict";var jQr=Bx&&Bx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DQr=Bx&&Bx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LQr=Bx&&Bx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jQr(e,t,r);return DQr(e,t),e};Object.defineProperty(Bx,"__esModule",{value:!0});Bx.GenerateStreamRequestTruncate=void 0;var FQr=LQr(J());Bx.GenerateStreamRequestTruncate=FQr.serialization.enum_(["NONE","START","END"])});var pDe=x(zx=>{"use strict";var kQr=zx&&zx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Qr=zx&&zx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BQr=zx&&zx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kQr(e,t,r);return $Qr(e,t),e};Object.defineProperty(zx,"__esModule",{value:!0});zx.GenerateStreamRequestReturnLikelihoods=void 0;var zQr=BQr(J());zx.GenerateStreamRequestReturnLikelihoods=zQr.serialization.enum_(["GENERATION","ALL","NONE"])});var mDe=x(Ux=>{"use strict";var UQr=Ux&&Ux.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qQr=Ux&&Ux.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HQr=Ux&&Ux.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UQr(e,t,r);return qQr(e,t),e};Object.defineProperty(Ux,"__esModule",{value:!0});Ux.GenerateRequestTruncate=void 0;var VQr=HQr(J());Ux.GenerateRequestTruncate=VQr.serialization.enum_(["NONE","START","END"])});var hDe=x(qx=>{"use strict";var WQr=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]}),KQr=qx&&qx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GQr=qx&&qx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WQr(e,t,r);return KQr(e,t),e};Object.defineProperty(qx,"__esModule",{value:!0});qx.GenerateRequestReturnLikelihoods=void 0;var JQr=GQr(J());qx.GenerateRequestReturnLikelihoods=JQr.serialization.enum_(["GENERATION","ALL","NONE"])});var gDe=x(Hx=>{"use strict";var ZQr=Hx&&Hx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YQr=Hx&&Hx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XQr=Hx&&Hx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZQr(e,t,r);return YQr(e,t),e};Object.defineProperty(Hx,"__esModule",{value:!0});Hx.EmbedRequestTruncate=void 0;var QQr=XQr(J());Hx.EmbedRequestTruncate=QQr.serialization.enum_(["NONE","START","END"])});var yDe=x(Vx=>{"use strict";var een=Vx&&Vx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ten=Vx&&Vx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ren=Vx&&Vx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&een(e,t,r);return ten(e,t),e};Object.defineProperty(Vx,"__esModule",{value:!0});Vx.ApiMetaApiVersion=void 0;var Lq=ren(J());Vx.ApiMetaApiVersion=Lq.serialization.object({version:Lq.serialization.string(),isDeprecated:Lq.serialization.property("is_deprecated",Lq.serialization.boolean().optional()),isExperimental:Lq.serialization.property("is_experimental",Lq.serialization.boolean().optional())})});var bDe=x(Wx=>{"use strict";var nen=Wx&&Wx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oen=Wx&&Wx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ien=Wx&&Wx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nen(e,t,r);return oen(e,t),e};Object.defineProperty(Wx,"__esModule",{value:!0});Wx.ApiMetaBilledUnits=void 0;var RM=ien(J());Wx.ApiMetaBilledUnits=RM.serialization.object({inputTokens:RM.serialization.property("input_tokens",RM.serialization.number().optional()),outputTokens:RM.serialization.property("output_tokens",RM.serialization.number().optional()),searchUnits:RM.serialization.property("search_units",RM.serialization.number().optional()),classifications:RM.serialization.number().optional()})});var _De=x(Kx=>{"use strict";var aen=Kx&&Kx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Kx&&Kx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uen=Kx&&Kx.__importStar||function(t){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 sen(e,t),e};Object.defineProperty(Kx,"__esModule",{value:!0});Kx.ApiMetaTokens=void 0;var D9=uen(J());Kx.ApiMetaTokens=D9.serialization.object({inputTokens:D9.serialization.property("input_tokens",D9.serialization.number().optional()),outputTokens:D9.serialization.property("output_tokens",D9.serialization.number().optional())})});var Zh=x(Gx=>{"use strict";var len=Gx&&Gx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cen=Gx&&Gx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),den=Gx&&Gx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&len(e,t,r);return cen(e,t),e};Object.defineProperty(Gx,"__esModule",{value:!0});Gx.ApiMeta=void 0;var L9=den(J()),fen=yDe(),pen=bDe(),men=_De();Gx.ApiMeta=L9.serialization.object({apiVersion:L9.serialization.property("api_version",fen.ApiMetaApiVersion.optional()),billedUnits:L9.serialization.property("billed_units",pen.ApiMetaBilledUnits.optional()),tokens:men.ApiMetaTokens.optional(),warnings:L9.serialization.list(L9.serialization.string()).optional()})});var vDe=x(Jx=>{"use strict";var hen=Jx&&Jx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gen=Jx&&Jx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yen=Jx&&Jx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hen(e,t,r);return gen(e,t),e};Object.defineProperty(Jx,"__esModule",{value:!0});Jx.EmbedFloatsResponse=void 0;var pL=yen(J()),ben=Zh();Jx.EmbedFloatsResponse=pL.serialization.object({id:pL.serialization.string(),embeddings:pL.serialization.list(pL.serialization.list(pL.serialization.number())),texts:pL.serialization.list(pL.serialization.string()),meta:ben.ApiMeta.optional()})});var wDe=x(Zx=>{"use strict";var _en=Zx&&Zx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ven=Zx&&Zx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wen=Zx&&Zx.__importStar||function(t){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 ven(e,t),e};Object.defineProperty(Zx,"__esModule",{value:!0});Zx.EmbedByTypeResponseEmbeddings=void 0;var Kf=wen(J());Zx.EmbedByTypeResponseEmbeddings=Kf.serialization.object({float:Kf.serialization.list(Kf.serialization.list(Kf.serialization.number())).optional(),int8:Kf.serialization.list(Kf.serialization.list(Kf.serialization.number())).optional(),uint8:Kf.serialization.list(Kf.serialization.list(Kf.serialization.number())).optional(),binary:Kf.serialization.list(Kf.serialization.list(Kf.serialization.number())).optional(),ubinary:Kf.serialization.list(Kf.serialization.list(Kf.serialization.number())).optional()})});var xDe=x(Yx=>{"use strict";var xen=Yx&&Yx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Yx&&Yx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cen=Yx&&Yx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xen(e,t,r);return Sen(e,t),e};Object.defineProperty(Yx,"__esModule",{value:!0});Yx.EmbedByTypeResponse=void 0;var vue=Cen(J()),Oen=wDe(),Een=Zh();Yx.EmbedByTypeResponse=vue.serialization.object({id:vue.serialization.string(),embeddings:Oen.EmbedByTypeResponseEmbeddings,texts:vue.serialization.list(vue.serialization.string()),meta:Een.ApiMeta.optional()})});var Skt=x(Xx=>{"use strict";var Pen=Xx&&Xx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ten=Xx&&Xx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Aen=Xx&&Xx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Pen(e,t,r);return Ten(e,t),e};Object.defineProperty(Xx,"__esModule",{value:!0});Xx.EmbedResponse=void 0;var xkt=Aen(J()),Ien=vDe(),Men=xDe();Xx.EmbedResponse=xkt.serialization.union(xkt.serialization.discriminant("responseType","response_type"),{embeddings_floats:Ien.EmbedFloatsResponse,embeddings_by_type:Men.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var CDe=x(Qx=>{"use strict";var Ren=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]}),Nen=Qx&&Qx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jen=Qx&&Qx.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ren(e,t,r);return Nen(e,t),e};Object.defineProperty(Qx,"__esModule",{value:!0});Qx.RerankDocument=void 0;var SDe=jen(J());Qx.RerankDocument=SDe.serialization.record(SDe.serialization.string(),SDe.serialization.string())});var ODe=x(eS=>{"use strict";var Den=eS&&eS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Len=eS&&eS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fen=eS&&eS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Den(e,t,r);return Len(e,t),e};Object.defineProperty(eS,"__esModule",{value:!0});eS.RerankRequestDocumentsItem=void 0;var Ckt=Fen(J()),ken=CDe();eS.RerankRequestDocumentsItem=Ckt.serialization.undiscriminatedUnion([Ckt.serialization.string(),ken.RerankDocument])});var EDe=x(tS=>{"use strict";var $en=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]}),Ben=tS&&tS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zen=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)&&$en(e,t,r);return Ben(e,t),e};Object.defineProperty(tS,"__esModule",{value:!0});tS.RerankResponseResultsItemDocument=void 0;var Okt=zen(J());tS.RerankResponseResultsItemDocument=Okt.serialization.object({text:Okt.serialization.string()})});var PDe=x(rS=>{"use strict";var Uen=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]}),qen=rS&&rS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hen=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)&&Uen(e,t,r);return qen(e,t),e};Object.defineProperty(rS,"__esModule",{value:!0});rS.RerankResponseResultsItem=void 0;var wue=Hen(J()),Ven=EDe();rS.RerankResponseResultsItem=wue.serialization.object({document:Ven.RerankResponseResultsItemDocument.optional(),index:wue.serialization.number(),relevanceScore:wue.serialization.property("relevance_score",wue.serialization.number())})});var Ekt=x(nS=>{"use strict";var Wen=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]}),Ken=nS&&nS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gen=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)&&Wen(e,t,r);return Ken(e,t),e};Object.defineProperty(nS,"__esModule",{value:!0});nS.RerankResponse=void 0;var TDe=Gen(J()),Jen=PDe(),Zen=Zh();nS.RerankResponse=TDe.serialization.object({id:TDe.serialization.string().optional(),results:TDe.serialization.list(Jen.RerankResponseResultsItem),meta:Zen.ApiMeta.optional()})});var ADe=x(oS=>{"use strict";var Yen=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]}),Xen=oS&&oS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qen=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)&&Yen(e,t,r);return Xen(e,t),e};Object.defineProperty(oS,"__esModule",{value:!0});oS.ClassifyRequestTruncate=void 0;var etn=Qen(J());oS.ClassifyRequestTruncate=etn.serialization.enum_(["NONE","START","END"])});var IDe=x(iS=>{"use strict";var ttn=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]}),rtn=iS&&iS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ntn=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)&&ttn(e,t,r);return rtn(e,t),e};Object.defineProperty(iS,"__esModule",{value:!0});iS.ClassifyResponseClassificationsItemLabelsValue=void 0;var Pkt=ntn(J());iS.ClassifyResponseClassificationsItemLabelsValue=Pkt.serialization.object({confidence:Pkt.serialization.number().optional()})});var MDe=x(aS=>{"use strict";var otn=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]}),itn=aS&&aS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),atn=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)&&otn(e,t,r);return itn(e,t),e};Object.defineProperty(aS,"__esModule",{value:!0});aS.ClassifyResponseClassificationsItemClassificationType=void 0;var stn=atn(J());aS.ClassifyResponseClassificationsItemClassificationType=stn.serialization.enum_(["single-label","multi-label"])});var RDe=x(sS=>{"use strict";var utn=sS&&sS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ltn=sS&&sS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ctn=sS&&sS.__importStar||function(t){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 ltn(e,t),e};Object.defineProperty(sS,"__esModule",{value:!0});sS.ClassifyResponseClassificationsItem=void 0;var xy=ctn(J()),dtn=IDe(),ftn=MDe();sS.ClassifyResponseClassificationsItem=xy.serialization.object({id:xy.serialization.string(),input:xy.serialization.string().optional(),prediction:xy.serialization.string().optional(),predictions:xy.serialization.list(xy.serialization.string()),confidence:xy.serialization.number().optional(),confidences:xy.serialization.list(xy.serialization.number()),labels:xy.serialization.record(xy.serialization.string(),dtn.ClassifyResponseClassificationsItemLabelsValue),classificationType:xy.serialization.property("classification_type",ftn.ClassifyResponseClassificationsItemClassificationType)})});var Tkt=x(uS=>{"use strict";var ptn=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]}),mtn=uS&&uS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),htn=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)&&ptn(e,t,r);return mtn(e,t),e};Object.defineProperty(uS,"__esModule",{value:!0});uS.ClassifyResponse=void 0;var NDe=htn(J()),gtn=RDe(),ytn=Zh();uS.ClassifyResponse=NDe.serialization.object({id:NDe.serialization.string(),classifications:NDe.serialization.list(gtn.ClassifyResponseClassificationsItem),meta:ytn.ApiMeta.optional()})});var jDe=x(lS=>{"use strict";var btn=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]}),_tn=lS&&lS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vtn=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)&&btn(e,t,r);return _tn(e,t),e};Object.defineProperty(lS,"__esModule",{value:!0});lS.SummarizeRequestLength=void 0;var wtn=vtn(J());lS.SummarizeRequestLength=wtn.serialization.enum_(["short","medium","long"])});var DDe=x(cS=>{"use strict";var xtn=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]}),Stn=cS&&cS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ctn=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)&&xtn(e,t,r);return Stn(e,t),e};Object.defineProperty(cS,"__esModule",{value:!0});cS.SummarizeRequestFormat=void 0;var Otn=Ctn(J());cS.SummarizeRequestFormat=Otn.serialization.enum_(["paragraph","bullets"])});var LDe=x(dS=>{"use strict";var Etn=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]}),Ptn=dS&&dS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ttn=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)&&Etn(e,t,r);return Ptn(e,t),e};Object.defineProperty(dS,"__esModule",{value:!0});dS.SummarizeRequestExtractiveness=void 0;var Atn=Ttn(J());dS.SummarizeRequestExtractiveness=Atn.serialization.enum_(["low","medium","high"])});var Akt=x(fS=>{"use strict";var Itn=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]}),Mtn=fS&&fS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rtn=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)&&Itn(e,t,r);return Mtn(e,t),e};Object.defineProperty(fS,"__esModule",{value:!0});fS.SummarizeResponse=void 0;var FDe=Rtn(J()),Ntn=Zh();fS.SummarizeResponse=FDe.serialization.object({id:FDe.serialization.string().optional(),summary:FDe.serialization.string().optional(),meta:Ntn.ApiMeta.optional()})});var Ikt=x(pS=>{"use strict";var jtn=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]}),Dtn=pS&&pS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ltn=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)&&jtn(e,t,r);return Dtn(e,t),e};Object.defineProperty(pS,"__esModule",{value:!0});pS.TokenizeResponse=void 0;var Fq=Ltn(J()),Ftn=Zh();pS.TokenizeResponse=Fq.serialization.object({tokens:Fq.serialization.list(Fq.serialization.number()),tokenStrings:Fq.serialization.property("token_strings",Fq.serialization.list(Fq.serialization.string())),meta:Ftn.ApiMeta.optional()})});var Rkt=x(mS=>{"use strict";var ktn=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]}),$tn=mS&&mS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Btn=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)&&ktn(e,t,r);return $tn(e,t),e};Object.defineProperty(mS,"__esModule",{value:!0});mS.DetokenizeResponse=void 0;var Mkt=Btn(J()),ztn=Zh();mS.DetokenizeResponse=Mkt.serialization.object({text:Mkt.serialization.string(),meta:ztn.ApiMeta.optional()})});var Nkt=x(hS=>{"use strict";var Utn=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]}),qtn=hS&&hS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Htn=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)&&Utn(e,t,r);return qtn(e,t),e};Object.defineProperty(hS,"__esModule",{value:!0});hS.CheckApiKeyResponse=void 0;var kq=Htn(J());hS.CheckApiKeyResponse=kq.serialization.object({valid:kq.serialization.boolean(),organizationId:kq.serialization.property("organization_id",kq.serialization.string().optional()),ownerId:kq.serialization.property("owner_id",kq.serialization.string().optional())})});var $q=x(gS=>{"use strict";var Vtn=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]}),Wtn=gS&&gS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ktn=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)&&Vtn(e,t,r);return Wtn(e,t),e};Object.defineProperty(gS,"__esModule",{value:!0});gS.ToolCall=void 0;var F9=Ktn(J());gS.ToolCall=F9.serialization.object({name:F9.serialization.string(),parameters:F9.serialization.record(F9.serialization.string(),F9.serialization.unknown())})});var kDe=x(yS=>{"use strict";var Gtn=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]}),Jtn=yS&&yS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ztn=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)&&Gtn(e,t,r);return Jtn(e,t),e};Object.defineProperty(yS,"__esModule",{value:!0});yS.ChatMessage=void 0;var xue=Ztn(J()),Ytn=$q();yS.ChatMessage=xue.serialization.object({message:xue.serialization.string(),toolCalls:xue.serialization.property("tool_calls",xue.serialization.list(Ytn.ToolCall).optional())})});var $9=x(bS=>{"use strict";var Xtn=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]}),Qtn=bS&&bS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ern=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)&&Xtn(e,t,r);return Qtn(e,t),e};Object.defineProperty(bS,"__esModule",{value:!0});bS.ToolResult=void 0;var k9=ern(J()),trn=$q();bS.ToolResult=k9.serialization.object({call:trn.ToolCall,outputs:k9.serialization.list(k9.serialization.record(k9.serialization.string(),k9.serialization.unknown()))})});var BDe=x(_S=>{"use strict";var rrn=_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]}),nrn=_S&&_S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),orn=_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)&&rrn(e,t,r);return nrn(e,t),e};Object.defineProperty(_S,"__esModule",{value:!0});_S.ToolMessage=void 0;var $De=orn(J()),irn=$9();_S.ToolMessage=$De.serialization.object({toolResults:$De.serialization.property("tool_results",$De.serialization.list(irn.ToolResult).optional())})});var B9=x(vS=>{"use strict";var arn=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]}),srn=vS&&vS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),urn=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)&&arn(e,t,r);return srn(e,t),e};Object.defineProperty(vS,"__esModule",{value:!0});vS.Message=void 0;var lrn=urn(J()),zDe=kDe(),crn=BDe();vS.Message=lrn.serialization.union("role",{CHATBOT:zDe.ChatMessage,SYSTEM:zDe.ChatMessage,USER:zDe.ChatMessage,TOOL:crn.ToolMessage}).transform({transform:t=>t,untransform:t=>t})});var Sue=x(wS=>{"use strict";var drn=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]}),frn=wS&&wS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),prn=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)&&drn(e,t,r);return frn(e,t),e};Object.defineProperty(wS,"__esModule",{value:!0});wS.ChatConnector=void 0;var gP=prn(J());wS.ChatConnector=gP.serialization.object({id:gP.serialization.string(),userAccessToken:gP.serialization.property("user_access_token",gP.serialization.string().optional()),continueOnFailure:gP.serialization.property("continue_on_failure",gP.serialization.boolean().optional()),options:gP.serialization.record(gP.serialization.string(),gP.serialization.unknown()).optional()})});var UDe=x(xS=>{"use strict";var mrn=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]}),hrn=xS&&xS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),grn=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)&&mrn(e,t,r);return hrn(e,t),e};Object.defineProperty(xS,"__esModule",{value:!0});xS.ToolParameterDefinitionsValue=void 0;var Cue=grn(J());xS.ToolParameterDefinitionsValue=Cue.serialization.object({description:Cue.serialization.string().optional(),type:Cue.serialization.string(),required:Cue.serialization.boolean().optional()})});var Oue=x(SS=>{"use strict";var yrn=SS&&SS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),brn=SS&&SS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_rn=SS&&SS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yrn(e,t,r);return brn(e,t),e};Object.defineProperty(SS,"__esModule",{value:!0});SS.Tool=void 0;var Bq=_rn(J()),vrn=UDe();SS.Tool=Bq.serialization.object({name:Bq.serialization.string(),description:Bq.serialization.string(),parameterDefinitions:Bq.serialization.property("parameter_definitions",Bq.serialization.record(Bq.serialization.string(),vrn.ToolParameterDefinitionsValue).optional())})});var qDe=x(CS=>{"use strict";var wrn=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]}),xrn=CS&&CS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Srn=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)&&wrn(e,t,r);return xrn(e,t),e};Object.defineProperty(CS,"__esModule",{value:!0});CS.JsonResponseFormat=void 0;var Eue=Srn(J());CS.JsonResponseFormat=Eue.serialization.object({schema:Eue.serialization.record(Eue.serialization.string(),Eue.serialization.unknown()).optional()})});var Pue=x(OS=>{"use strict";var Crn=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]}),Orn=OS&&OS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ern=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)&&Crn(e,t,r);return Orn(e,t),e};Object.defineProperty(OS,"__esModule",{value:!0});OS.ResponseFormat=void 0;var Prn=Ern(J()),Trn=lue(),Arn=qDe();OS.ResponseFormat=Prn.serialization.union("type",{text:Trn.TextResponseFormat,json_object:Arn.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var Tue=x(ES=>{"use strict";var Irn=ES&&ES.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mrn=ES&&ES.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rrn=ES&&ES.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Irn(e,t,r);return Mrn(e,t),e};Object.defineProperty(ES,"__esModule",{value:!0});ES.ChatCitation=void 0;var mL=Rrn(J());ES.ChatCitation=mL.serialization.object({start:mL.serialization.number(),end:mL.serialization.number(),text:mL.serialization.string(),documentIds:mL.serialization.property("document_ids",mL.serialization.list(mL.serialization.string()))})});var z9=x(PS=>{"use strict";var Nrn=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]}),jrn=PS&&PS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Drn=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)&&Nrn(e,t,r);return jrn(e,t),e};Object.defineProperty(PS,"__esModule",{value:!0});PS.ChatSearchQuery=void 0;var Aue=Drn(J());PS.ChatSearchQuery=Aue.serialization.object({text:Aue.serialization.string(),generationId:Aue.serialization.property("generation_id",Aue.serialization.string())})});var HDe=x(TS=>{"use strict";var Lrn=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]}),Frn=TS&&TS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),krn=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)&&Lrn(e,t,r);return Frn(e,t),e};Object.defineProperty(TS,"__esModule",{value:!0});TS.ChatSearchResultConnector=void 0;var jkt=krn(J());TS.ChatSearchResultConnector=jkt.serialization.object({id:jkt.serialization.string()})});var Iue=x(AS=>{"use strict";var $rn=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]}),Brn=AS&&AS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zrn=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)&&$rn(e,t,r);return Brn(e,t),e};Object.defineProperty(AS,"__esModule",{value:!0});AS.ChatSearchResult=void 0;var yP=zrn(J()),Urn=z9(),qrn=HDe();AS.ChatSearchResult=yP.serialization.object({searchQuery:yP.serialization.property("search_query",Urn.ChatSearchQuery.optional()),connector:qrn.ChatSearchResultConnector,documentIds:yP.serialization.property("document_ids",yP.serialization.list(yP.serialization.string())),errorMessage:yP.serialization.property("error_message",yP.serialization.string().optional()),continueOnFailure:yP.serialization.property("continue_on_failure",yP.serialization.boolean().optional())})});var zq=x(IS=>{"use strict";var Hrn=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]}),Vrn=IS&&IS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wrn=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)&&Hrn(e,t,r);return Vrn(e,t),e};Object.defineProperty(IS,"__esModule",{value:!0});IS.FinishReason=void 0;var Krn=Wrn(J());IS.FinishReason=Krn.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var VDe=x(MS=>{"use strict";var Grn=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]}),Jrn=MS&&MS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zrn=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)&&Grn(e,t,r);return Jrn(e,t),e};Object.defineProperty(MS,"__esModule",{value:!0});MS.NonStreamedChatResponse=void 0;var zc=Zrn(J()),Yrn=Tue(),Xrn=nL(),Qrn=z9(),enn=Iue(),tnn=zq(),rnn=$q(),nnn=B9(),onn=Zh();MS.NonStreamedChatResponse=zc.serialization.object({text:zc.serialization.string(),generationId:zc.serialization.property("generation_id",zc.serialization.string().optional()),citations:zc.serialization.list(Yrn.ChatCitation).optional(),documents:zc.serialization.list(Xrn.ChatDocument).optional(),isSearchRequired:zc.serialization.property("is_search_required",zc.serialization.boolean().optional()),searchQueries:zc.serialization.property("search_queries",zc.serialization.list(Qrn.ChatSearchQuery).optional()),searchResults:zc.serialization.property("search_results",zc.serialization.list(enn.ChatSearchResult).optional()),finishReason:zc.serialization.property("finish_reason",tnn.FinishReason.optional()),toolCalls:zc.serialization.property("tool_calls",zc.serialization.list(rnn.ToolCall).optional()),chatHistory:zc.serialization.property("chat_history",zc.serialization.list(nnn.Message).optional()),prompt:zc.serialization.string().optional(),meta:onn.ApiMeta.optional()})});var NS=x(RS=>{"use strict";var inn=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]}),ann=RS&&RS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),snn=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)&&inn(e,t,r);return ann(e,t),e};Object.defineProperty(RS,"__esModule",{value:!0});RS.ChatStreamEvent=void 0;var unn=snn(J());RS.ChatStreamEvent=unn.serialization.object({})});var KDe=x(jS=>{"use strict";var lnn=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]}),cnn=jS&&jS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dnn=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)&&lnn(e,t,r);return cnn(e,t),e};Object.defineProperty(jS,"__esModule",{value:!0});jS.ChatStreamStartEvent=void 0;var WDe=dnn(J()),fnn=NS();jS.ChatStreamStartEvent=WDe.serialization.object({generationId:WDe.serialization.property("generation_id",WDe.serialization.string())}).extend(fnn.ChatStreamEvent)});var JDe=x(DS=>{"use strict";var pnn=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]}),mnn=DS&&DS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hnn=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)&&pnn(e,t,r);return mnn(e,t),e};Object.defineProperty(DS,"__esModule",{value:!0});DS.ChatSearchQueriesGenerationEvent=void 0;var GDe=hnn(J()),gnn=z9(),ynn=NS();DS.ChatSearchQueriesGenerationEvent=GDe.serialization.object({searchQueries:GDe.serialization.property("search_queries",GDe.serialization.list(gnn.ChatSearchQuery))}).extend(ynn.ChatStreamEvent)});var ZDe=x(LS=>{"use strict";var bnn=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]}),_nn=LS&&LS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vnn=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)&&bnn(e,t,r);return _nn(e,t),e};Object.defineProperty(LS,"__esModule",{value:!0});LS.ChatSearchResultsEvent=void 0;var Mue=vnn(J()),wnn=Iue(),xnn=nL(),Snn=NS();LS.ChatSearchResultsEvent=Mue.serialization.object({searchResults:Mue.serialization.property("search_results",Mue.serialization.list(wnn.ChatSearchResult).optional()),documents:Mue.serialization.list(xnn.ChatDocument).optional()}).extend(Snn.ChatStreamEvent)});var YDe=x(FS=>{"use strict";var Cnn=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]}),Onn=FS&&FS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Enn=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)&&Cnn(e,t,r);return Onn(e,t),e};Object.defineProperty(FS,"__esModule",{value:!0});FS.ChatTextGenerationEvent=void 0;var Dkt=Enn(J()),Pnn=NS();FS.ChatTextGenerationEvent=Dkt.serialization.object({text:Dkt.serialization.string()}).extend(Pnn.ChatStreamEvent)});var XDe=x(kS=>{"use strict";var Tnn=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]}),Ann=kS&&kS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Inn=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)&&Tnn(e,t,r);return Ann(e,t),e};Object.defineProperty(kS,"__esModule",{value:!0});kS.ChatCitationGenerationEvent=void 0;var Lkt=Inn(J()),Mnn=Tue(),Rnn=NS();kS.ChatCitationGenerationEvent=Lkt.serialization.object({citations:Lkt.serialization.list(Mnn.ChatCitation)}).extend(Rnn.ChatStreamEvent)});var QDe=x($S=>{"use strict";var Nnn=$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]}),jnn=$S&&$S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dnn=$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)&&Nnn(e,t,r);return jnn(e,t),e};Object.defineProperty($S,"__esModule",{value:!0});$S.ChatToolCallsGenerationEvent=void 0;var Rue=Dnn(J()),Lnn=$q(),Fnn=NS();$S.ChatToolCallsGenerationEvent=Rue.serialization.object({text:Rue.serialization.string().optional(),toolCalls:Rue.serialization.property("tool_calls",Rue.serialization.list(Lnn.ToolCall))}).extend(Fnn.ChatStreamEvent)});var eLe=x(BS=>{"use strict";var knn=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]}),$nn=BS&&BS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bnn=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)&&knn(e,t,r);return $nn(e,t),e};Object.defineProperty(BS,"__esModule",{value:!0});BS.ChatStreamEndEventFinishReason=void 0;var znn=Bnn(J());BS.ChatStreamEndEventFinishReason=znn.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var tLe=x(zS=>{"use strict";var Unn=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]}),qnn=zS&&zS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hnn=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)&&Unn(e,t,r);return qnn(e,t),e};Object.defineProperty(zS,"__esModule",{value:!0});zS.ChatStreamEndEvent=void 0;var Fkt=Hnn(J()),Vnn=eLe(),Wnn=VDe(),Knn=NS();zS.ChatStreamEndEvent=Fkt.serialization.object({finishReason:Fkt.serialization.property("finish_reason",Vnn.ChatStreamEndEventFinishReason),response:Wnn.NonStreamedChatResponse}).extend(Knn.ChatStreamEvent)});var rLe=x(US=>{"use strict";var Gnn=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]}),Jnn=US&&US.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Znn=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)&&Gnn(e,t,r);return Jnn(e,t),e};Object.defineProperty(US,"__esModule",{value:!0});US.ToolCallDelta=void 0;var U9=Znn(J());US.ToolCallDelta=U9.serialization.object({name:U9.serialization.string().optional(),index:U9.serialization.number().optional(),parameters:U9.serialization.string().optional(),text:U9.serialization.string().optional()})});var nLe=x(qS=>{"use strict";var Ynn=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]}),Xnn=qS&&qS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qnn=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)&&Ynn(e,t,r);return Xnn(e,t),e};Object.defineProperty(qS,"__esModule",{value:!0});qS.ChatToolCallsChunkEvent=void 0;var kkt=Qnn(J()),eon=rLe(),ton=NS();qS.ChatToolCallsChunkEvent=kkt.serialization.object({toolCallDelta:kkt.serialization.property("tool_call_delta",eon.ToolCallDelta)}).extend(ton.ChatStreamEvent)});var Bkt=x(HS=>{"use strict";var ron=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]}),non=HS&&HS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oon=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)&&ron(e,t,r);return non(e,t),e};Object.defineProperty(HS,"__esModule",{value:!0});HS.StreamedChatResponse=void 0;var $kt=oon(J()),ion=KDe(),aon=JDe(),son=ZDe(),uon=YDe(),lon=XDe(),con=QDe(),don=tLe(),fon=nLe();HS.StreamedChatResponse=$kt.serialization.union($kt.serialization.discriminant("eventType","event_type"),{"stream-start":ion.ChatStreamStartEvent,"search-queries-generation":aon.ChatSearchQueriesGenerationEvent,"search-results":son.ChatSearchResultsEvent,"text-generation":uon.ChatTextGenerationEvent,"citation-generation":lon.ChatCitationGenerationEvent,"tool-calls-generation":con.ChatToolCallsGenerationEvent,"stream-end":don.ChatStreamEndEvent,"tool-calls-chunk":fon.ChatToolCallsChunkEvent}).transform({transform:t=>t,untransform:t=>t})});var iLe=x(VS=>{"use strict";var pon=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]}),mon=VS&&VS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hon=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)&&pon(e,t,r);return mon(e,t),e};Object.defineProperty(VS,"__esModule",{value:!0});VS.SingleGenerationTokenLikelihoodsItem=void 0;var oLe=hon(J());VS.SingleGenerationTokenLikelihoodsItem=oLe.serialization.object({token:oLe.serialization.string(),likelihood:oLe.serialization.number()})});var aLe=x(WS=>{"use strict";var gon=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]}),yon=WS&&WS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bon=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)&&gon(e,t,r);return yon(e,t),e};Object.defineProperty(WS,"__esModule",{value:!0});WS.SingleGeneration=void 0;var hL=bon(J()),_on=iLe();WS.SingleGeneration=hL.serialization.object({id:hL.serialization.string(),text:hL.serialization.string(),index:hL.serialization.number().optional(),likelihood:hL.serialization.number().optional(),tokenLikelihoods:hL.serialization.property("token_likelihoods",hL.serialization.list(_on.SingleGenerationTokenLikelihoodsItem).optional())})});var zkt=x(KS=>{"use strict";var von=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]}),won=KS&&KS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xon=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)&&von(e,t,r);return won(e,t),e};Object.defineProperty(KS,"__esModule",{value:!0});KS.Generation=void 0;var Nue=xon(J()),Son=aLe(),Con=Zh();KS.Generation=Nue.serialization.object({id:Nue.serialization.string(),prompt:Nue.serialization.string().optional(),generations:Nue.serialization.list(Son.SingleGeneration),meta:Con.ApiMeta.optional()})});var q9=x(GS=>{"use strict";var Oon=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]}),Eon=GS&&GS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pon=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)&&Oon(e,t,r);return Eon(e,t),e};Object.defineProperty(GS,"__esModule",{value:!0});GS.GenerateStreamEvent=void 0;var Ton=Pon(J());GS.GenerateStreamEvent=Ton.serialization.object({})});var sLe=x(JS=>{"use strict";var Aon=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]}),Ion=JS&&JS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mon=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)&&Aon(e,t,r);return Ion(e,t),e};Object.defineProperty(JS,"__esModule",{value:!0});JS.GenerateStreamText=void 0;var H9=Mon(J()),Ron=q9();JS.GenerateStreamText=H9.serialization.object({text:H9.serialization.string(),index:H9.serialization.number().optional(),isFinished:H9.serialization.property("is_finished",H9.serialization.boolean())}).extend(Ron.GenerateStreamEvent)});var uLe=x(ZS=>{"use strict";var Non=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]}),jon=ZS&&ZS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Don=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)&&Non(e,t,r);return jon(e,t),e};Object.defineProperty(ZS,"__esModule",{value:!0});ZS.SingleGenerationInStream=void 0;var V9=Don(J()),Lon=zq();ZS.SingleGenerationInStream=V9.serialization.object({id:V9.serialization.string(),text:V9.serialization.string(),index:V9.serialization.number().optional(),finishReason:V9.serialization.property("finish_reason",Lon.FinishReason)})});var lLe=x(YS=>{"use strict";var Fon=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]}),kon=YS&&YS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$on=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)&&Fon(e,t,r);return kon(e,t),e};Object.defineProperty(YS,"__esModule",{value:!0});YS.GenerateStreamEndResponse=void 0;var jue=$on(J()),Bon=uLe();YS.GenerateStreamEndResponse=jue.serialization.object({id:jue.serialization.string(),prompt:jue.serialization.string().optional(),generations:jue.serialization.list(Bon.SingleGenerationInStream).optional()})});var cLe=x(XS=>{"use strict";var zon=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]}),Uon=XS&&XS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qon=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)&&zon(e,t,r);return Uon(e,t),e};Object.defineProperty(XS,"__esModule",{value:!0});XS.GenerateStreamEnd=void 0;var Due=qon(J()),Hon=zq(),Von=lLe(),Won=q9();XS.GenerateStreamEnd=Due.serialization.object({isFinished:Due.serialization.property("is_finished",Due.serialization.boolean()),finishReason:Due.serialization.property("finish_reason",Hon.FinishReason.optional()),response:Von.GenerateStreamEndResponse}).extend(Won.GenerateStreamEvent)});var dLe=x(QS=>{"use strict";var Kon=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]}),Gon=QS&&QS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jon=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)&&Kon(e,t,r);return Gon(e,t),e};Object.defineProperty(QS,"__esModule",{value:!0});QS.GenerateStreamError=void 0;var Uq=Jon(J()),Zon=zq(),Yon=q9();QS.GenerateStreamError=Uq.serialization.object({index:Uq.serialization.number().optional(),isFinished:Uq.serialization.property("is_finished",Uq.serialization.boolean()),finishReason:Uq.serialization.property("finish_reason",Zon.FinishReason),err:Uq.serialization.string()}).extend(Yon.GenerateStreamEvent)});var qkt=x(eC=>{"use strict";var Xon=eC&&eC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qon=eC&&eC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ein=eC&&eC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xon(e,t,r);return Qon(e,t),e};Object.defineProperty(eC,"__esModule",{value:!0});eC.GenerateStreamedResponse=void 0;var Ukt=ein(J()),tin=sLe(),rin=cLe(),nin=dLe();eC.GenerateStreamedResponse=Ukt.serialization.union(Ukt.serialization.discriminant("eventType","event_type"),{"text-generation":tin.GenerateStreamText,"stream-end":rin.GenerateStreamEnd,"stream-error":nin.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var fLe=x(tC=>{"use strict";var oin=tC&&tC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iin=tC&&tC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ain=tC&&tC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oin(e,t,r);return iin(e,t),e};Object.defineProperty(tC,"__esModule",{value:!0});tC.EmbedJobStatus=void 0;var sin=ain(J());tC.EmbedJobStatus=sin.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var pLe=x(rC=>{"use strict";var uin=rC&&rC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lin=rC&&rC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cin=rC&&rC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uin(e,t,r);return lin(e,t),e};Object.defineProperty(rC,"__esModule",{value:!0});rC.EmbedJobTruncate=void 0;var din=cin(J());rC.EmbedJobTruncate=din.serialization.enum_(["START","END"])});var mLe=x(nC=>{"use strict";var fin=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]}),pin=nC&&nC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),min=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)&&fin(e,t,r);return pin(e,t),e};Object.defineProperty(nC,"__esModule",{value:!0});nC.EmbedJob=void 0;var t_=min(J()),hin=fLe(),gin=pLe(),yin=Zh();nC.EmbedJob=t_.serialization.object({jobId:t_.serialization.property("job_id",t_.serialization.string()),name:t_.serialization.string().optional(),status:hin.EmbedJobStatus,createdAt:t_.serialization.property("created_at",t_.serialization.date()),inputDatasetId:t_.serialization.property("input_dataset_id",t_.serialization.string()),outputDatasetId:t_.serialization.property("output_dataset_id",t_.serialization.string().optional()),model:t_.serialization.string(),truncate:gin.EmbedJobTruncate,meta:yin.ApiMeta.optional()})});var Hkt=x(oC=>{"use strict";var bin=oC&&oC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_in=oC&&oC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vin=oC&&oC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bin(e,t,r);return _in(e,t),e};Object.defineProperty(oC,"__esModule",{value:!0});oC.ListEmbedJobResponse=void 0;var hLe=vin(J()),win=mLe();oC.ListEmbedJobResponse=hLe.serialization.object({embedJobs:hLe.serialization.property("embed_jobs",hLe.serialization.list(win.EmbedJob).optional())})});var Vkt=x(iC=>{"use strict";var xin=iC&&iC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Sin=iC&&iC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cin=iC&&iC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xin(e,t,r);return Sin(e,t),e};Object.defineProperty(iC,"__esModule",{value:!0});iC.CreateEmbedJobResponse=void 0;var gLe=Cin(J()),Oin=Zh();iC.CreateEmbedJobResponse=gLe.serialization.object({jobId:gLe.serialization.property("job_id",gLe.serialization.string()),meta:Oin.ApiMeta.optional()})});var bLe=x(aC=>{"use strict";var Ein=aC&&aC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pin=aC&&aC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tin=aC&&aC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ein(e,t,r);return Pin(e,t),e};Object.defineProperty(aC,"__esModule",{value:!0});aC.ClassifyExample=void 0;var yLe=Tin(J());aC.ClassifyExample=yLe.serialization.object({text:yLe.serialization.string().optional(),label:yLe.serialization.string().optional()})});var Wkt=x(sC=>{"use strict";var Ain=sC&&sC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Iin=sC&&sC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Min=sC&&sC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ain(e,t,r);return Iin(e,t),e};Object.defineProperty(sC,"__esModule",{value:!0});sC.ParseInfo=void 0;var _Le=Min(J());sC.ParseInfo=_Le.serialization.object({separator:_Le.serialization.string().optional(),delimiter:_Le.serialization.string().optional()})});var Kkt=x(uC=>{"use strict";var Rin=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]}),Nin=uC&&uC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jin=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)&&Rin(e,t,r);return Nin(e,t),e};Object.defineProperty(uC,"__esModule",{value:!0});uC.RerankerDataMetrics=void 0;var Yh=jin(J());uC.RerankerDataMetrics=Yh.serialization.object({numTrainQueries:Yh.serialization.property("num_train_queries",Yh.serialization.number().optional()),numTrainRelevantPassages:Yh.serialization.property("num_train_relevant_passages",Yh.serialization.number().optional()),numTrainHardNegatives:Yh.serialization.property("num_train_hard_negatives",Yh.serialization.number().optional()),numEvalQueries:Yh.serialization.property("num_eval_queries",Yh.serialization.number().optional()),numEvalRelevantPassages:Yh.serialization.property("num_eval_relevant_passages",Yh.serialization.number().optional()),numEvalHardNegatives:Yh.serialization.property("num_eval_hard_negatives",Yh.serialization.number().optional())})});var Gkt=x(lC=>{"use strict";var Din=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]}),Lin=lC&&lC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fin=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)&&Din(e,t,r);return Lin(e,t),e};Object.defineProperty(lC,"__esModule",{value:!0});lC.ChatDataMetrics=void 0;var qq=Fin(J());lC.ChatDataMetrics=qq.serialization.object({numTrainTurns:qq.serialization.property("num_train_turns",qq.serialization.number().optional()),numEvalTurns:qq.serialization.property("num_eval_turns",qq.serialization.number().optional()),preamble:qq.serialization.string().optional()})});var vLe=x(cC=>{"use strict";var kin=cC&&cC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$in=cC&&cC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bin=cC&&cC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kin(e,t,r);return $in(e,t),e};Object.defineProperty(cC,"__esModule",{value:!0});cC.LabelMetric=void 0;var Hq=Bin(J());cC.LabelMetric=Hq.serialization.object({totalExamples:Hq.serialization.property("total_examples",Hq.serialization.number().optional()),label:Hq.serialization.string().optional(),samples:Hq.serialization.list(Hq.serialization.string()).optional()})});var Jkt=x(dC=>{"use strict";var zin=dC&&dC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Uin=dC&&dC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qin=dC&&dC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zin(e,t,r);return Uin(e,t),e};Object.defineProperty(dC,"__esModule",{value:!0});dC.ClassifyDataMetrics=void 0;var wLe=qin(J()),Hin=vLe();dC.ClassifyDataMetrics=wLe.serialization.object({labelMetrics:wLe.serialization.property("label_metrics",wLe.serialization.list(Hin.LabelMetric).optional())})});var xLe=x(fC=>{"use strict";var Vin=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]}),Win=fC&&fC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kin=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)&&Vin(e,t,r);return Win(e,t),e};Object.defineProperty(fC,"__esModule",{value:!0});fC.FinetuneDatasetMetrics=void 0;var Xh=Kin(J());fC.FinetuneDatasetMetrics=Xh.serialization.object({trainableTokenCount:Xh.serialization.property("trainable_token_count",Xh.serialization.number().optional()),totalExamples:Xh.serialization.property("total_examples",Xh.serialization.number().optional()),trainExamples:Xh.serialization.property("train_examples",Xh.serialization.number().optional()),trainSizeBytes:Xh.serialization.property("train_size_bytes",Xh.serialization.number().optional()),evalExamples:Xh.serialization.property("eval_examples",Xh.serialization.number().optional()),evalSizeBytes:Xh.serialization.property("eval_size_bytes",Xh.serialization.number().optional())})});var CLe=x(pC=>{"use strict";var Gin=pC&&pC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jin=pC&&pC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zin=pC&&pC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gin(e,t,r);return Jin(e,t),e};Object.defineProperty(pC,"__esModule",{value:!0});pC.MetricsEmbedDataFieldsItem=void 0;var SLe=Zin(J());pC.MetricsEmbedDataFieldsItem=SLe.serialization.object({name:SLe.serialization.string().optional(),count:SLe.serialization.number().optional()})});var OLe=x(mC=>{"use strict";var Yin=mC&&mC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xin=mC&&mC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qin=mC&&mC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Yin(e,t,r);return Xin(e,t),e};Object.defineProperty(mC,"__esModule",{value:!0});mC.MetricsEmbedData=void 0;var Zkt=Qin(J()),ean=CLe();mC.MetricsEmbedData=Zkt.serialization.object({fields:Zkt.serialization.list(ean.MetricsEmbedDataFieldsItem).optional()})});var Ykt=x(hC=>{"use strict";var tan=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]}),ran=hC&&hC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nan=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)&&tan(e,t,r);return ran(e,t),e};Object.defineProperty(hC,"__esModule",{value:!0});hC.Metrics=void 0;var ELe=nan(J()),oan=xLe(),ian=OLe();hC.Metrics=ELe.serialization.object({finetuneDatasetMetrics:ELe.serialization.property("finetune_dataset_metrics",oan.FinetuneDatasetMetrics.optional()),embedData:ELe.serialization.property("embed_data",ian.MetricsEmbedData.optional())})});var PLe=x(yC=>{"use strict";var aan=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]}),san=yC&&yC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uan=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)&&aan(e,t,r);return san(e,t),e};Object.defineProperty(yC,"__esModule",{value:!0});yC.ConnectorOAuth=void 0;var gC=uan(J());yC.ConnectorOAuth=gC.serialization.object({clientId:gC.serialization.property("client_id",gC.serialization.string().optional()),clientSecret:gC.serialization.property("client_secret",gC.serialization.string().optional()),authorizeUrl:gC.serialization.property("authorize_url",gC.serialization.string()),tokenUrl:gC.serialization.property("token_url",gC.serialization.string()),scope:gC.serialization.string().optional()})});var TLe=x(bC=>{"use strict";var lan=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]}),can=bC&&bC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dan=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)&&lan(e,t,r);return can(e,t),e};Object.defineProperty(bC,"__esModule",{value:!0});bC.ConnectorAuthStatus=void 0;var fan=dan(J());bC.ConnectorAuthStatus=fan.serialization.enum_(["valid","expired"])});var Vq=x(_C=>{"use strict";var pan=_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]}),man=_C&&_C.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),han=_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)&&pan(e,t,r);return man(e,t),e};Object.defineProperty(_C,"__esModule",{value:!0});_C.Connector=void 0;var fc=han(J()),gan=PLe(),yan=TLe();_C.Connector=fc.serialization.object({id:fc.serialization.string(),organizationId:fc.serialization.property("organization_id",fc.serialization.string().optional()),name:fc.serialization.string(),description:fc.serialization.string().optional(),url:fc.serialization.string().optional(),createdAt:fc.serialization.property("created_at",fc.serialization.date()),updatedAt:fc.serialization.property("updated_at",fc.serialization.date()),excludes:fc.serialization.list(fc.serialization.string()).optional(),authType:fc.serialization.property("auth_type",fc.serialization.string().optional()),oauth:gan.ConnectorOAuth.optional(),authStatus:fc.serialization.property("auth_status",yan.ConnectorAuthStatus.optional()),active:fc.serialization.boolean().optional(),continueOnFailure:fc.serialization.property("continue_on_failure",fc.serialization.boolean().optional())})});var Xkt=x(vC=>{"use strict";var ban=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]}),_an=vC&&vC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),van=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)&&ban(e,t,r);return _an(e,t),e};Object.defineProperty(vC,"__esModule",{value:!0});vC.ListConnectorsResponse=void 0;var Lue=van(J()),wan=Vq();vC.ListConnectorsResponse=Lue.serialization.object({connectors:Lue.serialization.list(wan.Connector),totalCount:Lue.serialization.property("total_count",Lue.serialization.number().optional())})});var Qkt=x(wC=>{"use strict";var xan=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]}),San=wC&&wC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Can=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)&&xan(e,t,r);return San(e,t),e};Object.defineProperty(wC,"__esModule",{value:!0});wC.CreateConnectorResponse=void 0;var Oan=Can(J()),Ean=Vq();wC.CreateConnectorResponse=Oan.serialization.object({connector:Ean.Connector})});var e$t=x(xC=>{"use strict";var Pan=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]}),Tan=xC&&xC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Aan=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)&&Pan(e,t,r);return Tan(e,t),e};Object.defineProperty(xC,"__esModule",{value:!0});xC.GetConnectorResponse=void 0;var Ian=Aan(J()),Man=Vq();xC.GetConnectorResponse=Ian.serialization.object({connector:Man.Connector})});var t$t=x(SC=>{"use strict";var Ran=SC&&SC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Nan=SC&&SC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jan=SC&&SC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ran(e,t,r);return Nan(e,t),e};Object.defineProperty(SC,"__esModule",{value:!0});SC.DeleteConnectorResponse=void 0;var ALe=jan(J());SC.DeleteConnectorResponse=ALe.serialization.record(ALe.serialization.string(),ALe.serialization.unknown())});var r$t=x(CC=>{"use strict";var Dan=CC&&CC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lan=CC&&CC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fan=CC&&CC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Dan(e,t,r);return Lan(e,t),e};Object.defineProperty(CC,"__esModule",{value:!0});CC.UpdateConnectorResponse=void 0;var kan=Fan(J()),$an=Vq();CC.UpdateConnectorResponse=kan.serialization.object({connector:$an.Connector})});var n$t=x(OC=>{"use strict";var Ban=OC&&OC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zan=OC&&OC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uan=OC&&OC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ban(e,t,r);return zan(e,t),e};Object.defineProperty(OC,"__esModule",{value:!0});OC.OAuthAuthorizeResponse=void 0;var ILe=Uan(J());OC.OAuthAuthorizeResponse=ILe.serialization.object({redirectUrl:ILe.serialization.property("redirect_url",ILe.serialization.string().optional())})});var MLe=x(EC=>{"use strict";var qan=EC&&EC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Han=EC&&EC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Van=EC&&EC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qan(e,t,r);return Han(e,t),e};Object.defineProperty(EC,"__esModule",{value:!0});EC.CompatibleEndpoint=void 0;var Wan=Van(J());EC.CompatibleEndpoint=Wan.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var RLe=x(TC=>{"use strict";var Kan=TC&&TC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gan=TC&&TC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jan=TC&&TC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Kan(e,t,r);return Gan(e,t),e};Object.defineProperty(TC,"__esModule",{value:!0});TC.GetModelResponse=void 0;var PC=Jan(J()),o$t=MLe();TC.GetModelResponse=PC.serialization.object({name:PC.serialization.string().optional(),endpoints:PC.serialization.list(o$t.CompatibleEndpoint).optional(),finetuned:PC.serialization.boolean().optional(),contextLength:PC.serialization.property("context_length",PC.serialization.number().optional()),tokenizerUrl:PC.serialization.property("tokenizer_url",PC.serialization.string().optional()),defaultEndpoints:PC.serialization.property("default_endpoints",PC.serialization.list(o$t.CompatibleEndpoint).optional())})});var i$t=x(AC=>{"use strict";var Zan=AC&&AC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yan=AC&&AC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xan=AC&&AC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Zan(e,t,r);return Yan(e,t),e};Object.defineProperty(AC,"__esModule",{value:!0});AC.ListModelsResponse=void 0;var Fue=Xan(J()),Qan=RLe();AC.ListModelsResponse=Fue.serialization.object({models:Fue.serialization.list(Qan.GetModelResponse),nextPageToken:Fue.serialization.property("next_page_token",Fue.serialization.string().optional())})});var a$t=x(ve=>{"use strict";var esn=ve&&ve.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ee=ve&&ve.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&esn(e,t,r)};Object.defineProperty(ve,"__esModule",{value:!0});Ee(aDe(),ve);Ee(sDe(),ve);Ee(lkt(),ve);Ee(uDe(),ve);Ee(dkt(),ve);Ee(pkt(),ve);Ee(hkt(),ve);Ee(ykt(),ve);Ee(_kt(),ve);Ee(lDe(),ve);Ee(cDe(),ve);Ee(wkt(),ve);Ee(dDe(),ve);Ee(fDe(),ve);Ee(pDe(),ve);Ee(mDe(),ve);Ee(hDe(),ve);Ee(gDe(),ve);Ee(Skt(),ve);Ee(ODe(),ve);Ee(EDe(),ve);Ee(PDe(),ve);Ee(Ekt(),ve);Ee(ADe(),ve);Ee(IDe(),ve);Ee(MDe(),ve);Ee(RDe(),ve);Ee(Tkt(),ve);Ee(jDe(),ve);Ee(DDe(),ve);Ee(LDe(),ve);Ee(Akt(),ve);Ee(Ikt(),ve);Ee(Rkt(),ve);Ee(Nkt(),ve);Ee($q(),ve);Ee(kDe(),ve);Ee($9(),ve);Ee(BDe(),ve);Ee(B9(),ve);Ee(Sue(),ve);Ee(nL(),ve);Ee(UDe(),ve);Ee(Oue(),ve);Ee(lue(),ve);Ee(qDe(),ve);Ee(Pue(),ve);Ee(Tue(),ve);Ee(z9(),ve);Ee(HDe(),ve);Ee(Iue(),ve);Ee(zq(),ve);Ee(yDe(),ve);Ee(bDe(),ve);Ee(_De(),ve);Ee(Zh(),ve);Ee(VDe(),ve);Ee(NS(),ve);Ee(KDe(),ve);Ee(JDe(),ve);Ee(ZDe(),ve);Ee(YDe(),ve);Ee(XDe(),ve);Ee(QDe(),ve);Ee(eLe(),ve);Ee(tLe(),ve);Ee(rLe(),ve);Ee(nLe(),ve);Ee(Bkt(),ve);Ee(Fje(),ve);Ee(cue(),ve);Ee(Rje(),ve);Ee(Nje(),ve);Ee(jje(),ve);Ee(Dje(),ve);Ee(iLe(),ve);Ee(aLe(),ve);Ee(zkt(),ve);Ee(q9(),ve);Ee(sLe(),ve);Ee(uLe(),ve);Ee(lLe(),ve);Ee(cLe(),ve);Ee(dLe(),ve);Ee(qkt(),ve);Ee(due(),ve);Ee(fue(),ve);Ee(vDe(),ve);Ee(wDe(),ve);Ee(xDe(),ve);Ee(fLe(),ve);Ee(pLe(),ve);Ee(mLe(),ve);Ee(Hkt(),ve);Ee(Vkt(),ve);Ee(CDe(),ve);Ee(bLe(),ve);Ee(qje(),ve);Ee(Uje(),ve);Ee(Hje(),ve);Ee(Wkt(),ve);Ee(Kkt(),ve);Ee(Gkt(),ve);Ee(vLe(),ve);Ee(Jkt(),ve);Ee(xLe(),ve);Ee(CLe(),ve);Ee(OLe(),ve);Ee(Ykt(),ve);Ee(mue(),ve);Ee(PLe(),ve);Ee(TLe(),ve);Ee(Vq(),ve);Ee(Xkt(),ve);Ee(bue(),ve);Ee(oDe(),ve);Ee(_ue(),ve);Ee(Qkt(),ve);Ee(e$t(),ve);Ee(t$t(),ve);Ee(r$t(),ve);Ee(n$t(),ve);Ee(MLe(),ve);Ee(RLe(),ve);Ee(i$t(),ve)});var s$t=x(IC=>{"use strict";var tsn=IC&&IC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rsn=IC&&IC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nsn=IC&&IC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tsn(e,t,r);return rsn(e,t),e};Object.defineProperty(IC,"__esModule",{value:!0});IC.ChatStreamRequest=void 0;var Rn=nsn(J()),osn=B9(),isn=aDe(),asn=Sue(),ssn=nL(),usn=sDe(),lsn=Oue(),csn=$9(),dsn=Pue(),fsn=uDe();IC.ChatStreamRequest=Rn.serialization.object({message:Rn.serialization.string(),model:Rn.serialization.string().optional(),preamble:Rn.serialization.string().optional(),chatHistory:Rn.serialization.property("chat_history",Rn.serialization.list(osn.Message).optional()),conversationId:Rn.serialization.property("conversation_id",Rn.serialization.string().optional()),promptTruncation:Rn.serialization.property("prompt_truncation",isn.ChatStreamRequestPromptTruncation.optional()),connectors:Rn.serialization.list(asn.ChatConnector).optional(),searchQueriesOnly:Rn.serialization.property("search_queries_only",Rn.serialization.boolean().optional()),documents:Rn.serialization.list(ssn.ChatDocument).optional(),citationQuality:Rn.serialization.property("citation_quality",usn.ChatStreamRequestCitationQuality.optional()),temperature:Rn.serialization.number().optional(),maxTokens:Rn.serialization.property("max_tokens",Rn.serialization.number().optional()),maxInputTokens:Rn.serialization.property("max_input_tokens",Rn.serialization.number().optional()),k:Rn.serialization.number().optional(),p:Rn.serialization.number().optional(),seed:Rn.serialization.number().optional(),stopSequences:Rn.serialization.property("stop_sequences",Rn.serialization.list(Rn.serialization.string()).optional()),frequencyPenalty:Rn.serialization.property("frequency_penalty",Rn.serialization.number().optional()),presencePenalty:Rn.serialization.property("presence_penalty",Rn.serialization.number().optional()),rawPrompting:Rn.serialization.property("raw_prompting",Rn.serialization.boolean().optional()),returnPrompt:Rn.serialization.property("return_prompt",Rn.serialization.boolean().optional()),tools:Rn.serialization.list(lsn.Tool).optional(),toolResults:Rn.serialization.property("tool_results",Rn.serialization.list(csn.ToolResult).optional()),forceSingleStep:Rn.serialization.property("force_single_step",Rn.serialization.boolean().optional()),responseFormat:Rn.serialization.property("response_format",dsn.ResponseFormat.optional()),safetyMode:Rn.serialization.property("safety_mode",fsn.ChatStreamRequestSafetyMode.optional())})});var u$t=x(MC=>{"use strict";var psn=MC&&MC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),msn=MC&&MC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hsn=MC&&MC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&psn(e,t,r);return msn(e,t),e};Object.defineProperty(MC,"__esModule",{value:!0});MC.ChatRequest=void 0;var Nn=hsn(J()),gsn=B9(),ysn=lDe(),bsn=Sue(),_sn=nL(),vsn=cDe(),wsn=Oue(),xsn=$9(),Ssn=Pue(),Csn=dDe();MC.ChatRequest=Nn.serialization.object({message:Nn.serialization.string(),model:Nn.serialization.string().optional(),preamble:Nn.serialization.string().optional(),chatHistory:Nn.serialization.property("chat_history",Nn.serialization.list(gsn.Message).optional()),conversationId:Nn.serialization.property("conversation_id",Nn.serialization.string().optional()),promptTruncation:Nn.serialization.property("prompt_truncation",ysn.ChatRequestPromptTruncation.optional()),connectors:Nn.serialization.list(bsn.ChatConnector).optional(),searchQueriesOnly:Nn.serialization.property("search_queries_only",Nn.serialization.boolean().optional()),documents:Nn.serialization.list(_sn.ChatDocument).optional(),citationQuality:Nn.serialization.property("citation_quality",vsn.ChatRequestCitationQuality.optional()),temperature:Nn.serialization.number().optional(),maxTokens:Nn.serialization.property("max_tokens",Nn.serialization.number().optional()),maxInputTokens:Nn.serialization.property("max_input_tokens",Nn.serialization.number().optional()),k:Nn.serialization.number().optional(),p:Nn.serialization.number().optional(),seed:Nn.serialization.number().optional(),stopSequences:Nn.serialization.property("stop_sequences",Nn.serialization.list(Nn.serialization.string()).optional()),frequencyPenalty:Nn.serialization.property("frequency_penalty",Nn.serialization.number().optional()),presencePenalty:Nn.serialization.property("presence_penalty",Nn.serialization.number().optional()),rawPrompting:Nn.serialization.property("raw_prompting",Nn.serialization.boolean().optional()),returnPrompt:Nn.serialization.property("return_prompt",Nn.serialization.boolean().optional()),tools:Nn.serialization.list(wsn.Tool).optional(),toolResults:Nn.serialization.property("tool_results",Nn.serialization.list(xsn.ToolResult).optional()),forceSingleStep:Nn.serialization.property("force_single_step",Nn.serialization.boolean().optional()),responseFormat:Nn.serialization.property("response_format",Ssn.ResponseFormat.optional()),safetyMode:Nn.serialization.property("safety_mode",Csn.ChatRequestSafetyMode.optional())})});var l$t=x(RC=>{"use strict";var Osn=RC&&RC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Esn=RC&&RC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Psn=RC&&RC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Osn(e,t,r);return Esn(e,t),e};Object.defineProperty(RC,"__esModule",{value:!0});RC.GenerateStreamRequest=void 0;var Ea=Psn(J()),Tsn=fDe(),Asn=pDe();RC.GenerateStreamRequest=Ea.serialization.object({prompt:Ea.serialization.string(),model:Ea.serialization.string().optional(),numGenerations:Ea.serialization.property("num_generations",Ea.serialization.number().optional()),maxTokens:Ea.serialization.property("max_tokens",Ea.serialization.number().optional()),truncate:Tsn.GenerateStreamRequestTruncate.optional(),temperature:Ea.serialization.number().optional(),seed:Ea.serialization.number().optional(),preset:Ea.serialization.string().optional(),endSequences:Ea.serialization.property("end_sequences",Ea.serialization.list(Ea.serialization.string()).optional()),stopSequences:Ea.serialization.property("stop_sequences",Ea.serialization.list(Ea.serialization.string()).optional()),k:Ea.serialization.number().optional(),p:Ea.serialization.number().optional(),frequencyPenalty:Ea.serialization.property("frequency_penalty",Ea.serialization.number().optional()),presencePenalty:Ea.serialization.property("presence_penalty",Ea.serialization.number().optional()),returnLikelihoods:Ea.serialization.property("return_likelihoods",Asn.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:Ea.serialization.property("raw_prompting",Ea.serialization.boolean().optional())})});var c$t=x(NC=>{"use strict";var Isn=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]}),Msn=NC&&NC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rsn=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)&&Isn(e,t,r);return Msn(e,t),e};Object.defineProperty(NC,"__esModule",{value:!0});NC.GenerateRequest=void 0;var Pa=Rsn(J()),Nsn=mDe(),jsn=hDe();NC.GenerateRequest=Pa.serialization.object({prompt:Pa.serialization.string(),model:Pa.serialization.string().optional(),numGenerations:Pa.serialization.property("num_generations",Pa.serialization.number().optional()),maxTokens:Pa.serialization.property("max_tokens",Pa.serialization.number().optional()),truncate:Nsn.GenerateRequestTruncate.optional(),temperature:Pa.serialization.number().optional(),seed:Pa.serialization.number().optional(),preset:Pa.serialization.string().optional(),endSequences:Pa.serialization.property("end_sequences",Pa.serialization.list(Pa.serialization.string()).optional()),stopSequences:Pa.serialization.property("stop_sequences",Pa.serialization.list(Pa.serialization.string()).optional()),k:Pa.serialization.number().optional(),p:Pa.serialization.number().optional(),frequencyPenalty:Pa.serialization.property("frequency_penalty",Pa.serialization.number().optional()),presencePenalty:Pa.serialization.property("presence_penalty",Pa.serialization.number().optional()),returnLikelihoods:Pa.serialization.property("return_likelihoods",jsn.GenerateRequestReturnLikelihoods.optional()),rawPrompting:Pa.serialization.property("raw_prompting",Pa.serialization.boolean().optional())})});var d$t=x(jC=>{"use strict";var Dsn=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]}),Lsn=jC&&jC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fsn=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)&&Dsn(e,t,r);return Lsn(e,t),e};Object.defineProperty(jC,"__esModule",{value:!0});jC.EmbedRequest=void 0;var gL=Fsn(J()),ksn=due(),$sn=fue(),Bsn=gDe();jC.EmbedRequest=gL.serialization.object({texts:gL.serialization.list(gL.serialization.string()),model:gL.serialization.string().optional(),inputType:gL.serialization.property("input_type",ksn.EmbedInputType.optional()),embeddingTypes:gL.serialization.property("embedding_types",gL.serialization.list($sn.EmbeddingType).optional()),truncate:Bsn.EmbedRequestTruncate.optional()})});var f$t=x(DC=>{"use strict";var zsn=DC&&DC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Usn=DC&&DC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qsn=DC&&DC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zsn(e,t,r);return Usn(e,t),e};Object.defineProperty(DC,"__esModule",{value:!0});DC.RerankRequest=void 0;var Qh=qsn(J()),Hsn=ODe();DC.RerankRequest=Qh.serialization.object({model:Qh.serialization.string().optional(),query:Qh.serialization.string(),documents:Qh.serialization.list(Hsn.RerankRequestDocumentsItem),topN:Qh.serialization.property("top_n",Qh.serialization.number().optional()),rankFields:Qh.serialization.property("rank_fields",Qh.serialization.list(Qh.serialization.string()).optional()),returnDocuments:Qh.serialization.property("return_documents",Qh.serialization.boolean().optional()),maxChunksPerDoc:Qh.serialization.property("max_chunks_per_doc",Qh.serialization.number().optional())})});var p$t=x(LC=>{"use strict";var Vsn=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]}),Wsn=LC&&LC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ksn=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)&&Vsn(e,t,r);return Wsn(e,t),e};Object.defineProperty(LC,"__esModule",{value:!0});LC.ClassifyRequest=void 0;var Wq=Ksn(J()),Gsn=bLe(),Jsn=ADe();LC.ClassifyRequest=Wq.serialization.object({inputs:Wq.serialization.list(Wq.serialization.string()),examples:Wq.serialization.list(Gsn.ClassifyExample).optional(),model:Wq.serialization.string().optional(),preset:Wq.serialization.string().optional(),truncate:Jsn.ClassifyRequestTruncate.optional()})});var m$t=x(FC=>{"use strict";var Zsn=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]}),Ysn=FC&&FC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xsn=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)&&Zsn(e,t,r);return Ysn(e,t),e};Object.defineProperty(FC,"__esModule",{value:!0});FC.SummarizeRequest=void 0;var Kq=Xsn(J()),Qsn=jDe(),eun=DDe(),tun=LDe();FC.SummarizeRequest=Kq.serialization.object({text:Kq.serialization.string(),length:Qsn.SummarizeRequestLength.optional(),format:eun.SummarizeRequestFormat.optional(),model:Kq.serialization.string().optional(),extractiveness:tun.SummarizeRequestExtractiveness.optional(),temperature:Kq.serialization.number().optional(),additionalCommand:Kq.serialization.property("additional_command",Kq.serialization.string().optional())})});var h$t=x(kC=>{"use strict";var run=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]}),nun=kC&&kC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oun=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)&&run(e,t,r);return nun(e,t),e};Object.defineProperty(kC,"__esModule",{value:!0});kC.TokenizeRequest=void 0;var NLe=oun(J());kC.TokenizeRequest=NLe.serialization.object({text:NLe.serialization.string(),model:NLe.serialization.string()})});var g$t=x($C=>{"use strict";var iun=$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]}),aun=$C&&$C.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sun=$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)&&iun(e,t,r);return aun(e,t),e};Object.defineProperty($C,"__esModule",{value:!0});$C.DetokenizeRequest=void 0;var kue=sun(J());$C.DetokenizeRequest=kue.serialization.object({tokens:kue.serialization.list(kue.serialization.number()),model:kue.serialization.string()})});var y$t=x(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.DetokenizeRequest=js.TokenizeRequest=js.SummarizeRequest=js.ClassifyRequest=js.RerankRequest=js.EmbedRequest=js.GenerateRequest=js.GenerateStreamRequest=js.ChatRequest=js.ChatStreamRequest=void 0;var uun=s$t();Object.defineProperty(js,"ChatStreamRequest",{enumerable:!0,get:function(){return uun.ChatStreamRequest}});var lun=u$t();Object.defineProperty(js,"ChatRequest",{enumerable:!0,get:function(){return lun.ChatRequest}});var cun=l$t();Object.defineProperty(js,"GenerateStreamRequest",{enumerable:!0,get:function(){return cun.GenerateStreamRequest}});var dun=c$t();Object.defineProperty(js,"GenerateRequest",{enumerable:!0,get:function(){return dun.GenerateRequest}});var fun=d$t();Object.defineProperty(js,"EmbedRequest",{enumerable:!0,get:function(){return fun.EmbedRequest}});var pun=f$t();Object.defineProperty(js,"RerankRequest",{enumerable:!0,get:function(){return pun.RerankRequest}});var mun=p$t();Object.defineProperty(js,"ClassifyRequest",{enumerable:!0,get:function(){return mun.ClassifyRequest}});var hun=m$t();Object.defineProperty(js,"SummarizeRequest",{enumerable:!0,get:function(){return hun.SummarizeRequest}});var gun=h$t();Object.defineProperty(js,"TokenizeRequest",{enumerable:!0,get:function(){return gun.TokenizeRequest}});var yun=g$t();Object.defineProperty(js,"DetokenizeRequest",{enumerable:!0,get:function(){return yun.DetokenizeRequest}})});var b$t=x(yL=>{"use strict";var bun=yL&&yL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_un=yL&&yL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bun(e,t,r)};Object.defineProperty(yL,"__esModule",{value:!0});_un(y$t(),yL)});var _P=x(bP=>{"use strict";var vun=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]}),jLe=bP&&bP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vun(e,t,r)};Object.defineProperty(bP,"__esModule",{value:!0});jLe(skt(),bP);jLe(a$t(),bP);jLe(b$t(),bP)});var DLe=x(vi=>{"use strict";var wun=vi&&vi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xun=vi&&vi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sun=vi&&vi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wun(e,t,r);return xun(e,t),e},$ue=vi&&vi.__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())})},Cun=vi&&vi.__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(vi,"__esModule",{value:!0});vi.fetchOverride=vi.parseAWSEvent=vi.getEndpointFromUrl=vi.getAuthHeaders=vi.getUrl=vi.mapResponseFromBedrock=void 0;var Oun=wPe(),Eun=(cPt(),Mc(lPt)),Pun=gAt(),Tun=MIt(),Aun=XW(),Iun=J(),Mun=Z1e(),Run=JLt(),W9=Sun(_P()),Nun=(t,e)=>$ue(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),jun={chat:W9.StreamedChatResponse,generate:W9.GenerateStreamedResponse},Dun={chat:W9.NonStreamedChatResponse,embed:W9.EmbedResponse,generate:W9.Generation},Lun=(t,e,r)=>$ue(void 0,void 0,void 0,function*(){let n=t?jun[e]:Dun[e],o={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},i=yield n.parseOrThrow(r,o);return n.jsonOrThrow(i,o)});vi.mapResponseFromBedrock=Lun;var Fun=(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]};vi.getUrl=Fun;var kun=(t,e,r,n,o,i)=>$ue(void 0,void 0,void 0,function*(){let a=(0,Eun.fromNodeProviderChain)(),s=yield Nun(()=>{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 Tun.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:Oun.Sha256});delete r.connection,r.host=t.hostname;let l=new Pun.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});vi.getAuthHeaders=kun;var $un=(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}`)};vi.getEndpointFromUrl=$un;var zun=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}}};vi.parseAWSEvent=zun;var Uun=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>$ue(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,vi.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,vi.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,Iun.fetcher)(i);if(!p.ok)return p;try{if(c){let g=(0,Mun.readableStreamAsyncIterable)(p.body),y=new Run.LineDecoder,_=new Aun.PassThrough;try{for(var h=Cun(g),m;m=yield h.next(),!m.done;){let w=m.value;for(let S of y.decode(w)){let C=(0,vi.parseAWSEvent)(S);if(C){let E=yield(0,vi.mapResponseFromBedrock)(c,u,C);_.push(JSON.stringify(E)+`
`)}}}}catch(w){a={error:w}}finally{try{m&&!m.done&&(s=h.return)&&(yield s.call(h))}finally{if(a)throw a.error}}for(let w of y.flush()){let S=(0,vi.parseAWSEvent)(w);if(S){let C=yield(0,vi.mapResponseFromBedrock)(c,u,S);_.push(JSON.stringify(C)+`
`)}}return _.end(),{ok:!0,body:_}}else{let g=yield p.body;return{ok:!0,body:yield(0,vi.mapResponseFromBedrock)(c,u,g)}}}catch(g){throw g}});vi.fetchOverride=Uun});var vP=x(Bue=>{"use strict";Object.defineProperty(Bue,"__esModule",{value:!0});Bue.CohereEnvironment=void 0;Bue.CohereEnvironment={Production:"https://api.cohere.com"}});var NM=x((_$t,zue)=>{(function(t,e,r){typeof zue<"u"&&zue.exports?zue.exports=r():typeof define=="function"&&define.amd?define(r):e[t]=r()})("urljoin",_$t,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 FLe=x(Hm=>{"use strict";var qun=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]}),Hun=Hm&&Hm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K9=Hm&&Hm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qun(e,t,r);return Hun(e,t),e},Uue=Hm&&Hm.__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())})},Vun=Hm&&Hm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Hm,"__esModule",{value:!0});Hm.V2=void 0;var v$t=K9(vP()),Um=K9(J()),Ds=K9(HE()),qm=K9(_P()),w$t=Vun(NM()),wP=K9(ru()),LLe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return Uue(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Um.fetcher)({url:(0,w$t.default)((o=yield Um.Supplier.get(this._options.environment))!==null&&o!==void 0?o:v$t.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Um.Supplier.get(this._options.clientName))!=null?yield Um.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":Um.RUNTIME.type,"X-Fern-Runtime-Version":Um.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},qm.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 Um.Stream({stream:i.body,parse:a=>Uue(this,void 0,void 0,function*(){return qm.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 Ds.BadRequestError(i.error.body);case 401:throw new Ds.UnauthorizedError(i.error.body);case 403:throw new Ds.ForbiddenError(i.error.body);case 404:throw new Ds.NotFoundError(i.error.body);case 422:throw new Ds.UnprocessableEntityError(qm.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ds.TooManyRequestsError(qm.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ds.ClientClosedRequestError(qm.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ds.InternalServerError(i.error.body);case 501:throw new Ds.NotImplementedError(qm.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ds.ServiceUnavailableError(i.error.body);case 504:throw new Ds.GatewayTimeoutError(qm.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new wP.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new wP.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new wP.CohereTimeoutError;case"unknown":throw new wP.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return Uue(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Um.fetcher)({url:(0,w$t.default)((o=yield Um.Supplier.get(this._options.environment))!==null&&o!==void 0?o:v$t.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Um.Supplier.get(this._options.clientName))!=null?yield Um.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":Um.RUNTIME.type,"X-Fern-Runtime-Version":Um.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},qm.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 qm.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 Ds.BadRequestError(i.error.body);case 401:throw new Ds.UnauthorizedError(i.error.body);case 403:throw new Ds.ForbiddenError(i.error.body);case 404:throw new Ds.NotFoundError(i.error.body);case 422:throw new Ds.UnprocessableEntityError(qm.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ds.TooManyRequestsError(qm.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ds.ClientClosedRequestError(qm.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ds.InternalServerError(i.error.body);case 501:throw new Ds.NotImplementedError(qm.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ds.ServiceUnavailableError(i.error.body);case 504:throw new Ds.GatewayTimeoutError(qm.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new wP.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new wP.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new wP.CohereTimeoutError;case"unknown":throw new wP.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return Uue(this,void 0,void 0,function*(){let r=(e=yield Um.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new wP.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Hm.V2=LLe});var x$t=x(Vm=>{"use strict";var Wun=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]}),Kun=Vm&&Vm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J9=Vm&&Vm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Wun(e,t,r);return Kun(e,t),e},G9=Vm&&Vm.__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())})},Gun=Vm&&Vm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Vm,"__esModule",{value:!0});Vm.EmbedJobs=void 0;var que=J9(vP()),Ta=J9(J()),rn=J9(HE()),Hue=Gun(NM()),Va=J9(_P()),Fd=J9(ru()),kLe=class{constructor(e={}){this._options=e}list(e){var r,n;return G9(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Ta.fetcher)({url:(0,Hue.default)((n=yield Ta.Supplier.get(this._options.environment))!==null&&n!==void 0?n:que.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ta.Supplier.get(this._options.clientName))!=null?yield Ta.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":Ta.RUNTIME.type,"X-Fern-Runtime-Version":Ta.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 Va.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 rn.BadRequestError(o.error.body);case 401:throw new rn.UnauthorizedError(o.error.body);case 403:throw new rn.ForbiddenError(o.error.body);case 404:throw new rn.NotFoundError(o.error.body);case 422:throw new rn.UnprocessableEntityError(Va.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rn.TooManyRequestsError(Va.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rn.ClientClosedRequestError(Va.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rn.InternalServerError(o.error.body);case 501:throw new rn.NotImplementedError(Va.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rn.ServiceUnavailableError(o.error.body);case 504:throw new rn.GatewayTimeoutError(Va.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Fd.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Fd.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Fd.CohereTimeoutError;case"unknown":throw new Fd.CohereError({message:o.error.errorMessage})}})}create(e,r){var n,o;return G9(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ta.fetcher)({url:(0,Hue.default)((o=yield Ta.Supplier.get(this._options.environment))!==null&&o!==void 0?o:que.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ta.Supplier.get(this._options.clientName))!=null?yield Ta.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":Ta.RUNTIME.type,"X-Fern-Runtime-Version":Ta.RUNTIME.version},contentType:"application/json",requestType:"json",body:Va.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 Va.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 rn.BadRequestError(i.error.body);case 401:throw new rn.UnauthorizedError(i.error.body);case 403:throw new rn.ForbiddenError(i.error.body);case 404:throw new rn.NotFoundError(i.error.body);case 422:throw new rn.UnprocessableEntityError(Va.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rn.TooManyRequestsError(Va.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rn.ClientClosedRequestError(Va.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rn.InternalServerError(i.error.body);case 501:throw new rn.NotImplementedError(Va.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rn.ServiceUnavailableError(i.error.body);case 504:throw new rn.GatewayTimeoutError(Va.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Fd.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Fd.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Fd.CohereTimeoutError;case"unknown":throw new Fd.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return G9(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ta.fetcher)({url:(0,Hue.default)((o=yield Ta.Supplier.get(this._options.environment))!==null&&o!==void 0?o:que.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ta.Supplier.get(this._options.clientName))!=null?yield Ta.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":Ta.RUNTIME.type,"X-Fern-Runtime-Version":Ta.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 Va.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 rn.BadRequestError(i.error.body);case 401:throw new rn.UnauthorizedError(i.error.body);case 403:throw new rn.ForbiddenError(i.error.body);case 404:throw new rn.NotFoundError(i.error.body);case 422:throw new rn.UnprocessableEntityError(Va.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rn.TooManyRequestsError(Va.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rn.ClientClosedRequestError(Va.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rn.InternalServerError(i.error.body);case 501:throw new rn.NotImplementedError(Va.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rn.ServiceUnavailableError(i.error.body);case 504:throw new rn.GatewayTimeoutError(Va.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Fd.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Fd.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Fd.CohereTimeoutError;case"unknown":throw new Fd.CohereError({message:i.error.errorMessage})}})}cancel(e,r){var n,o;return G9(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ta.fetcher)({url:(0,Hue.default)((o=yield Ta.Supplier.get(this._options.environment))!==null&&o!==void 0?o:que.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}/cancel`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ta.Supplier.get(this._options.clientName))!=null?yield Ta.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":Ta.RUNTIME.type,"X-Fern-Runtime-Version":Ta.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 rn.BadRequestError(i.error.body);case 401:throw new rn.UnauthorizedError(i.error.body);case 403:throw new rn.ForbiddenError(i.error.body);case 404:throw new rn.NotFoundError(i.error.body);case 422:throw new rn.UnprocessableEntityError(Va.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rn.TooManyRequestsError(Va.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rn.ClientClosedRequestError(Va.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rn.InternalServerError(i.error.body);case 501:throw new rn.NotImplementedError(Va.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rn.ServiceUnavailableError(i.error.body);case 504:throw new rn.GatewayTimeoutError(Va.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Fd.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Fd.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Fd.CohereTimeoutError;case"unknown":throw new Fd.CohereError({message:i.error.errorMessage})}}})}_getAuthorizationHeader(){var e;return G9(this,void 0,void 0,function*(){let r=(e=yield Ta.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Fd.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Vm.EmbedJobs=kLe});var S$t=x(Wm=>{"use strict";var Jun=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]}),Zun=Wm&&Wm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X9=Wm&&Wm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Jun(e,t,r);return Zun(e,t),e},Gq=Wm&&Wm.__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())})},Yun=Wm&&Wm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Wm,"__esModule",{value:!0});Wm.Datasets=void 0;var Z9=X9(vP()),zo=X9(J()),pr=X9(HE()),Y9=Yun(NM()),Ai=X9(_P()),su=X9(ru()),$Le=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return Gq(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:zo.fetcher)({url:(0,Y9.default)((o=yield zo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Z9.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zo.Supplier.get(this._options.clientName))!=null?yield zo.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":zo.RUNTIME.type,"X-Fern-Runtime-Version":zo.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 Ai.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 pr.BadRequestError(f.error.body);case 401:throw new pr.UnauthorizedError(f.error.body);case 403:throw new pr.ForbiddenError(f.error.body);case 404:throw new pr.NotFoundError(f.error.body);case 422:throw new pr.UnprocessableEntityError(Ai.UnprocessableEntityErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new pr.TooManyRequestsError(Ai.TooManyRequestsErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new pr.ClientClosedRequestError(Ai.ClientClosedRequestErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new pr.InternalServerError(f.error.body);case 501:throw new pr.NotImplementedError(Ai.NotImplementedErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new pr.ServiceUnavailableError(f.error.body);case 504:throw new pr.GatewayTimeoutError(Ai.GatewayTimeoutErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new su.CohereError({statusCode:f.error.statusCode,body:f.error.body})}switch(f.error.reason){case"non-json":throw new su.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody});case"timeout":throw new su.CohereTimeoutError;case"unknown":throw new su.CohereError({message:f.error.errorMessage})}})}create(e,r,n,o){var i,a;return Gq(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 zo.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:zo.fetcher)({url:(0,Y9.default)((a=yield zo.Supplier.get(this._options.environment))!==null&&a!==void 0?a:Z9.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zo.Supplier.get(this._options.clientName))!=null?yield zo.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":zo.RUNTIME.type,"X-Fern-Runtime-Version":zo.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 Ai.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 pr.BadRequestError(c.error.body);case 401:throw new pr.UnauthorizedError(c.error.body);case 403:throw new pr.ForbiddenError(c.error.body);case 404:throw new pr.NotFoundError(c.error.body);case 422:throw new pr.UnprocessableEntityError(Ai.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new pr.TooManyRequestsError(Ai.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new pr.ClientClosedRequestError(Ai.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new pr.InternalServerError(c.error.body);case 501:throw new pr.NotImplementedError(Ai.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new pr.ServiceUnavailableError(c.error.body);case 504:throw new pr.GatewayTimeoutError(Ai.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new su.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new su.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new su.CohereTimeoutError;case"unknown":throw new su.CohereError({message:c.error.errorMessage})}})}getUsage(e){var r,n;return Gq(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:zo.fetcher)({url:(0,Y9.default)((n=yield zo.Supplier.get(this._options.environment))!==null&&n!==void 0?n:Z9.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zo.Supplier.get(this._options.clientName))!=null?yield zo.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":zo.RUNTIME.type,"X-Fern-Runtime-Version":zo.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 Ai.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 pr.BadRequestError(o.error.body);case 401:throw new pr.UnauthorizedError(o.error.body);case 403:throw new pr.ForbiddenError(o.error.body);case 404:throw new pr.NotFoundError(o.error.body);case 422:throw new pr.UnprocessableEntityError(Ai.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new pr.TooManyRequestsError(Ai.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new pr.ClientClosedRequestError(Ai.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new pr.InternalServerError(o.error.body);case 501:throw new pr.NotImplementedError(Ai.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new pr.ServiceUnavailableError(o.error.body);case 504:throw new pr.GatewayTimeoutError(Ai.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new su.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new su.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new su.CohereTimeoutError;case"unknown":throw new su.CohereError({message:o.error.errorMessage})}})}get(e,r){var n,o;return Gq(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:zo.fetcher)({url:(0,Y9.default)((o=yield zo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Z9.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zo.Supplier.get(this._options.clientName))!=null?yield zo.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":zo.RUNTIME.type,"X-Fern-Runtime-Version":zo.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 Ai.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 pr.BadRequestError(i.error.body);case 401:throw new pr.UnauthorizedError(i.error.body);case 403:throw new pr.ForbiddenError(i.error.body);case 404:throw new pr.NotFoundError(i.error.body);case 422:throw new pr.UnprocessableEntityError(Ai.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new pr.TooManyRequestsError(Ai.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new pr.ClientClosedRequestError(Ai.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new pr.InternalServerError(i.error.body);case 501:throw new pr.NotImplementedError(Ai.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new pr.ServiceUnavailableError(i.error.body);case 504:throw new pr.GatewayTimeoutError(Ai.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new su.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new su.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new su.CohereTimeoutError;case"unknown":throw new su.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return Gq(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:zo.fetcher)({url:(0,Y9.default)((o=yield zo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Z9.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zo.Supplier.get(this._options.clientName))!=null?yield zo.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":zo.RUNTIME.type,"X-Fern-Runtime-Version":zo.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 Ai.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 pr.BadRequestError(i.error.body);case 401:throw new pr.UnauthorizedError(i.error.body);case 403:throw new pr.ForbiddenError(i.error.body);case 404:throw new pr.NotFoundError(i.error.body);case 422:throw new pr.UnprocessableEntityError(Ai.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new pr.TooManyRequestsError(Ai.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new pr.ClientClosedRequestError(Ai.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new pr.InternalServerError(i.error.body);case 501:throw new pr.NotImplementedError(Ai.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new pr.ServiceUnavailableError(i.error.body);case 504:throw new pr.GatewayTimeoutError(Ai.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new su.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new su.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new su.CohereTimeoutError;case"unknown":throw new su.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return Gq(this,void 0,void 0,function*(){let r=(e=yield zo.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new su.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Wm.Datasets=$Le});var C$t=x(Km=>{"use strict";var Xun=Km&&Km.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qun=Km&&Km.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q9=Km&&Km.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xun(e,t,r);return Qun(e,t),e},bL=Km&&Km.__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())})},eln=Km&&Km.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Km,"__esModule",{value:!0});Km.Connectors=void 0;var Jq=Q9(vP()),Gn=Q9(J()),Rt=Q9(HE()),Zq=eln(NM()),Un=Q9(_P()),Aa=Q9(ru()),BLe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return bL(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:Gn.fetcher)({url:(0,Zq.default)((o=yield Gn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Jq.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gn.Supplier.get(this._options.clientName))!=null?yield Gn.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":Gn.RUNTIME.type,"X-Fern-Runtime-Version":Gn.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 Un.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 Rt.BadRequestError(u.error.body);case 401:throw new Rt.UnauthorizedError(u.error.body);case 403:throw new Rt.ForbiddenError(u.error.body);case 404:throw new Rt.NotFoundError(u.error.body);case 422:throw new Rt.UnprocessableEntityError(Un.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(Un.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(Un.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(u.error.body);case 501:throw new Rt.NotImplementedError(Un.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(u.error.body);case 504:throw new Rt.GatewayTimeoutError(Un.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Aa.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new Aa.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new Aa.CohereTimeoutError;case"unknown":throw new Aa.CohereError({message:u.error.errorMessage})}})}create(e,r){var n,o;return bL(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Gn.fetcher)({url:(0,Zq.default)((o=yield Gn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Jq.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gn.Supplier.get(this._options.clientName))!=null?yield Gn.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":Gn.RUNTIME.type,"X-Fern-Runtime-Version":Gn.RUNTIME.version},contentType:"application/json",requestType:"json",body:Un.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 Un.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 Rt.BadRequestError(i.error.body);case 401:throw new Rt.UnauthorizedError(i.error.body);case 403:throw new Rt.ForbiddenError(i.error.body);case 404:throw new Rt.NotFoundError(i.error.body);case 422:throw new Rt.UnprocessableEntityError(Un.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(Un.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(Un.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(i.error.body);case 501:throw new Rt.NotImplementedError(Un.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(i.error.body);case 504:throw new Rt.GatewayTimeoutError(Un.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Aa.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Aa.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Aa.CohereTimeoutError;case"unknown":throw new Aa.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return bL(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Gn.fetcher)({url:(0,Zq.default)((o=yield Gn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Jq.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gn.Supplier.get(this._options.clientName))!=null?yield Gn.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":Gn.RUNTIME.type,"X-Fern-Runtime-Version":Gn.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 Un.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 Rt.BadRequestError(i.error.body);case 401:throw new Rt.UnauthorizedError(i.error.body);case 403:throw new Rt.ForbiddenError(i.error.body);case 404:throw new Rt.NotFoundError(i.error.body);case 422:throw new Rt.UnprocessableEntityError(Un.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(Un.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(Un.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(i.error.body);case 501:throw new Rt.NotImplementedError(Un.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(i.error.body);case 504:throw new Rt.GatewayTimeoutError(Un.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Aa.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Aa.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Aa.CohereTimeoutError;case"unknown":throw new Aa.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return bL(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Gn.fetcher)({url:(0,Zq.default)((o=yield Gn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Jq.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gn.Supplier.get(this._options.clientName))!=null?yield Gn.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":Gn.RUNTIME.type,"X-Fern-Runtime-Version":Gn.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 Un.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 Rt.BadRequestError(i.error.body);case 401:throw new Rt.UnauthorizedError(i.error.body);case 403:throw new Rt.ForbiddenError(i.error.body);case 404:throw new Rt.NotFoundError(i.error.body);case 422:throw new Rt.UnprocessableEntityError(Un.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(Un.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(Un.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(i.error.body);case 501:throw new Rt.NotImplementedError(Un.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(i.error.body);case 504:throw new Rt.GatewayTimeoutError(Un.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Aa.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Aa.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Aa.CohereTimeoutError;case"unknown":throw new Aa.CohereError({message:i.error.errorMessage})}})}update(e,r={},n){var o,i;return bL(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:Gn.fetcher)({url:(0,Zq.default)((i=yield Gn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Jq.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gn.Supplier.get(this._options.clientName))!=null?yield Gn.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":Gn.RUNTIME.type,"X-Fern-Runtime-Version":Gn.RUNTIME.version},contentType:"application/json",requestType:"json",body:Un.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 Un.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 Rt.BadRequestError(a.error.body);case 401:throw new Rt.UnauthorizedError(a.error.body);case 403:throw new Rt.ForbiddenError(a.error.body);case 404:throw new Rt.NotFoundError(a.error.body);case 422:throw new Rt.UnprocessableEntityError(Un.UnprocessableEntityErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(Un.TooManyRequestsErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(Un.ClientClosedRequestErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(a.error.body);case 501:throw new Rt.NotImplementedError(Un.NotImplementedErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(a.error.body);case 504:throw new Rt.GatewayTimeoutError(Un.GatewayTimeoutErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Aa.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new Aa.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new Aa.CohereTimeoutError;case"unknown":throw new Aa.CohereError({message:a.error.errorMessage})}})}oAuthAuthorize(e,r={},n){var o,i;return bL(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:Gn.fetcher)({url:(0,Zq.default)((i=yield Gn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Jq.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}/oauth/authorize`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gn.Supplier.get(this._options.clientName))!=null?yield Gn.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":Gn.RUNTIME.type,"X-Fern-Runtime-Version":Gn.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 Un.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 Rt.BadRequestError(u.error.body);case 401:throw new Rt.UnauthorizedError(u.error.body);case 403:throw new Rt.ForbiddenError(u.error.body);case 404:throw new Rt.NotFoundError(u.error.body);case 422:throw new Rt.UnprocessableEntityError(Un.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(Un.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(Un.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(u.error.body);case 501:throw new Rt.NotImplementedError(Un.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(u.error.body);case 504:throw new Rt.GatewayTimeoutError(Un.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Aa.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new Aa.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new Aa.CohereTimeoutError;case"unknown":throw new Aa.CohereError({message:u.error.errorMessage})}})}_getAuthorizationHeader(){var e;return bL(this,void 0,void 0,function*(){let r=(e=yield Gn.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Aa.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Km.Connectors=BLe});var P$t=x(Gm=>{"use strict";var tln=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]}),rln=Gm&&Gm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eK=Gm&&Gm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tln(e,t,r);return rln(e,t),e},zLe=Gm&&Gm.__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())})},nln=Gm&&Gm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Gm,"__esModule",{value:!0});Gm.Models=void 0;var O$t=eK(vP()),eg=eK(J()),Ls=eK(HE()),E$t=nln(NM()),Sy=eK(_P()),xP=eK(ru()),ULe=class{constructor(e={}){this._options=e}get(e,r){var n,o;return zLe(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:eg.fetcher)({url:(0,E$t.default)((o=yield eg.Supplier.get(this._options.environment))!==null&&o!==void 0?o:O$t.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield eg.Supplier.get(this._options.clientName))!=null?yield eg.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":eg.RUNTIME.type,"X-Fern-Runtime-Version":eg.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 Sy.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 Ls.BadRequestError(i.error.body);case 401:throw new Ls.UnauthorizedError(i.error.body);case 403:throw new Ls.ForbiddenError(i.error.body);case 404:throw new Ls.NotFoundError(i.error.body);case 422:throw new Ls.UnprocessableEntityError(Sy.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ls.TooManyRequestsError(Sy.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ls.ClientClosedRequestError(Sy.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ls.InternalServerError(i.error.body);case 501:throw new Ls.NotImplementedError(Sy.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ls.ServiceUnavailableError(i.error.body);case 504:throw new Ls.GatewayTimeoutError(Sy.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new xP.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new xP.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new xP.CohereTimeoutError;case"unknown":throw new xP.CohereError({message:i.error.errorMessage})}})}list(e={},r){var n,o;return zLe(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:eg.fetcher)({url:(0,E$t.default)((o=yield eg.Supplier.get(this._options.environment))!==null&&o!==void 0?o:O$t.CohereEnvironment.Production,"v1/models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield eg.Supplier.get(this._options.clientName))!=null?yield eg.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":eg.RUNTIME.type,"X-Fern-Runtime-Version":eg.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 Sy.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 Ls.BadRequestError(c.error.body);case 401:throw new Ls.UnauthorizedError(c.error.body);case 403:throw new Ls.ForbiddenError(c.error.body);case 404:throw new Ls.NotFoundError(c.error.body);case 422:throw new Ls.UnprocessableEntityError(Sy.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ls.TooManyRequestsError(Sy.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ls.ClientClosedRequestError(Sy.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ls.InternalServerError(c.error.body);case 501:throw new Ls.NotImplementedError(Sy.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ls.ServiceUnavailableError(c.error.body);case 504:throw new Ls.GatewayTimeoutError(Sy.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new xP.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new xP.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new xP.CohereTimeoutError;case"unknown":throw new xP.CohereError({message:c.error.errorMessage})}})}_getAuthorizationHeader(){var e;return zLe(this,void 0,void 0,function*(){let r=(e=yield eg.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new xP.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Gm.Models=ULe});var T$t=x(Jm=>{"use strict";var oln=Jm&&Jm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iln=Jm&&Jm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tK=Jm&&Jm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oln(e,t,r);return iln(e,t),e},jM=Jm&&Jm.__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())})},aln=Jm&&Jm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Jm,"__esModule",{value:!0});Jm.Finetuning=void 0;var _L=tK(vP()),sn=tK(J()),pn=tK(HE()),vL=aln(NM()),SP=tK(_P()),ki=tK(ru()),qLe=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){var n,o;return jM(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:sn.fetcher)({url:(0,vL.default)((o=yield sn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:_L.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),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:u,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(l.ok)return SP.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 pn.BadRequestError(l.error.body);case 401:throw new pn.UnauthorizedError(l.error.body);case 403:throw new pn.ForbiddenError(l.error.body);case 404:throw new pn.NotFoundError(l.error.body);case 500:throw new pn.InternalServerError(l.error.body);case 503:throw new pn.ServiceUnavailableError(l.error.body);default:throw new ki.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new ki.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new ki.CohereTimeoutError;case"unknown":throw new ki.CohereError({message:l.error.errorMessage})}})}createFinetunedModel(e,r){var n,o;return jM(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:sn.fetcher)({url:(0,vL.default)((o=yield sn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:_L.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),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:SP.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 SP.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 pn.BadRequestError(i.error.body);case 401:throw new pn.UnauthorizedError(i.error.body);case 403:throw new pn.ForbiddenError(i.error.body);case 404:throw new pn.NotFoundError(i.error.body);case 500:throw new pn.InternalServerError(i.error.body);case 503:throw new pn.ServiceUnavailableError(i.error.body);default:throw new ki.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ki.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ki.CohereTimeoutError;case"unknown":throw new ki.CohereError({message:i.error.errorMessage})}})}getFinetunedModel(e,r){var n,o;return jM(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:sn.fetcher)({url:(0,vL.default)((o=yield sn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:_L.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${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 SP.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 pn.BadRequestError(i.error.body);case 401:throw new pn.UnauthorizedError(i.error.body);case 403:throw new pn.ForbiddenError(i.error.body);case 404:throw new pn.NotFoundError(i.error.body);case 500:throw new pn.InternalServerError(i.error.body);case 503:throw new pn.ServiceUnavailableError(i.error.body);default:throw new ki.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ki.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ki.CohereTimeoutError;case"unknown":throw new ki.CohereError({message:i.error.errorMessage})}})}deleteFinetunedModel(e,r){var n,o;return jM(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:sn.fetcher)({url:(0,vL.default)((o=yield sn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:_L.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${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 SP.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 pn.BadRequestError(i.error.body);case 401:throw new pn.UnauthorizedError(i.error.body);case 403:throw new pn.ForbiddenError(i.error.body);case 404:throw new pn.NotFoundError(i.error.body);case 500:throw new pn.InternalServerError(i.error.body);case 503:throw new pn.ServiceUnavailableError(i.error.body);default:throw new ki.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ki.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ki.CohereTimeoutError;case"unknown":throw new ki.CohereError({message:i.error.errorMessage})}})}updateFinetunedModel(e,r,n){var o,i;return jM(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:sn.fetcher)({url:(0,vL.default)((i=yield sn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:_L.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${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:SP.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 SP.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 pn.BadRequestError(a.error.body);case 401:throw new pn.UnauthorizedError(a.error.body);case 403:throw new pn.ForbiddenError(a.error.body);case 404:throw new pn.NotFoundError(a.error.body);case 500:throw new pn.InternalServerError(a.error.body);case 503:throw new pn.ServiceUnavailableError(a.error.body);default:throw new ki.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new ki.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new ki.CohereTimeoutError;case"unknown":throw new ki.CohereError({message:a.error.errorMessage})}})}listEvents(e,r={},n){var o,i;return jM(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:sn.fetcher)({url:(0,vL.default)((i=yield sn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:_L.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/events`),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:l,requestType:"json",timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(c.ok)return SP.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 pn.BadRequestError(c.error.body);case 401:throw new pn.UnauthorizedError(c.error.body);case 403:throw new pn.ForbiddenError(c.error.body);case 404:throw new pn.NotFoundError(c.error.body);case 500:throw new pn.InternalServerError(c.error.body);case 503:throw new pn.ServiceUnavailableError(c.error.body);default:throw new ki.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new ki.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new ki.CohereTimeoutError;case"unknown":throw new ki.CohereError({message:c.error.errorMessage})}})}listTrainingStepMetrics(e,r={},n){var o,i;return jM(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:sn.fetcher)({url:(0,vL.default)((i=yield sn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:_L.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/training-step-metrics`),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:u,requestType:"json",timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(l.ok)return SP.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 pn.BadRequestError(l.error.body);case 401:throw new pn.UnauthorizedError(l.error.body);case 403:throw new pn.ForbiddenError(l.error.body);case 404:throw new pn.NotFoundError(l.error.body);case 500:throw new pn.InternalServerError(l.error.body);case 503:throw new pn.ServiceUnavailableError(l.error.body);default:throw new ki.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new ki.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new ki.CohereTimeoutError;case"unknown":throw new ki.CohereError({message:l.error.errorMessage})}})}_getAuthorizationHeader(){var e;return jM(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 ki.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Jm.Finetuning=qLe});var Vue=x(Ym=>{"use strict";var sln=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]}),uln=Ym&&Ym.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rK=Ym&&Ym.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sln(e,t,r);return uln(e,t),e},Zm=Ym&&Ym.__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())})},lln=Ym&&Ym.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ym,"__esModule",{value:!0});Ym.CohereClient=void 0;var r_=rK(vP()),Ct=rK(J()),Pe=rK(HE()),dt=rK(_P()),n_=lln(NM()),Xr=rK(ru()),cln=FLe(),dln=x$t(),fln=S$t(),pln=C$t(),mln=P$t(),hln=T$t(),HLe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return Zm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ct.fetcher)({url:(0,n_.default)((o=yield Ct.Supplier.get(this._options.environment))!==null&&o!==void 0?o:r_.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ct.Supplier.get(this._options.clientName))!=null?yield Ct.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":Ct.RUNTIME.type,"X-Fern-Runtime-Version":Ct.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},dt.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 Ct.Stream({stream:i.body,parse:a=>Zm(this,void 0,void 0,function*(){return dt.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Xr.CohereTimeoutError;case"unknown":throw new Xr.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return Zm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ct.fetcher)({url:(0,n_.default)((o=yield Ct.Supplier.get(this._options.environment))!==null&&o!==void 0?o:r_.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ct.Supplier.get(this._options.clientName))!=null?yield Ct.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":Ct.RUNTIME.type,"X-Fern-Runtime-Version":Ct.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},dt.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 dt.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Xr.CohereTimeoutError;case"unknown":throw new Xr.CohereError({message:i.error.errorMessage})}})}generateStream(e,r){var n,o;return Zm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ct.fetcher)({url:(0,n_.default)((o=yield Ct.Supplier.get(this._options.environment))!==null&&o!==void 0?o:r_.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ct.Supplier.get(this._options.clientName))!=null?yield Ct.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":Ct.RUNTIME.type,"X-Fern-Runtime-Version":Ct.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},dt.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 Ct.Stream({stream:i.body,parse:a=>Zm(this,void 0,void 0,function*(){return dt.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Xr.CohereTimeoutError;case"unknown":throw new Xr.CohereError({message:i.error.errorMessage})}})}generate(e,r){var n,o;return Zm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ct.fetcher)({url:(0,n_.default)((o=yield Ct.Supplier.get(this._options.environment))!==null&&o!==void 0?o:r_.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ct.Supplier.get(this._options.clientName))!=null?yield Ct.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":Ct.RUNTIME.type,"X-Fern-Runtime-Version":Ct.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},dt.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 dt.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Xr.CohereTimeoutError;case"unknown":throw new Xr.CohereError({message:i.error.errorMessage})}})}embed(e,r){var n,o;return Zm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ct.fetcher)({url:(0,n_.default)((o=yield Ct.Supplier.get(this._options.environment))!==null&&o!==void 0?o:r_.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ct.Supplier.get(this._options.clientName))!=null?yield Ct.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":Ct.RUNTIME.type,"X-Fern-Runtime-Version":Ct.RUNTIME.version},contentType:"application/json",requestType:"json",body:dt.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 dt.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Xr.CohereTimeoutError;case"unknown":throw new Xr.CohereError({message:i.error.errorMessage})}})}rerank(e,r){var n,o;return Zm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ct.fetcher)({url:(0,n_.default)((o=yield Ct.Supplier.get(this._options.environment))!==null&&o!==void 0?o:r_.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ct.Supplier.get(this._options.clientName))!=null?yield Ct.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":Ct.RUNTIME.type,"X-Fern-Runtime-Version":Ct.RUNTIME.version},contentType:"application/json",requestType:"json",body:dt.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 dt.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Xr.CohereTimeoutError;case"unknown":throw new Xr.CohereError({message:i.error.errorMessage})}})}classify(e,r){var n,o;return Zm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ct.fetcher)({url:(0,n_.default)((o=yield Ct.Supplier.get(this._options.environment))!==null&&o!==void 0?o:r_.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ct.Supplier.get(this._options.clientName))!=null?yield Ct.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":Ct.RUNTIME.type,"X-Fern-Runtime-Version":Ct.RUNTIME.version},contentType:"application/json",requestType:"json",body:dt.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 dt.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Xr.CohereTimeoutError;case"unknown":throw new Xr.CohereError({message:i.error.errorMessage})}})}summarize(e,r){var n,o;return Zm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ct.fetcher)({url:(0,n_.default)((o=yield Ct.Supplier.get(this._options.environment))!==null&&o!==void 0?o:r_.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ct.Supplier.get(this._options.clientName))!=null?yield Ct.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":Ct.RUNTIME.type,"X-Fern-Runtime-Version":Ct.RUNTIME.version},contentType:"application/json",requestType:"json",body:dt.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 dt.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Xr.CohereTimeoutError;case"unknown":throw new Xr.CohereError({message:i.error.errorMessage})}})}tokenize(e,r){var n,o;return Zm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ct.fetcher)({url:(0,n_.default)((o=yield Ct.Supplier.get(this._options.environment))!==null&&o!==void 0?o:r_.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ct.Supplier.get(this._options.clientName))!=null?yield Ct.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":Ct.RUNTIME.type,"X-Fern-Runtime-Version":Ct.RUNTIME.version},contentType:"application/json",requestType:"json",body:dt.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 dt.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Xr.CohereTimeoutError;case"unknown":throw new Xr.CohereError({message:i.error.errorMessage})}})}detokenize(e,r){var n,o;return Zm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ct.fetcher)({url:(0,n_.default)((o=yield Ct.Supplier.get(this._options.environment))!==null&&o!==void 0?o:r_.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ct.Supplier.get(this._options.clientName))!=null?yield Ct.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":Ct.RUNTIME.type,"X-Fern-Runtime-Version":Ct.RUNTIME.version},contentType:"application/json",requestType:"json",body:dt.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 dt.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Xr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Xr.CohereTimeoutError;case"unknown":throw new Xr.CohereError({message:i.error.errorMessage})}})}checkApiKey(e){var r,n;return Zm(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Ct.fetcher)({url:(0,n_.default)((n=yield Ct.Supplier.get(this._options.environment))!==null&&n!==void 0?n:r_.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ct.Supplier.get(this._options.clientName))!=null?yield Ct.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":Ct.RUNTIME.type,"X-Fern-Runtime-Version":Ct.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 dt.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 Pe.BadRequestError(o.error.body);case 401:throw new Pe.UnauthorizedError(o.error.body);case 403:throw new Pe.ForbiddenError(o.error.body);case 404:throw new Pe.NotFoundError(o.error.body);case 422:throw new Pe.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(o.error.body);case 501:throw new Pe.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(o.error.body);case 504:throw new Pe.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Xr.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Xr.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Xr.CohereTimeoutError;case"unknown":throw new Xr.CohereError({message:o.error.errorMessage})}})}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new cln.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new dln.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new fln.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new pln.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new mln.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new hln.Finetuning(this._options)}_getAuthorizationHeader(){var e;return Zm(this,void 0,void 0,function*(){let r=(e=yield Ct.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Xr.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Ym.CohereClient=HLe});var WLe=x(Wue=>{"use strict";Object.defineProperty(Wue,"__esModule",{value:!0});Wue.AwsClient=void 0;var gln=Vue(),VLe=class extends gln.CohereClient{constructor(e){e.token="n/a",super(e)}};Wue.AwsClient=VLe});var A$t=x(Kue=>{"use strict";Object.defineProperty(Kue,"__esModule",{value:!0});Kue.BedrockClient=void 0;var yln=DLe(),bln=WLe(),KLe=class extends bln.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,yln.fetchOverride)("bedrock",e)}))}};Kue.BedrockClient=KLe});var I$t=x(Gue=>{"use strict";Object.defineProperty(Gue,"__esModule",{value:!0});Gue.CohereClientV2=void 0;var _ln=FLe(),vln=Vue(),GLe=class{constructor(e){this._options=e,this.client=new vln.CohereClient(this._options),this.clientV2=new _ln.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}};Gue.CohereClientV2=GLe});var M$t=x(Jue=>{"use strict";Object.defineProperty(Jue,"__esModule",{value:!0});Jue.CustomClient=void 0;var wln=Vue(),JLe=class extends wln.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}};Jue.CustomClient=JLe});var R$t=x(Zue=>{"use strict";Object.defineProperty(Zue,"__esModule",{value:!0});Zue.SagemakerClient=void 0;var xln=WLe(),Sln=DLe(),ZLe=class extends xln.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,Sln.fetchOverride)("sagemaker",e)}))}};Zue.SagemakerClient=ZLe});var nK=x(Wa=>{"use strict";var Cln=Wa&&Wa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Oln=Wa&&Wa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Eln=Wa&&Wa.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Cln(e,t,r);return Oln(e,t),e};Object.defineProperty(Wa,"__esModule",{value:!0});Wa.SagemakerClient=Wa.CohereTimeoutError=Wa.CohereError=Wa.CohereEnvironment=Wa.CohereClient=Wa.CohereClientV2=Wa.BedrockClient=Wa.Cohere=void 0;Wa.Cohere=Eln(HE());var Pln=A$t();Object.defineProperty(Wa,"BedrockClient",{enumerable:!0,get:function(){return Pln.BedrockClient}});var Tln=I$t();Object.defineProperty(Wa,"CohereClientV2",{enumerable:!0,get:function(){return Tln.CohereClientV2}});var Aln=M$t();Object.defineProperty(Wa,"CohereClient",{enumerable:!0,get:function(){return Aln.CustomClient}});var Iln=vP();Object.defineProperty(Wa,"CohereEnvironment",{enumerable:!0,get:function(){return Iln.CohereEnvironment}});var N$t=ru();Object.defineProperty(Wa,"CohereError",{enumerable:!0,get:function(){return N$t.CohereError}});Object.defineProperty(Wa,"CohereTimeoutError",{enumerable:!0,get:function(){return N$t.CohereTimeoutError}});var Mln=R$t();Object.defineProperty(Wa,"SagemakerClient",{enumerable:!0,get:function(){return Mln.SagemakerClient}})});var Fs=b(()=>{hj()});function i_(t){t?(Uc[0]=Uc[16]=Uc[1]=Uc[2]=Uc[3]=Uc[4]=Uc[5]=Uc[6]=Uc[7]=Uc[8]=Uc[9]=Uc[10]=Uc[11]=Uc[12]=Uc[13]=Uc[14]=Uc[15]=0,this.blocks=Uc):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 Rln,jn,Nln,o_,Uc,j$t,YLe,D$t=b(()=>{"use strict";Rln=typeof window=="object"?window:{},jn="0123456789abcdef".split(""),Nln=[-2147483648,8388608,32768,128],o_=[24,16,8,0],Uc=[];i_.prototype.update=function(t){if(!this.finalized){var e=typeof t!="string";e&&t.constructor===Rln.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]<<o_[o++&3];else for(o=this.start;n<i&&o<64;++n)r=t.charCodeAt(n),r<128?a[o>>2]|=r<<o_[o++&3]:r<2048?(a[o>>2]|=(192|r>>6)<<o_[o++&3],a[o>>2]|=(128|r&63)<<o_[o++&3]):r<55296||r>=57344?(a[o>>2]|=(224|r>>12)<<o_[o++&3],a[o>>2]|=(128|r>>6&63)<<o_[o++&3],a[o>>2]|=(128|r&63)<<o_[o++&3]):(r=65536+((r&1023)<<10|t.charCodeAt(++n)&1023),a[o>>2]|=(240|r>>18)<<o_[o++&3],a[o>>2]|=(128|r>>12&63)<<o_[o++&3],a[o>>2]|=(128|r>>6&63)<<o_[o++&3],a[o>>2]|=(128|r&63)<<o_[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}};i_.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=Nln[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()}};i_.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};i_.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4;return jn[t>>28&15]+jn[t>>24&15]+jn[t>>20&15]+jn[t>>16&15]+jn[t>>12&15]+jn[t>>8&15]+jn[t>>4&15]+jn[t&15]+jn[e>>28&15]+jn[e>>24&15]+jn[e>>20&15]+jn[e>>16&15]+jn[e>>12&15]+jn[e>>8&15]+jn[e>>4&15]+jn[e&15]+jn[r>>28&15]+jn[r>>24&15]+jn[r>>20&15]+jn[r>>16&15]+jn[r>>12&15]+jn[r>>8&15]+jn[r>>4&15]+jn[r&15]+jn[n>>28&15]+jn[n>>24&15]+jn[n>>20&15]+jn[n>>16&15]+jn[n>>12&15]+jn[n>>8&15]+jn[n>>4&15]+jn[n&15]+jn[o>>28&15]+jn[o>>24&15]+jn[o>>20&15]+jn[o>>16&15]+jn[o>>12&15]+jn[o>>8&15]+jn[o>>4&15]+jn[o&15]};i_.prototype.toString=i_.prototype.hex;i_.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]};i_.prototype.array=i_.prototype.digest;i_.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};j$t=!1,YLe=t=>(j$t||(console.warn(["The default method for hashing keys is insecure and will be replaced in a future version,","but hasn't been replaced yet as to not break existing caches. It's recommended that you use","a more secure hashing algorithm to avoid cache poisoning.","","See this page for more information:","|","\u2514> https://js.langchain.com/docs/troubleshooting/warnings/insecure-cache-algorithm"].join(`
`)),j$t=!0),new i_(!0).update(t).hex())});function BC(t,e){e?(qc[0]=qc[16]=qc[1]=qc[2]=qc[3]=qc[4]=qc[5]=qc[6]=qc[7]=qc[8]=qc[9]=qc[10]=qc[11]=qc[12]=qc[13]=qc[14]=qc[15]=0,this.blocks=qc):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}var Ft,jln,a_,Yue,qc,L$t=b(()=>{"use strict";Ft="0123456789abcdef".split(""),jln=[-2147483648,8388608,32768,128],a_=[24,16,8,0],Yue=[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],qc=[];BC.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if(r!=="string"){if(r==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);e=!0}for(var n,o=0,i,a=t.length,s=this.blocks;o<a;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,this.block=s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),e)for(i=this.start;o<a&&i<64;++o)s[i>>>2]|=t[o]<<a_[i++&3];else for(i=this.start;o<a&&i<64;++o)n=t.charCodeAt(o),n<128?s[i>>>2]|=n<<a_[i++&3]:n<2048?(s[i>>>2]|=(192|n>>>6)<<a_[i++&3],s[i>>>2]|=(128|n&63)<<a_[i++&3]):n<55296||n>=57344?(s[i>>>2]|=(224|n>>>12)<<a_[i++&3],s[i>>>2]|=(128|n>>>6&63)<<a_[i++&3],s[i>>>2]|=(128|n&63)<<a_[i++&3]):(n=65536+((n&1023)<<10|t.charCodeAt(++o)&1023),s[i>>>2]|=(240|n>>>18)<<a_[i++&3],s[i>>>2]|=(128|n>>>12&63)<<a_[i++&3],s[i>>>2]|=(128|n>>>6&63)<<a_[i++&3],s[i>>>2]|=(128|n&63)<<a_[i++&3]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=s[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};BC.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=jln[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()}};BC.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=this.blocks,l,c,d,f,p,h,m,g,y,_,w;for(l=16;l<64;++l)p=u[l-15],c=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=u[l-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,u[l]=u[l-16]+c+u[l-7]+d<<0;for(w=e&r,l=0;l<64;l+=4)this.first?(this.is224?(g=300032,p=u[0]-1413257819,s=p-150054599<<0,n=p+24177077<<0):(g=704751109,p=u[0]-210244248,s=p-1521486534<<0,n=p+143694565<<0),this.first=!1):(c=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),g=t&e,f=g^t&r^w,m=o&i^~o&a,p=s+d+m+Yue[l]+u[l],h=c+f,s=n+p<<0,n=p+h<<0),c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),y=n&t,f=y^n&e^g,m=a&s^~a&o,p=i+d+m+Yue[l+1]+u[l+1],h=c+f,a=r+p<<0,r=p+h<<0,c=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),_=r&n,f=_^r&t^y,m=i&a^~i&s,p=o+d+m+Yue[l+2]+u[l+2],h=c+f,i=e+p<<0,e=p+h<<0,c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),w=e&r,f=w^e&n^_,m=i&a^~i&s,p=o+d+m+Yue[l+3]+u[l+3],h=c+f,o=t+p<<0,t=p+h<<0,this.chromeBugWorkAround=!0;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,this.h5=this.h5+i<<0,this.h6=this.h6+a<<0,this.h7=this.h7+s<<0};BC.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=Ft[t>>>28&15]+Ft[t>>>24&15]+Ft[t>>>20&15]+Ft[t>>>16&15]+Ft[t>>>12&15]+Ft[t>>>8&15]+Ft[t>>>4&15]+Ft[t&15]+Ft[e>>>28&15]+Ft[e>>>24&15]+Ft[e>>>20&15]+Ft[e>>>16&15]+Ft[e>>>12&15]+Ft[e>>>8&15]+Ft[e>>>4&15]+Ft[e&15]+Ft[r>>>28&15]+Ft[r>>>24&15]+Ft[r>>>20&15]+Ft[r>>>16&15]+Ft[r>>>12&15]+Ft[r>>>8&15]+Ft[r>>>4&15]+Ft[r&15]+Ft[n>>>28&15]+Ft[n>>>24&15]+Ft[n>>>20&15]+Ft[n>>>16&15]+Ft[n>>>12&15]+Ft[n>>>8&15]+Ft[n>>>4&15]+Ft[n&15]+Ft[o>>>28&15]+Ft[o>>>24&15]+Ft[o>>>20&15]+Ft[o>>>16&15]+Ft[o>>>12&15]+Ft[o>>>8&15]+Ft[o>>>4&15]+Ft[o&15]+Ft[i>>>28&15]+Ft[i>>>24&15]+Ft[i>>>20&15]+Ft[i>>>16&15]+Ft[i>>>12&15]+Ft[i>>>8&15]+Ft[i>>>4&15]+Ft[i&15]+Ft[a>>>28&15]+Ft[a>>>24&15]+Ft[a>>>20&15]+Ft[a>>>16&15]+Ft[a>>>12&15]+Ft[a>>>8&15]+Ft[a>>>4&15]+Ft[a&15];return this.is224||(u+=Ft[s>>>28&15]+Ft[s>>>24&15]+Ft[s>>>20&15]+Ft[s>>>16&15]+Ft[s>>>12&15]+Ft[s>>>8&15]+Ft[s>>>4&15]+Ft[s&15]),u};BC.prototype.toString=BC.prototype.hex;BC.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=[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,i>>>24&255,i>>>16&255,i>>>8&255,i&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255];return this.is224||u.push(s>>>24&255,s>>>16&255,s>>>8&255,s&255),u};BC.prototype.array=BC.prototype.digest;BC.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),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),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t}});var F$t=b(()=>{D$t();L$t()});var Dln,XLe,Lln,Xue,k$t=b(()=>{F$t();DA();Dln=(...t)=>YLe(t.join("_")),XLe=class{constructor(){Object.defineProperty(this,"keyEncoder",{enumerable:!0,configurable:!0,writable:!0,value:Dln})}makeDefaultKeyEncoder(e){this.keyEncoder=e}},Lln=new Map,Xue=class t extends XLe{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(this.keyEncoder(e,r))??null)}async update(e,r,n){this.cache.set(this.keyEncoder(e,r),n)}static global(){return new t(Lln)}}});function Bln(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 zln(t,e){return t.length===1?[e.get(t.join(","))]:Bln(t,e).map(r=>e.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function Uln(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function eFe(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 $$t,Fln,kln,$ln,QLe,Que,B$t=b(()=>{$$t=j(iCe(),1),Fln=Object.defineProperty,kln=(t,e,r)=>e in t?Fln(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$ln=(t,e,r)=>(kln(t,typeof e!="symbol"?e+"":e,r),r);QLe=class{constructor(t,e){gd(this,"specialTokens");gd(this,"inverseSpecialTokens");gd(this,"patStr");gd(this,"textEncoder",new TextEncoder);gd(this,"textDecoder",new TextDecoder("utf-8"));gd(this,"rankMap",new Map);gd(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=$$t.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=QLe.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=QLe.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 h=this.textEncoder.encode(p[0]),m=this.rankMap.get(h.join(","));if(m!=null){i.push(m);continue}i.push(...zln(h,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)}},Que=QLe;$ln(Que,"specialTokenRegex",t=>new RegExp(t.map(e=>Uln(e)).join("|"),"g"))});var z$t=b(()=>{B$t()});async function U$t(t){return t in ele||(ele[t]=qln.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new Que(e)).catch(e=>{throw delete ele[t],e})),await ele[t]}async function q$t(t){return U$t(eFe(t))}var ele,qln,tFe=b(()=>{z$t();OB();ele={},qln=new Oh({})});function kd(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 Hln,Vln,Yq,Xq,oK=b(()=>{k$t();z6();DA();OB();tFe();Pf();Hln=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;Vln=()=>!1,Yq=class extends zn{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??Vln(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}},Xq=class extends Yq{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=Xue.global():this.cache=void 0,this.caller=new Oh(n??{})}async getNumTokens(e){let r;typeof e=="string"?r=e:r=e.map(o=>typeof o=="string"?o:o.type==="text"&&"text"in o?o.text:"").join("");let n=Math.ceil(r.length/4);if(!this._encoding)try{this._encoding=await q$t("modelName"in this?Hln(this.modelName):"gpt2")}catch(o){console.warn("Failed to calculate number of tokens, falling back to approximate count",o)}if(this._encoding)try{n=this._encoding.encode(r).length}catch(o){console.warn("Failed to calculate number of tokens, falling back to approximate count",o)}return n}static _convertInputToPromptValue(e){return typeof e=="string"?new LB(e):Array.isArray(e)?new FB(e.map(Pb)):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 tg=b(()=>{oK()});function rFe(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function nFe(t){return t!==void 0&&zn.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function oFe(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(Th(t.schema)||t.schema!=null&&typeof t.schema=="object"&&"type"in t.schema&&typeof t.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(t.schema.type))}function Hc(t){return oFe(t)||nFe(t)||rFe(t)}var tle=b(()=>{Pf();gE()});function DM(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:xm(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function zC(t,e){let r=typeof e=="number"?void 0:e,n;return Hc(t)?n={type:"function",function:DM(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var H$t=b(()=>{tle();mj();tle()});var rg=b(()=>{H$t()});function iFe(t){let e=[];for(let r of t){let n=r;if(Array.isArray(r.content))for(let o=0;o<r.content.length;o++){let i=r.content[o];(kYe(i)||$Ye(i))&&n===r&&(n=new r.constructor({...n,content:[...r.content.slice(0,o),BYe(i),...r.content.slice(o+1)]}))}e.push(n)}return e}var Cu,V$t=b(()=>{hj();CB();oK();FA();Pf();vv();iee();gE();g6();mj();Cu=class t extends Xq{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 mu.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(),[iFe(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 h=c?.at(0)?.runId;h!=null&&p.message._updateId(`run-${h}`)}p.message.response_metadata={...p.generationInfo,...p.message.response_metadata},yield p.message,d?d=d.concat(p):d=p,Z0e(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(h=>h?.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(Pb)),a;if(o!==void 0&&o.length===i.length)a=o;else{let d={...n.metadata,...this.getLsParams(r)},f=await mu.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.map(iFe),n.runId,void 0,p,void 0,void 0,n.runName)}let s=[],u=[];if(!!a?.[0].handlers.find(z0e)&&!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 h of d){if(h.message.id==null){let m=a?.at(0)?.runId;m!=null&&h.message._updateId(`run-${m}`)}f===void 0?f=h:f=Rc(f,h),Z0e(h.message)&&h.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:h.message.usage_metadata.input_tokens,completionTokens:h.message.usage_metadata.output_tokens,totalTokens:h.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 h=f.value;for(let m of h.generations){if(m.message.id==null){let g=a?.at(0)?.runId;g!=null&&m.message._updateId(`run-${g}`)}m.message.response_metadata={...m.generationInfo,...m.message.response_metadata}}return h.generations.length===1&&(h.generations[0].message.response_metadata={...h.llmOutput,...h.generations[0].message.response_metadata}),s[p]=h.generations,u[p]=h.llmOutput,a?.[p]?.handleLLMEnd({generations:[h.generations],llmOutput:h.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,T6,{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(g=>g.map(Pb)),s={...i.metadata,...this.getLsParams(o)},u=await mu.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.map(iFe),i.runId,void 0,l,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(a.map(async(g,y)=>{let _=t._convertInputToPromptValue(g).toString(),w=await r.lookup(_,n);return w==null&&d.push(y),w}))).map((g,y)=>({result:g,runManager:c?.[y]})).filter(({result:g})=>g.status==="fulfilled"&&g.value!=null||g.status==="rejected"),h=[];await Promise.all(p.map(async({result:g,runManager:y},_)=>{if(g.status==="fulfilled"){let w=g.value;return h[_]=w.map(S=>("message"in S&&kg(S.message)&&Vi(S.message)&&(S.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0}),S.generationInfo={...S.generationInfo,tokenUsage:{}},S)),w.length&&await y?.handleLLMNewToken(w[0].text),y?.handleLLMEnd({generations:[w]},void 0,void 0,void 0,{cached:!0})}else return await y?.handleLLMError(g.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(g.reason)}));let m={generations:h,missingPromptIndices:d,startedRunManagers:c};return Object.defineProperty(m,T6,{value:c?{runIds:c?.map(g=>g.runId)}:void 0,configurable:!0}),m}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(h=>h.map(Pb)),[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 h=await this._generateUncached(d.map(m=>i[m]),s,a,f!==void 0?d.map(m=>f?.[m]):void 0);await Promise.all(h.generations.map(async(m,g)=>{let y=d[g];c[y]=m;let _=t._convertInputToPromptValue(i[y]).toString();return u.update(_,l,m)})),p=h.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(Pb)],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 Zs(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=pj(n)??"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;Th(n)?l=[{type:"function",function:{name:u,description:i,parameters:xm(n)}}]:("name"in n&&(u=n.name),l=[{type:"function",function:{name:u,description:i,parameters:n}}]);let c=this.bindTools(l),d=Ep.from(m=>{if(!m.tool_calls||m.tool_calls.length===0)throw new Error("No tool calls found in the response.");let g=m.tool_calls.find(y=>y.name===u);if(!g)throw new Error(`No tool call found with name ${u}.`);return g.args});if(!s)return c.pipe(d).withConfig({runName:"StructuredOutput"});let f=jo.assign({parsed:(m,g)=>d.invoke(m.raw,g)}),p=jo.assign({parsed:()=>null}),h=f.withFallbacks({fallbacks:[p]});return ji.from([{raw:c},h]).withConfig({runName:"StructuredOutputRunnable"})}}});var UC=b(()=>{V$t()});var Gf=b(()=>{CB()});var to=b(()=>{aj()});function W$t(t,e=0){return($d[t[e+0]]+$d[t[e+1]]+$d[t[e+2]]+$d[t[e+3]]+"-"+$d[t[e+4]]+$d[t[e+5]]+"-"+$d[t[e+6]]+$d[t[e+7]]+"-"+$d[t[e+8]]+$d[t[e+9]]+"-"+$d[t[e+10]]+$d[t[e+11]]+$d[t[e+12]]+$d[t[e+13]]+$d[t[e+14]]+$d[t[e+15]]).toLowerCase()}var $d,rle,K$t=b(()=>{$d=[];for(rle=0;rle<256;++rle)$d.push((rle+256).toString(16).slice(1))});function aFe(){if(!nle&&(nle=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!nle))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return nle(Wln)}var nle,Wln,G$t=b(()=>{Wln=new Uint8Array(16)});var Kln,sFe,J$t=b(()=>{Kln=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),sFe={randomUUID:Kln}});function Gln(t,e,r){if(sFe.randomUUID&&!e&&!t)return sFe.randomUUID();t=t||{};var n=t.random||(t.rng||aFe)();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 W$t(n)}var uFe,Z$t=b(()=>{J$t();G$t();K$t();uFe=Gln});var Y$t=b(()=>{Z$t()});function X$t(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 ole(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=>Vi(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 Zln(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function Q$t(t){return t._getType()==="tool"}function eBt(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 Yln(t){if(t){if(t.every(Zln))return t;if(t.every(kd))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:eBt(e.function.parameters)}));if(t.every(Hc))return t.map(e=>{let r=os(e.schema);return{name:e.name,description:e.description??"",parameterDefinitions:eBt(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var tBt,ile,rBt=b(()=>{tBt=j(nK(),1);Ug();Fs();tg();rg();UC();Gf();Fs();to();Y$t();ile=class extends Cu{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??ct("COHERE_API_KEY");if(!r)throw new Error("No API key provided for ChatCohere.");this.client=new tBt.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:Yln(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(!(Vi(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=ole(c,s);i.push(d),s=[]}}else i.push(ole(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=ole(c,s);i.push(d),s=[]}}else i.push(ole(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(Q$t(o)){let i=o,a=n.filter(s=>Vi(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:X$t(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!Q$t(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>Vi(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:X$t(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:uFe().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 h=p.generationInfo?.completion??0;d[h]===void 0?d[h]=p:d[h]=d[h].concat(p)}return{generations:Object.entries(d).sort(([p],[h])=>parseInt(p,10)-parseInt(h,10)).map(([p,h])=>h),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 Fn({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 so({text:a.text,message:new xr({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new so({text:"",message:new xr({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 so({text:"",message:new xr({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 nBt=b(()=>{hj();CB();FA();oK();vv();g6()});var wL=b(()=>{nBt()});var Xln,iBt=b(()=>{Xln=j(nK(),1);to();wL()});var zp,aBt=b(()=>{OB();zp=class{constructor(e){Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.caller=new Oh(e??{})}}});var CP=b(()=>{aBt()});var Up,sBt=b(()=>{Up=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),a=r[i]||[];return r[i]=a.concat([n]),r},[])});var Cy=b(()=>{sBt()});var uBt,ale,lBt=b(()=>{uBt=j(nK(),1);to();CP();Cy();ale=class extends zp{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||ct("COHERE_API_KEY");if(!n)throw new Error("Cohere API key not found");if(this.client=new uBt.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=Up(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 cBt=b(()=>{});var dBt=b(()=>{cBt()});var Qln,fBt=b(()=>{dBt();to();Qln=j(nK(),1)});var pBt=b(()=>{rBt();iBt();lBt();fBt()});var lFe=b(()=>{pBt()});function ocn(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${ncn}/${rcn}`),e.join(" ")}async function icn(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",ocn(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 qC(`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 qC(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new qC(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function acn(t,e,r,n,o,i){let a=new cFe(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},ccn(i)),{method:"POST",headers:await icn(a),body:o})}}async function uK(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await acn(t,e,r,n,o,i);return scn(s,u,a)}async function scn(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){ucn(o,t)}return n.ok||await lcn(n,t),n}function ucn(t,e){let r=t;throw t instanceof ule||t instanceof qC||(r=new Jf(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function lcn(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 ule(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function ccn(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 fFe(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.`),sle(t.candidates[0]))throw new LM(`${FM(t)}`,t);return dcn(t)}else if(t.promptFeedback)throw new LM(`Text not available. ${FM(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.`),sle(t.candidates[0]))throw new LM(`${FM(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),xBt(t)[0]}else if(t.promptFeedback)throw new LM(`Function call not available. ${FM(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.`),sle(t.candidates[0]))throw new LM(`${FM(t)}`,t);return xBt(t)}else if(t.promptFeedback)throw new LM(`Function call not available. ${FM(t)}`,t)},t}function dcn(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 xBt(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}function sle(t){return!!t.finishReason&&fcn.includes(t.finishReason)}function FM(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];sle(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function aK(t){return this instanceof aK?(this.v=t,this):new aK(t)}function pcn(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(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof aK?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 mcn(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=ycn(e),[n,o]=r.tee();return{stream:gcn(n),response:hcn(o)}}async function hcn(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return fFe(bcn(e));e.push(o)}}function gcn(t){return pcn(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield aK(r.read());if(o)break;yield yield aK(fFe(n))}})}function ycn(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 Jf("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match(SBt),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new Jf(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match(SBt)}return i()})}}})}function bcn(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 PBt(t,e,r,n){let o=await uK(e,OL.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return mcn(o)}async function TBt(t,e,r,n){let i=await(await uK(e,OL.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:fFe(i)}}function ABt(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 sK(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 _cn(e)}function _cn(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 Jf("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 Jf("No content is provided for sending chat message.");return n?e:r}function vcn(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 qC("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=sK(t);n.contents=[i]}return{generateContentRequest:n}}function CBt(t){let e;return t.contents?e=t:e={contents:[sK(t)]},t.systemInstruction&&(e.systemInstruction=ABt(t.systemInstruction)),e}function wcn(t){return typeof t=="string"||Array.isArray(t)?{content:sK(t)}:t}function Scn(t){let e=!1;for(let r of t){let{role:n,parts:o}=r;if(!e&&n!=="user")throw new Jf(`First content should be with role 'user', got ${n}`);if(!yBt.includes(n))throw new Jf(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(yBt)}`);if(!Array.isArray(o))throw new Jf("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new Jf("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 OBt)u in s&&(i[u]+=1);let a=xcn[n];for(let s of OBt)if(!a.includes(s)&&i[s]>0)throw new Jf(`Content with role '${n}' can't contain '${s}' part`);e=!0}}async function Ccn(t,e,r,n){return(await uK(e,OL.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function Ocn(t,e,r,n){return(await uK(e,OL.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function Ecn(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await uK(e,OL.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var mBt,hBt,gBt,yBt,xL,SL,bBt,_Bt,iK,vBt,CL,wBt,Jf,LM,ule,qC,ecn,tcn,rcn,ncn,OL,cFe,fcn,SBt,OBt,xcn,EBt,dFe,lle,EL,lK=b(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(mBt||(mBt={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(hBt||(hBt={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(gBt||(gBt={}));yBt=["user","model","function","system"];(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"})(xL||(xL={}));(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"})(SL||(SL={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(bBt||(bBt={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(_Bt||(_Bt={}));(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"})(iK||(iK={}));(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"})(vBt||(vBt={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(CL||(CL={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(wBt||(wBt={}));Jf=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},LM=class extends Jf{constructor(e,r){super(e),this.response=r}},ule=class extends Jf{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},qC=class extends Jf{};ecn="https://generativelanguage.googleapis.com",tcn="v1beta",rcn="0.21.0",ncn="genai-js";(function(t){t.GENERATE_CONTENT="generateContent",t.STREAM_GENERATE_CONTENT="streamGenerateContent",t.COUNT_TOKENS="countTokens",t.EMBED_CONTENT="embedContent",t.BATCH_EMBED_CONTENTS="batchEmbedContents"})(OL||(OL={}));cFe=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)||tcn,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||ecn}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};fcn=[iK.RECITATION,iK.SAFETY,iK.LANGUAGE];SBt=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;OBt=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],xcn={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};EBt="SILENT_ERROR",dFe=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&&(Scn(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=sK(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(()=>TBt(this._apiKey,this.model,c,d)).then(p=>{var h;if(p.response.candidates&&p.response.candidates.length>0){this._history.push(l);let m=Object.assign({parts:[],role:"model"},(h=p.response.candidates)===null||h===void 0?void 0:h[0].content);this._history.push(m)}else{let m=FM(p.response);m&&console.warn(`sendMessage() was unsuccessful. ${m}. 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=sK(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=PBt(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(EBt)}).then(p=>p.response).then(p=>{if(p.candidates&&p.candidates.length>0){this._history.push(l);let h=Object.assign({},p.candidates[0].content);h.role||(h.role="model"),this._history.push(h)}else{let h=FM(p);h&&console.warn(`sendMessageStream() was unsuccessful. ${h}. Inspect response object for details.`)}}).catch(p=>{p.message!==EBt&&console.error(p)}),f}};lle=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=ABt(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=CBt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return TBt(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=CBt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return PBt(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 dFe(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=vcn(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 Ccn(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=wcn(e),o=Object.assign(Object.assign({},this._requestOptions),r);return Ocn(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return Ecn(this.apiKey,this.model,e,n)}};EL=class{constructor(e){this.apiKey=e}getGenerativeModel(e,r){if(!e.model)throw new Jf("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new lle(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new qC("Cached content must contain a `name` field.");if(!e.model)throw new qC("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 qC(`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 lle(this.apiKey,i,n)}}});var IBt=b(()=>{gE()});var PL=b(()=>{IBt()});function Qq(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(Qq):typeof e[r]=="object"&&e[r]!==null&&(e[r]=Qq(e[r])));return e}return t}function cle(t){let e=Qq(os(t)),{$schema:r,...n}=e;return n}function MBt(t){let e=Qq(t),{$schema:r,...n}=e;return n}var dle=b(()=>{Ug()});function Pcn(t){let e=t._getType();return Js.isInstance(t)?t.role:e==="tool"?e:t.name??e}function Tcn(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 Acn(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};throw new Error("Invalid media content")}function Icn(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 Acn(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 pFe(t,e,r=!1){return t.reduce((n,o,i)=>{if(!kg(o))throw new Error("Unsupported message input");let a=Pcn(o);if(a==="system"&&i!==0)throw new Error("System message should be the first one");let s=Tcn(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=Icn(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 RBt(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 Fn({content:a,tool_calls:r?.map(l=>({...l,type:"tool_call"})),additional_kwargs:{...i},usage_metadata:e?.usageMetadata}),generationInfo:i}]}}function NBt(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 so({text:s,message:new xr({content:a||"",name:o?o.role:void 0,tool_call_chunks:u,additional_kwargs:{},usage_metadata:e.usageMetadata}),generationInfo:i})}function jBt(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(Hc(e)){let r=cle(e.schema);return{name:e.name,description:e.description,parameters:r}}return kd(e)?{name:e.function.name,description:e.function.description??"A function available to call.",parameters:MBt(e.function.parameters)}:e})}]}var mFe=b(()=>{Fs();Gf();rg();tg();dle()});var cK,DBt=b(()=>{Mb();cK=class extends gj{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 Ah(`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)}}});function hFe(t,e){let r=Mcn(t),n=Ncn(r,e);return{tools:r,toolConfig:n}}function Mcn(t){let e=[],r=[];return t.forEach(o=>{if(Hc(o)){let[i]=jBt([o]);i.functionDeclarations&&e.push(...i.functionDeclarations)}else if(kd(o)){let{functionDeclarations:i}=Rcn(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 Rcn(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:Qq(t.function.parameters)}]}}function Ncn(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:CL.ANY,auto:CL.AUTO,none:CL.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:CL.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var LBt=b(()=>{lK();rg();tg();mFe();dle()});var fle,FBt=b(()=>{lK();to();UC();Om();PL();dle();mFe();DBt();LBt();fle=class extends Cu{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??ct("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 EL(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 EL(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:hFe(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?hFe(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=pFe(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 h of d){let m=h.generationInfo?.completion??0;f[m]===void 0?f[m]=h:f[m]=f[m].concat(h)}return{generations:Object.entries(f).sort(([h],[m])=>parseInt(h,10)-parseInt(m,10)).map(([h,m])=>m),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=RBt(s.response,{usageMetadata:u});return await n?.handleLLMNewToken(l.generations[0].text??""),l}async*_streamResponseChunks(e,r,n){let o=pFe(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 h=p.candidatesTokenCount-l.output_tokens;l={input_tokens:0,output_tokens:h,total_tokens:h}}}let f=NBt(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(xv(n)){let h=cle(n);l=[{functionDeclarations:[{name:s,description:h.description??"A function available to call.",parameters:h}]}],u=new cK({returnSingle:!0,keyName:s,zodSchema:n})}else{let h;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(h=n,s=n.name):h={name:s,description:n.description??"",parameters:n},l=[{functionDeclarations:[h]}],u=new cK({returnSingle:!0,keyName:s})}let c=this.bind({tools:l,tool_choice:s});if(!a)return c.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let d=jo.assign({parsed:(h,m)=>u.invoke(h.raw,m)}),f=jo.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return ji.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}}});var ple,kBt=b(()=>{lK();to();CP();Cy();ple=class extends zp{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??ct("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 EL(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=Up(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 $Bt=b(()=>{FBt();kBt()});var gFe=b(()=>{$Bt()});function jcn(t){return t&&DataView.prototype.isPrototypeOf(t)}function e2(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 bFe(t){return typeof t!="string"&&(t=String(t)),t}function _Fe(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return qp.iterable&&(e[Symbol.iterator]=function(){return e}),e}function pc(t){this.map={},t instanceof pc?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)}function yFe(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function qBt(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function Dcn(t){var e=new FileReader,r=qBt(e);return e.readAsArrayBuffer(t),r}function Lcn(t){var e=new FileReader,r=qBt(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function Fcn(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 zBt(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function HBt(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:qp.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:qp.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:qp.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():qp.arrayBuffer&&qp.blob&&jcn(t)?(this._bodyArrayBuffer=zBt(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):qp.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||UBt(t))?this._bodyArrayBuffer=zBt(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):qp.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},qp.blob&&(this.blob=function(){var t=yFe(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=yFe(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(qp.blob)return this.blob().then(Dcn);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var t=yFe(this);if(t)return t;if(this._bodyBlob)return Lcn(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Fcn(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},qp.formData&&(this.formData=function(){return this.text().then(Bcn)}),this.json=function(){return this.text().then(JSON.parse)},this}function $cn(t){var e=t.toUpperCase();return kcn.indexOf(e)>-1?e:t}function AL(t,e){if(!(this instanceof AL))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 AL){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new pc(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 pc(e.headers)),this.method=$cn(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in Bd){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()}}}function Bcn(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 zcn(t){var e=new pc,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}function HC(t,e){if(!(this instanceof HC))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 pc(e.headers),this.url=e.url||"",this._initBody(t)}function VBt(t,e){return new Promise(function(r,n){var o=new AL(t,e);if(o.signal&&o.signal.aborted)return n(new TL("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:zcn(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 HC(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 TL("Aborted","AbortError"))},0)};function s(l){try{return l===""&&Bd.location.href?Bd.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&&(qp.blob?i.responseType="blob":qp.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof pc||Bd.Headers&&e.headers instanceof Bd.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(e2(l)),i.setRequestHeader(l,bFe(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)})}var Bd,qp,BBt,UBt,kcn,Ucn,TL,WBt=b(()=>{Bd=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},qp={searchParams:"URLSearchParams"in Bd,iterable:"Symbol"in Bd&&"iterator"in Symbol,blob:"FileReader"in Bd&&"Blob"in Bd&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in Bd,arrayBuffer:"ArrayBuffer"in Bd};qp.arrayBuffer&&(BBt=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],UBt=ArrayBuffer.isView||function(t){return t&&BBt.indexOf(Object.prototype.toString.call(t))>-1});pc.prototype.append=function(t,e){t=e2(t),e=bFe(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};pc.prototype.delete=function(t){delete this.map[e2(t)]};pc.prototype.get=function(t){return t=e2(t),this.has(t)?this.map[t]:null};pc.prototype.has=function(t){return this.map.hasOwnProperty(e2(t))};pc.prototype.set=function(t,e){this.map[e2(t)]=bFe(e)};pc.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};pc.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),_Fe(t)};pc.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),_Fe(t)};pc.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),_Fe(t)};qp.iterable&&(pc.prototype[Symbol.iterator]=pc.prototype.entries);kcn=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];AL.prototype.clone=function(){return new AL(this,{body:this._bodyInit})};HBt.call(AL.prototype);HBt.call(HC.prototype);HC.prototype.clone=function(){return new HC(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new pc(this.headers),url:this.url})};HC.error=function(){var t=new HC(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};Ucn=[301,302,303,307,308];HC.redirect=function(t,e){if(Ucn.indexOf(e)===-1)throw new RangeError("Invalid status code");return new HC(null,{status:e,headers:{location:t}})};TL=Bd.DOMException;try{new TL}catch{TL=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},TL.prototype=Object.create(Error.prototype),TL.prototype.constructor=TL}VBt.polyfill=!0;Bd.fetch||(Bd.fetch=VBt,Bd.Headers=pc,Bd.Request=AL,Bd.Response=HC)});function Wcn(){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 Kcn(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 qcn,GBt,JBt,Hcn,Vcn,vFe,xFe,SFe,CFe,OFe,KBt,t2,Gcn,Jcn,Zcn,Ycn,Xcn,wFe,r2,EKo,mle=b(()=>{WBt();qcn="0.5.14",GBt="11434",JBt=`http://127.0.0.1:${GBt}`,Hcn=Object.defineProperty,Vcn=(t,e,r)=>e in t?Hcn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vFe=(t,e,r)=>(Vcn(t,typeof e!="symbol"?e+"":e,r),r),xFe=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)}},SFe=class{constructor(e,r,n){vFe(this,"abortController"),vFe(this,"itr"),vFe(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.")}},CFe=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 xFe(e,t.status)};OFe=async(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${qcn} (${Wcn()})`};r.headers=Kcn(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)},KBt=async(t,e,r)=>{let n=await OFe(t,e,{headers:r?.headers});return await CFe(n),n},t2=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await OFe(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await CFe(a),a},Gcn=async(t,e,r,n)=>{let o=await OFe(t,e,{method:"DELETE",body:JSON.stringify(r),headers:n?.headers});return await CFe(o),o},Jcn=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)}},Zcn=t=>{if(!t)return JBt;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=GBt);let o=`${r.protocol}//${r.hostname}:${n}${r.pathname}`;return o.endsWith("/")&&(o=o.slice(0,-1)),o},Ycn=Object.defineProperty,Xcn=(t,e,r)=>e in t?Ycn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wFe=(t,e,r)=>(Xcn(t,typeof e!="symbol"?e+"":e,r),r),r2=class{constructor(e){wFe(this,"config"),wFe(this,"fetch"),wFe(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=Zcn(e?.host??JBt)),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 t2(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=Jcn(a.body),u=new SFe(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await t2(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 Gcn(this.fetch,`${this.config.host}/api/delete`,{name:e.model},{headers:this.config.headers}),{status:"success"}}async copy(e){return await t2(this.fetch,`${this.config.host}/api/copy`,{...e},{headers:this.config.headers}),{status:"success"}}async list(){return await(await KBt(this.fetch,`${this.config.host}/api/tags`,{headers:this.config.headers})).json()}async show(e){return await(await t2(this.fetch,`${this.config.host}/api/show`,{...e},{headers:this.config.headers})).json()}async embed(e){return await(await t2(this.fetch,`${this.config.host}/api/embed`,{...e},{headers:this.config.headers})).json()}async embeddings(e){return await(await t2(this.fetch,`${this.config.host}/api/embeddings`,{...e},{headers:this.config.headers})).json()}async ps(){return await(await KBt(this.fetch,`${this.config.host}/api/ps`,{headers:this.config.headers})).json()}},EKo=new r2});var ZBt=b(()=>{vv()});function YBt(t,e=0){return(zd[t[e+0]]+zd[t[e+1]]+zd[t[e+2]]+zd[t[e+3]]+"-"+zd[t[e+4]]+zd[t[e+5]]+"-"+zd[t[e+6]]+zd[t[e+7]]+"-"+zd[t[e+8]]+zd[t[e+9]]+"-"+zd[t[e+10]]+zd[t[e+11]]+zd[t[e+12]]+zd[t[e+13]]+zd[t[e+14]]+zd[t[e+15]]).toLowerCase()}var zd,hle,XBt=b(()=>{zd=[];for(hle=0;hle<256;++hle)zd.push((hle+256).toString(16).slice(1))});function EFe(){if(!gle&&(gle=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!gle))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return gle(Qcn)}var gle,Qcn,QBt=b(()=>{Qcn=new Uint8Array(16)});var edn,PFe,ezt=b(()=>{edn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),PFe={randomUUID:edn}});function tdn(t,e,r){if(PFe.randomUUID&&!e&&!t)return PFe.randomUUID();t=t||{};var n=t.random||(t.rng||EFe)();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 YBt(n)}var TFe,tzt=b(()=>{ezt();QBt();XBt();TFe=tdn});var rzt=b(()=>{tzt()});function AFe(t,e){return new xr({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:TFe()})),response_metadata:e?.responseMetadata,usage_metadata:e?.usageMetadata})}function nzt(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function rdn(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 ndn(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:[nzt(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[nzt(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function odn(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 idn(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function ozt(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return ndn(e);if(e._getType()==="ai")return rdn(e);if(e._getType()==="system")return odn(e);if(e._getType()==="tool")return idn(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var izt=b(()=>{Fs();rzt()});var yle,azt=b(()=>{Fs();UC();mle();Gf();Fs();Om();rg();ZBt();Mb();PL();Ug();izt();yle=class extends Cu{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 r2({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=>zC(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=>zC(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=Rc(o,a.message):o=a.message;let i=new Fn({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=ozt(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 so({text:c.content,message:AFe(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 so({text:c.content??"",message:AFe(c)}),await n?.handleLLMNewToken(c.content??"")}yield new so({text:"",message:new xr({content:"",response_metadata:u,usage_metadata:a})})}withStructuredOutput(e,r){if(r?.method===void 0||r?.method==="jsonSchema"){let n=xv(e),o=n?os(e):e,i=this.bind({format:o}),a=n?wd.fromZodSchema(e):new xd;if(!r?.includeRaw)return i.pipe(a);let s=jo.assign({parsed:(c,d)=>a.invoke(c.raw,d)}),u=jo.assign({parsed:()=>null}),l=s.withFallbacks({fallbacks:[u]});return ji.from([{raw:i},l])}else return super.withStructuredOutput(e,r)}}});var ble,szt=b(()=>{CP();mle();ble=class extends zp{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 r2({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}}});var uzt=b(()=>{});var lzt=b(()=>{Gf();wL();mle()});var czt=b(()=>{azt();szt();uzt();lzt()});var IFe=b(()=>{czt()});function er(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 ce(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)}var Oy=b(()=>{});var MFe,RFe=b(()=>{MFe=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return MFe=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))}});function dK(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var fK,_le=b(()=>{fK=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)}});var gt,mc,ks,kM,VC,n2,o2,i2,a2,s2,u2,l2,c2,d2,f2,WC,KC=b(()=>{_le();gt=class extends Error{},mc=class t extends gt{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("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 kM({message:n,cause:fK(r)});let i=r?.error;return e===400?new n2(e,i,n,o):e===401?new o2(e,i,n,o):e===403?new i2(e,i,n,o):e===404?new a2(e,i,n,o):e===409?new s2(e,i,n,o):e===422?new u2(e,i,n,o):e===429?new l2(e,i,n,o):e>=500?new c2(e,i,n,o):new t(e,i,n,o)}},ks=class extends mc{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},kM=class extends mc{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},VC=class extends kM{constructor({message:e}={}){super({message:e??"Request timed out."})}},n2=class extends mc{},o2=class extends mc{},i2=class extends mc{},a2=class extends mc{},s2=class extends mc{},u2=class extends mc{},l2=class extends mc{},c2=class extends mc{},d2=class extends gt{constructor(){super("Could not parse response content as the length limit was reached")}},f2=class extends gt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},WC=class extends Error{constructor(e){super(e)}}});function fzt(t){return typeof t!="object"?{}:t??{}}function pzt(t){if(!t)return!0;for(let e in t)return!1;return!0}function mzt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function p2(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var sdn,dzt,Zf,NFe,hzt,gzt,OP=b(()=>{KC();sdn=/^[a-z][a-z0-9+.-]*:/i,dzt=t=>sdn.test(t),Zf=t=>(Zf=Array.isArray,Zf(t)),NFe=Zf;hzt=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new gt(`${t} must be an integer`);if(e<0)throw new gt(`${t} must be a positive integer`);return e},gzt=t=>{try{return JSON.parse(t)}catch{return}}});var GC,m2=b(()=>{GC=t=>new Promise(e=>setTimeout(e,t))});var $M,jFe=b(()=>{$M="5.12.1"});function udn(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}function cdn(){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 vzt,ldn,yzt,bzt,_zt,wzt,DFe=b(()=>{jFe();vzt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";ldn=()=>{let t=udn();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$M,"X-Stainless-OS":bzt(Deno.build.os),"X-Stainless-Arch":yzt(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":$M,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$M,"X-Stainless-OS":bzt(globalThis.process.platform??"unknown"),"X-Stainless-Arch":yzt(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=cdn();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$M,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$M,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};yzt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",bzt=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"),wzt=()=>_zt??(_zt=ldn())});function xzt(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function LFe(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function vle(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return LFe({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function FFe(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}}}async function Szt(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var pK=b(()=>{});var Czt,Ozt=b(()=>{Czt=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});var wle,kFe,xle,$Fe,Sle=b(()=>{wle="RFC3986",kFe=t=>String(t),xle={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:kFe},$Fe="RFC1738"});function Pzt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function zFe(t,e){if(Zf(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var Cle,JC,BFe,Ezt,Tzt=b(()=>{Sle();OP();Cle=(t,e)=>(Cle=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Cle(t,e)),JC=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),BFe=1024,Ezt=(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+=BFe){let u=i.length>=BFe?i.slice(s,s+BFe):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===$Fe&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=JC[d];continue}if(d<2048){l[l.length]=JC[192|d>>6]+JC[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=JC[224|d>>12]+JC[128|d>>6&63]+JC[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=JC[240|d>>18]+JC[128|d>>12&63]+JC[128|d>>6&63]+JC[128|d&63]}a+=l.join("")}return a}});function pdn(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function Rzt(t,e,r,n,o,i,a,s,u,l,c,d,f,p,h,m,g,y){let _=t,w=y,S=0,C=!1;for(;(w=w.get(UFe))!==void 0&&!C;){let N=w.get(t);if(S+=1,typeof N<"u"){if(N===S)throw new RangeError("Cyclic object value");C=!0}typeof w.get(UFe)>"u"&&(S=0)}if(typeof l=="function"?_=l(e,_):_ instanceof Date?_=f?.(_):r==="comma"&&Zf(_)&&(_=zFe(_,function(N){return N instanceof Date?f?.(N):N})),_===null){if(i)return u&&!m?u(e,hc.encoder,g,"key",p):e;_=""}if(pdn(_)||Pzt(_)){if(u){let N=m?e:u(e,hc.encoder,g,"key",p);return[h?.(N)+"="+h?.(u(_,hc.encoder,g,"value",p))]}return[h?.(e)+"="+h?.(String(_))]}let E=[];if(typeof _>"u")return E;let P;if(r==="comma"&&Zf(_))m&&u&&(_=zFe(_,u)),P=[{value:_.length>0?_.join(",")||null:void 0}];else if(Zf(l))P=l;else{let N=Object.keys(_);P=c?N.sort(c):N}let T=s?String(e).replace(/\./g,"%2E"):String(e),I=n&&Zf(_)&&_.length===1?T+"[]":T;if(o&&Zf(_)&&_.length===0)return I+"[]";for(let N=0;N<P.length;++N){let M=P[N],D=typeof M=="object"&&typeof M.value<"u"?M.value:_[M];if(a&&D===null)continue;let k=d&&s?M.replace(/\./g,"%2E"):M,F=Zf(_)?typeof r=="function"?r(I,k):I:I+(d?"."+k:"["+k+"]");y.set(t,S);let K=new WeakMap;K.set(UFe,y),Mzt(E,Rzt(D,F,r,n,o,i,a,s,r==="comma"&&m&&Zf(_)?null:u,l,c,d,f,p,h,m,g,K))}return E}function mdn(t=hc){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||hc.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=wle;if(typeof t.format<"u"){if(!Cle(xle,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=xle[r],o=hc.filter;(typeof t.filter=="function"||Zf(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in Izt?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=hc.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:hc.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:hc.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:hc.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:hc.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?hc.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:hc.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:hc.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:hc.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:hc.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:hc.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:hc.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:hc.strictNullHandling}}function qFe(t,e={}){let r=t,n=mdn(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Zf(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=Izt[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||Mzt(a,Rzt(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 Izt,Mzt,Azt,hc,UFe,Nzt=b(()=>{Tzt();Sle();OP();Izt={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},Mzt=function(t,e){Array.prototype.push.apply(t,Zf(e)?e:[e])},hc={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Ezt,encodeValuesOnly:!1,format:wle,formatter:kFe,indices:!1,serializeDate(t){return(Azt??(Azt=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};UFe={}});var jzt=b(()=>{Sle();Nzt()});function Fzt(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}function h2(t){let e;return(Dzt??(e=new globalThis.TextEncoder,Dzt=e.encode.bind(e)))(t)}function HFe(t){let e;return(Lzt??(e=new globalThis.TextDecoder,Lzt=e.decode.bind(e)))(t)}var Dzt,Lzt,Ole=b(()=>{});function gdn(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 kzt(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}var ng,og,IL,$zt=b(()=>{Oy();Ole();IL=class{constructor(){ng.set(this,void 0),og.set(this,void 0),er(this,ng,new Uint8Array,"f"),er(this,og,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?h2(e):e;er(this,ng,Fzt([ce(this,ng,"f"),r]),"f");let n=[],o;for(;(o=gdn(ce(this,ng,"f"),ce(this,og,"f")))!=null;){if(o.carriage&&ce(this,og,"f")==null){er(this,og,o.index,"f");continue}if(ce(this,og,"f")!=null&&(o.index!==ce(this,og,"f")+1||o.carriage)){n.push(HFe(ce(this,ng,"f").subarray(0,ce(this,og,"f")-1))),er(this,ng,ce(this,ng,"f").subarray(ce(this,og,"f")),"f"),er(this,og,null,"f");continue}let i=ce(this,og,"f")!==null?o.preceding-1:o.preceding,a=HFe(ce(this,ng,"f").subarray(0,i));n.push(a),er(this,ng,ce(this,ng,"f").subarray(o.index),"f"),er(this,og,null,"f")}return n}flush(){return ce(this,ng,"f").length?this.decode(`
`):[]}};ng=new WeakMap,og=new WeakMap;IL.NEWLINE_CHARS=new Set([`
`,"\r"]);IL.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function mK(){}function Ele(t,e,r){return!e||Ple[t]>Ple[r]?mK:e[t].bind(e)}function uu(t){let e=t.logger,r=t.logLevel??"off";if(!e)return ydn;let n=Bzt.get(e);if(n&&n[0]===r)return n[1];let o={error:Ele("error",e,r),warn:Ele("warn",e,r),info:Ele("info",e,r),debug:Ele("debug",e,r)};return Bzt.set(e,[r,o]),o}var Ple,VFe,ydn,Bzt,EP,hK=b(()=>{OP();Ple={off:0,error:200,warn:300,info:400,debug:500},VFe=(t,e,r)=>{if(t){if(mzt(Ple,t))return t;uu(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Ple))}`)}};ydn={error:mK,warn:mK,info:mK,debug:mK},Bzt=new WeakMap;EP=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t)});async function*bdn(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new gt("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new gt("Attempted to iterate over a response with no body");let r=new WFe,n=new IL,o=FFe(t.body);for await(let i of _dn(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*_dn(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"?h2(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=kzt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function vdn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var gK,ZC,WFe,KFe=b(()=>{Oy();KC();pK();$zt();pK();_le();Ole();hK();KC();ZC=class t{constructor(e,r,n){this.iterator=e,gK.set(this,void 0),this.controller=r,er(this,gK,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?uu(n):console;async function*a(){if(o)throw new gt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of bdn(e,r))if(!s){if(u.data.startsWith("[DONE]")){s=!0;continue}if(u.event===null||!u.event.startsWith("thread.")){let l;try{l=JSON.parse(u.data)}catch(c){throw i.error("Could not parse message into JSON:",u.data),i.error("From chunk:",u.raw),c}if(l&&l.error)throw new mc(void 0,l.error,void 0,e.headers);yield l}else{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(u.event=="error")throw new mc(void 0,l.error,l.message,void 0);yield{event:u.event,data:l}}}s=!0}catch(u){if(dK(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*i(){let s=new IL,u=FFe(e);for await(let l of u)for(let c of s.decode(l))yield c;for(let l of s.flush())yield l}async function*a(){if(o)throw new gt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of i())s||u&&(yield JSON.parse(u));s=!0}catch(u){if(dK(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}[(gK=new WeakMap,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,ce(this,gK,"f")),new t(()=>o(r),this.controller,ce(this,gK,"f"))]}toReadableStream(){let e=this,r;return LFe({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:i}=await r.next();if(i)return n.close();let a=h2(JSON.stringify(o)+`
`);n.enqueue(a)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};WFe=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]=vdn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function Tle(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,a=await(async()=>{if(e.options.stream)return uu(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):ZC.fromSSEResponse(r,e.controller,t);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let u=r.headers.get("content-type")?.split(";")[0]?.trim();if(u?.includes("application/json")||u?.endsWith("+json")){let d=await r.json();return GFe(d,r)}return await r.text()})();return uu(t).debug(`[${n}] response parsed`,EP({retryOfRequestLogID:o,url:r.url,status:r.status,body:a,durationMs:Date.now()-i})),a}function GFe(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 JFe=b(()=>{KFe();hK()});var yK,ML,Ale=b(()=>{Oy();JFe();ML=class t extends Promise{constructor(e,r,n=Tle){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,yK.set(this,void 0),er(this,yK,e,"f")}_thenUnwrap(e){return new t(ce(this,yK,"f"),this.responsePromise,async(r,n)=>GFe(e(await this.parseResponse(r,n),n),n.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(e=>this.parseResponse(ce(this,yK,"f"),e))),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)}};yK=new WeakMap});var Ile,Mle,bK,YC,Sn,Ka=b(()=>{Oy();KC();JFe();Ale();OP();Mle=class{constructor(e,r,n,o){Ile.set(this,void 0),er(this,Ile,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new gt("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await ce(this,Ile,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Ile=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},bK=class extends ML{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await Tle(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},YC=class extends Mle{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},Sn=class extends Mle{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()}nextPageRequestOptions(){let e=this.getPaginatedItems(),r=e[e.length-1]?.id;return r?{...this.options,query:{...fzt(this.options.query),after:r}}:null}}});function g2(t,e,r){return YFe(),new File(t,e??"unknown_file",r)}function _K(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}function xdn(t){let e=typeof t=="function"?t:t.fetch,r=zzt.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new o(i).text()}catch{return!0}})();return zzt.set(e,n),n}var YFe,XFe,ig,zzt,Sdn,Cdn,ZFe,PP=b(()=>{pK();YFe=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};XFe=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",ig=async(t,e)=>({...t,body:await Sdn(t.body,e)}),zzt=new WeakMap;Sdn=async(t,e)=>{if(!await xdn(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>ZFe(r,n,o))),r},Cdn=t=>t instanceof Blob&&"name"in t,ZFe=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(r instanceof Response)t.append(e,g2([await r.blob()],_K(r)));else if(XFe(r))t.append(e,g2([await new Response(vle(r)).blob()],_K(r)));else if(Cdn(r))t.append(e,r,_K(r));else if(Array.isArray(r))await Promise.all(r.map(n=>ZFe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>ZFe(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`)}}});async function vK(t,e,r){if(YFe(),t=await t,Odn(t))return t instanceof File?t:g2([await t.arrayBuffer()],t.name);if(Edn(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),g2(await QFe(o),e,r)}let n=await QFe(t);if(e||(e=_K(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return g2(n,e,r)}async function QFe(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Uzt(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(XFe(t))for await(let r of t)e.push(...await QFe(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${Pdn(t)}`)}return e}function Pdn(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var Uzt,Odn,Edn,qzt=b(()=>{PP();PP();Uzt=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",Odn=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Uzt(t),Edn=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function"});var eke=b(()=>{qzt()});var qe,jr=b(()=>{qe=class{constructor(e){this._client=e}}});function Vzt(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Hzt,Adn,Le,oa=b(()=>{KC();Hzt=Object.freeze(Object.create(null)),Adn=(t=Vzt)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],a=r.reduce((c,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=n[f],h=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??Hzt)??Hzt)?.toString)&&(h=p+"",i.push({start:c.length+d.length,length:h.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),c+d+(f===n.length?"":h)},""),s=a.split(/[?#]/,1)[0],u=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;for(;(l=u.exec(s))!==null;)i.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can't be safely passed as a path parameter`});if(i.sort((c,d)=>c.start-d.start),i.length>0){let c=0,d=i.reduce((f,p)=>{let h=" ".repeat(p.start-c),m="^".repeat(p.length);return c=p.start+p.length,f+h+m},"");throw new gt(`Path parameters result in path with invalid segments:
${i.map(f=>f.error).join(`
`)}
${a}
${d}`)}return a},Le=Adn(Vzt)});var RL,Rle=b(()=>{jr();Ka();oa();RL=class extends qe{list(e,r={},n){return this._client.getAPIList(Le`/chat/completions/${e}/messages`,Sn,{query:r,...n})}}});var s_=b(()=>{KC()});function wK(t){return t!==void 0&&"function"in t&&t.function!==void 0}function Wzt(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function xK(t){return t?.$brand==="auto-parseable-response-format"}function NL(t){return t?.$brand==="auto-parseable-tool"}function Kzt(t,e){return!e||!tke(e)?{...t,choices:t.choices.map(r=>(Jzt(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:SK(t,e)}function SK(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new d2;if(n.finish_reason==="content_filter")throw new f2;return Jzt(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>Ndn(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?Rdn(e,n.message.content):null}}});return{...t,choices:r}}function Rdn(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 Ndn(t,e){let r=t.tools?.find(n=>wK(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:NL(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function Gzt(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>wK(n)&&n.function?.name===e.function.name);return wK(r)&&(NL(r)||r?.function.strict||!1)}function tke(t){return xK(t.response_format)?!0:t.tools?.some(e=>NL(e)||e.type==="function"&&e.function.strict===!0)??!1}function Jzt(t){for(let e of t||[])if(e.type!=="function")throw new gt(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function Zzt(t){for(let e of t??[]){if(e.type!=="function")throw new gt(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new gt(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var y2=b(()=>{s_()});var b2,rke,nke=b(()=>{b2=t=>t?.role==="assistant",rke=t=>t?.role==="tool"});var oke,Nle,jle,CK,OK,Dle,EK,TP,PK,Lle,Fle,_2,Yzt,BM,kle=b(()=>{Oy();s_();BM=class{constructor(){oke.add(this),this.controller=new AbortController,Nle.set(this,void 0),jle.set(this,()=>{}),CK.set(this,()=>{}),OK.set(this,void 0),Dle.set(this,()=>{}),EK.set(this,()=>{}),TP.set(this,{}),PK.set(this,!1),Lle.set(this,!1),Fle.set(this,!1),_2.set(this,!1),er(this,Nle,new Promise((e,r)=>{er(this,jle,e,"f"),er(this,CK,r,"f")}),"f"),er(this,OK,new Promise((e,r)=>{er(this,Dle,e,"f"),er(this,EK,r,"f")}),"f"),ce(this,Nle,"f").catch(()=>{}),ce(this,OK,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},ce(this,oke,"m",Yzt).bind(this))},0)}_connected(){this.ended||(ce(this,jle,"f").call(this),this._emit("connect"))}get ended(){return ce(this,PK,"f")}get errored(){return ce(this,Lle,"f")}get aborted(){return ce(this,Fle,"f")}abort(){this.controller.abort()}on(e,r){return(ce(this,TP,"f")[e]||(ce(this,TP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=ce(this,TP,"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(ce(this,TP,"f")[e]||(ce(this,TP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{er(this,_2,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){er(this,_2,!0,"f"),await ce(this,OK,"f")}_emit(e,...r){if(ce(this,PK,"f"))return;e==="end"&&(er(this,PK,!0,"f"),ce(this,Dle,"f").call(this));let n=ce(this,TP,"f")[e];if(n&&(ce(this,TP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!ce(this,_2,"f")&&!n?.length&&Promise.reject(o),ce(this,CK,"f").call(this,o),ce(this,EK,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!ce(this,_2,"f")&&!n?.length&&Promise.reject(o),ce(this,CK,"f").call(this,o),ce(this,EK,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Nle=new WeakMap,jle=new WeakMap,CK=new WeakMap,OK=new WeakMap,Dle=new WeakMap,EK=new WeakMap,TP=new WeakMap,PK=new WeakMap,Lle=new WeakMap,Fle=new WeakMap,_2=new WeakMap,oke=new WeakSet,Yzt=function(e){if(er(this,Lle,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new ks),e instanceof ks)return er(this,Fle,!0,"f"),this._emit("abort",e);if(e instanceof gt)return this._emit("error",e);if(e instanceof Error){let r=new gt(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new gt(String(e)))}});function Xzt(t){return typeof t.parse=="function"}var ike=b(()=>{});var Hp,ake,$le,ske,uke,lke,Qzt,eUt,jdn,v2,cke=b(()=>{Oy();s_();y2();nke();kle();ike();jdn=10,v2=class extends BM{constructor(){super(...arguments),Hp.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),rke(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(b2(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionToolCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new gt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),ce(this,Hp,"m",ake).call(this)}async finalMessage(){return await this.done(),ce(this,Hp,"m",$le).call(this)}async finalFunctionToolCall(){return await this.done(),ce(this,Hp,"m",ske).call(this)}async finalFunctionToolCallResult(){return await this.done(),ce(this,Hp,"m",uke).call(this)}async totalUsage(){return await this.done(),ce(this,Hp,"m",lke).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=ce(this,Hp,"m",$le).call(this);r&&this._emit("finalMessage",r);let n=ce(this,Hp,"m",ake).call(this);n&&this._emit("finalContent",n);let o=ce(this,Hp,"m",ske).call(this);o&&this._emit("finalFunctionToolCall",o);let i=ce(this,Hp,"m",uke).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",ce(this,Hp,"m",lke).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),ce(this,Hp,"m",Qzt).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(SK(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 _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i.type==="function"&&i?.function?.name,{maxChatCompletions:l=jdn}=n||{},c=r.tools.map(p=>{if(NL(p)){if(!p.$callback)throw new gt("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 m=(await this._createChatCompletion(e,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!m)throw new gt("missing message in ChatCompletion response");if(!m.tool_calls?.length)return;for(let g of m.tool_calls){if(g.type!=="function")continue;let y=g.id,{name:_,arguments:w}=g.function,S=d[_];if(S){if(u&&u!==_){let T=`Invalid tool_call: ${JSON.stringify(_)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:y,content:T});continue}}else{let T=`Invalid tool_call: ${JSON.stringify(_)}. Available options are: ${Object.keys(d).map(I=>JSON.stringify(I)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:y,content:T});continue}let C;try{C=Xzt(S)?await S.parse(w):w}catch(T){let I=T instanceof Error?T.message:String(T);this._addMessage({role:o,tool_call_id:y,content:I});continue}let E=await S.function(C,this),P=ce(this,Hp,"m",eUt).call(this,E);if(this._addMessage({role:o,tool_call_id:y,content:P}),u)return}}}};Hp=new WeakSet,ake=function(){return ce(this,Hp,"m",$le).call(this).content??null},$le=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(b2(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new gt("stream ended without producing a ChatCompletionMessage with role=assistant")},ske=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(b2(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},uke=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(rke(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}},lke=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},Qzt=function(e){if(e.n!=null&&e.n>1)throw new gt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},eUt=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var TK,dke=b(()=>{cke();nke();TK=class t extends v2{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),b2(e)&&e.content&&this._emit("content",e.content)}}});function Ddn(t,e=Vc.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return Ldn(t.trim(),e)}var Vc,fke,pke,Ldn,mke,tUt=b(()=>{Vc={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},fke=class extends Error{},pke=class extends Error{};Ldn=(t,e)=>{let r=t.length,n=0,o=f=>{throw new fke(`${f} at position ${n}`)},i=f=>{throw new pke(`${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"||Vc.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Vc.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Vc.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Vc.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Vc.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||Vc.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(h){i(String(h))}else if(Vc.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&&Vc.OBJ&e)return f;let p=s();d(),n++;try{let h=a();Object.defineProperty(f,p,{value:h,writable:!0,enumerable:!0,configurable:!0})}catch(h){if(Vc.OBJ&e)return f;throw h}d(),t[n]===","&&n++}}catch{if(Vc.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(Vc.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&Vc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Vc.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&&!(Vc.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Vc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(h){i(String(h))}}},d=()=>{for(;n<r&&`
\r `.includes(t[n]);)n++};return a()},mke=t=>Ddn(t,Vc.ALL^Vc.NUM)});var hke=b(()=>{KFe()});function Fdn(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 gt(`missing finish_reason for choice ${d}`);let{content:h=null,function_call:m,tool_calls:g,...y}=l,_=l.role;if(!_)throw new gt(`missing role for choice ${d}`);if(m){let{arguments:w,name:S}=m;if(w==null)throw new gt(`missing function_call.arguments for choice ${d}`);if(!S)throw new gt(`missing function_call.name for choice ${d}`);return{...p,message:{content:h,function_call:{arguments:w,name:S},role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return g?{...p,index:d,finish_reason:c,logprobs:f,message:{...y,role:_,content:h,refusal:l.refusal??null,tool_calls:g.map((w,S)=>{let{function:C,type:E,id:P,...T}=w,{arguments:I,name:N,...M}=C||{};if(P==null)throw new gt(`missing choices[${d}].tool_calls[${S}].id
${Ule(t)}`);if(E==null)throw new gt(`missing choices[${d}].tool_calls[${S}].type
${Ule(t)}`);if(N==null)throw new gt(`missing choices[${d}].tool_calls[${S}].function.name
${Ule(t)}`);if(I==null)throw new gt(`missing choices[${d}].tool_calls[${S}].function.arguments
${Ule(t)}`);return{...T,id:P,type:E,function:{...M,name:N,arguments:I}}})}}:{...p,message:{...y,content:h,role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return Kzt(u,e)}function Ule(t){return JSON.stringify(t)}var gc,AP,w2,zM,gke,Ble,yke,bke,_ke,zle,vke,rUt,jL,qle=b(()=>{Oy();tUt();s_();y2();hke();cke();jL=class t extends v2{constructor(e){super(),gc.add(this),AP.set(this,void 0),w2.set(this,void 0),zM.set(this,void 0),er(this,AP,e,"f"),er(this,w2,[],"f")}get currentChatCompletionSnapshot(){return ce(this,zM,"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())),ce(this,gc,"m",gke).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)ce(this,gc,"m",yke).call(this,a);if(i.controller.signal?.aborted)throw new ks;return this._addChatCompletion(ce(this,gc,"m",zle).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),ce(this,gc,"m",gke).call(this),this._connected();let o=ZC.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(ce(this,gc,"m",zle).call(this)),ce(this,gc,"m",yke).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new ks;return this._addChatCompletion(ce(this,gc,"m",zle).call(this))}[(AP=new WeakMap,w2=new WeakMap,zM=new WeakMap,gc=new WeakSet,gke=function(){this.ended||er(this,zM,void 0,"f")},Ble=function(r){let n=ce(this,w2,"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},ce(this,w2,"f")[r.index]=n,n)},yke=function(r){if(this.ended)return;let n=ce(this,gc,"m",rUt).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=ce(this,gc,"m",Ble).call(this,i);i.finish_reason&&(ce(this,gc,"m",_ke).call(this,i),a.current_tool_call_index!=null&&ce(this,gc,"m",bke).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(ce(this,gc,"m",_ke).call(this,i),a.current_tool_call_index!=null&&ce(this,gc,"m",bke).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))}}},bke=function(r,n){if(ce(this,gc,"m",Ble).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=ce(this,AP,"f")?.tools?.find(s=>wK(s)&&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:NL(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},_ke=function(r){let n=ce(this,gc,"m",Ble).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=ce(this,gc,"m",vke).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}))},zle=function(){if(this.ended)throw new gt("stream has ended, this shouldn't happen");let r=ce(this,zM,"f");if(!r)throw new gt("request ended without sending any chunks");return er(this,zM,void 0,"f"),er(this,w2,[],"f"),Fdn(r,ce(this,AP,"f"))},vke=function(){let r=ce(this,AP,"f")?.response_format;return xK(r)?r:null},rUt=function(r){var n,o,i,a;let s=ce(this,zM,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=er(this,zM,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...h}of r.choices){let m=s.choices[f];if(m||(m=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...h}),p)if(!m.logprobs)m.logprobs=Object.assign({},p);else{let{content:E,refusal:P,...T}=p;Object.assign(m.logprobs,T),E&&((n=m.logprobs).content??(n.content=[]),m.logprobs.content.push(...E)),P&&((o=m.logprobs).refusal??(o.refusal=[]),m.logprobs.refusal.push(...P))}if(d&&(m.finish_reason=d,ce(this,AP,"f")&&tke(ce(this,AP,"f")))){if(d==="length")throw new d2;if(d==="content_filter")throw new f2}if(Object.assign(m,h),!c)continue;let{content:g,refusal:y,function_call:_,role:w,tool_calls:S,...C}=c;if(Object.assign(m.message,C),y&&(m.message.refusal=(m.message.refusal||"")+y),w&&(m.message.role=w),_&&(m.message.function_call?(_.name&&(m.message.function_call.name=_.name),_.arguments&&((i=m.message.function_call).arguments??(i.arguments=""),m.message.function_call.arguments+=_.arguments)):m.message.function_call=_),g&&(m.message.content=(m.message.content||"")+g,!m.message.refusal&&ce(this,gc,"m",vke).call(this)&&(m.message.parsed=mke(m.message.content))),S){m.message.tool_calls||(m.message.tool_calls=[]);for(let{index:E,id:P,type:T,function:I,...N}of S){let M=(a=m.message.tool_calls)[E]??(a[E]={});Object.assign(M,N),P&&(M.id=P),T&&(M.type=T),I&&(M.function??(M.function={name:I.name??"",arguments:""})),I?.name&&(M.function.name=I.name),I?.arguments&&(M.function.arguments+=I.arguments,Gzt(ce(this,AP,"f"),M)&&(M.function.parsed_arguments=mke(M.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 ZC(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var AK,wke=b(()=>{qle();AK=class t extends jL{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}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 IP,IK=b(()=>{jr();Rle();Rle();Ka();oa();dke();wke();qle();y2();wke();ike();qle();dke();IP=class extends qe{constructor(){super(...arguments),this.messages=new RL(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(Le`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(Le`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",Sn,{query:e,...r})}delete(e,r){return this._client.delete(Le`/chat/completions/${e}`,r)}parse(e,r){return Zzt(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>SK(n,e))}runTools(e,r){return e.stream?AK.runTools(this._client,e,r):TK.runTools(this._client,e,r)}stream(e,r){return jL.createChatCompletion(this._client,e,r)}};IP.Messages=RL});var UM,xke=b(()=>{jr();IK();IK();UM=class extends qe{constructor(){super(...arguments),this.completions=new IP(this._client)}};UM.Completions=IP});var nUt=b(()=>{IK();IK();Rle()});var oUt=b(()=>{xke();nUt()});var iUt=b(()=>{});function*$dn(t){if(!t)return;if(aUt in t){let{values:n,nulls:o}=t;yield*n.entries();for(let i of o)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():NFe(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=NFe(n[1])?n[1]:[n[1]],a=!1;for(let s of i)s!==void 0&&(e&&!a&&(a=!0,yield[o,null]),yield[o,s])}}var aUt,mt,Ou=b(()=>{OP();aUt=Symbol("brand.privateNullableHeaders");mt=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,a]of $dn(n)){let s=i.toLowerCase();o.has(s)||(e.delete(i),o.add(s)),a===null?(e.delete(i),r.add(s)):(e.append(i,a),r.delete(s))}}return{[aUt]:!0,values:e,nulls:r}}});var x2,Ske=b(()=>{jr();Ou();x2=class extends qe{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:mt([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}}});var S2,Cke=b(()=>{jr();PP();S2=class extends qe{create(e,r){return this._client.post("/audio/transcriptions",ig({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}}});var C2,Oke=b(()=>{jr();PP();C2=class extends qe{create(e,r){return this._client.post("/audio/translations",ig({body:e,...r,__metadata:{model:e.model}},this._client))}}});var XC,Eke=b(()=>{jr();Ske();Ske();Cke();Cke();Oke();Oke();XC=class extends qe{constructor(){super(...arguments),this.transcriptions=new S2(this._client),this.translations=new C2(this._client),this.speech=new x2(this._client)}};XC.Transcriptions=S2;XC.Translations=C2;XC.Speech=x2});var DL,Pke=b(()=>{jr();Ka();oa();DL=class extends qe{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(Le`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",Sn,{query:e,...r})}cancel(e,r){return this._client.post(Le`/batches/${e}/cancel`,r)}}});var O2,Tke=b(()=>{jr();Ka();Ou();oa();O2=class extends qe{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(Le`/assistants/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(Le`/assistants/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",Sn,{query:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(Le`/assistants/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var E2,Ake=b(()=>{jr();Ou();E2=class extends qe{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var P2,Ike=b(()=>{jr();Ou();P2=class extends qe{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var qM,Mke=b(()=>{jr();Ake();Ake();Ike();Ike();qM=class extends qe{constructor(){super(...arguments),this.sessions=new E2(this._client),this.transcriptionSessions=new P2(this._client)}};qM.Sessions=E2;qM.TranscriptionSessions=P2});var T2,Rke=b(()=>{jr();Ka();Ou();oa();T2=class extends qe{create(e,r,n){return this._client.post(Le`/threads/${e}/messages`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(Le`/threads/${o}/messages/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(Le`/threads/${o}/messages/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(Le`/threads/${e}/messages`,Sn,{query:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(Le`/threads/${o}/messages/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var A2,Nke=b(()=>{jr();Ka();Ou();oa();A2=class extends qe{retrieve(e,r,n){let{thread_id:o,run_id:i,...a}=r;return this._client.get(Le`/threads/${o}/runs/${i}/steps/${e}`,{query:a,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r,n){let{thread_id:o,...i}=r;return this._client.getAPIList(Le`/threads/${o}/runs/${e}/steps`,Sn,{query:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var sUt,uUt=b(()=>{KC();Ole();sUt=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))}}});var u_,jke=b(()=>{u_=t=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()}});var MK=b(()=>{OP();uUt();jke();hK();RFe();m2()});var Ud,FL,Dke,QC,Hle,l_,kL,I2,LL,Kle,ag,Vle,Wle,jK,RK,NK,lUt,cUt,dUt,fUt,pUt,mUt,hUt,MP,Lke=b(()=>{Oy();hke();s_();kle();MK();MP=class extends BM{constructor(){super(...arguments),Ud.add(this),Dke.set(this,[]),QC.set(this,{}),Hle.set(this,{}),l_.set(this,void 0),kL.set(this,void 0),I2.set(this,void 0),LL.set(this,void 0),Kle.set(this,void 0),ag.set(this,void 0),Vle.set(this,void 0),Wle.set(this,void 0),jK.set(this,void 0)}[(Dke=new WeakMap,QC=new WeakMap,Hle=new WeakMap,l_=new WeakMap,kL=new WeakMap,I2=new WeakMap,LL=new WeakMap,Kle=new WeakMap,ag=new WeakMap,Vle=new WeakMap,Wle=new WeakMap,jK=new WeakMap,Ud=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 FL;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=ZC.fromReadableStream(e,this.controller);for await(let i of o)ce(this,Ud,"m",RK).call(this,i);if(o.controller.signal?.aborted)throw new ks;return this._addRun(ce(this,Ud,"m",NK).call(this))}toReadableStream(){return new ZC(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new FL;return i._run(()=>i._runToolAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(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.submitToolOutputs(r,a,{...o,signal:this.controller.signal});this._connected();for await(let u of s)ce(this,Ud,"m",RK).call(this,u);if(s.controller.signal?.aborted)throw new ks;return this._addRun(ce(this,Ud,"m",NK).call(this))}static createThreadAssistantStream(e,r,n){let o=new FL;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 FL;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return ce(this,Vle,"f")}currentRun(){return ce(this,Wle,"f")}currentMessageSnapshot(){return ce(this,l_,"f")}currentRunStepSnapshot(){return ce(this,jK,"f")}async finalRunSteps(){return await this.done(),Object.values(ce(this,QC,"f"))}async finalMessages(){return await this.done(),Object.values(ce(this,Hle,"f"))}async finalRun(){if(await this.done(),!ce(this,kL,"f"))throw Error("Final run was not received.");return ce(this,kL,"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)ce(this,Ud,"m",RK).call(this,s);if(a.controller.signal?.aborted)throw new ks;return this._addRun(ce(this,Ud,"m",NK).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)ce(this,Ud,"m",RK).call(this,u);if(s.controller.signal?.aborted)throw new ks;return this._addRun(ce(this,Ud,"m",NK).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(p2(i)&&p2(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(!p2(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){return await this._createToolAssistantStream(r,e,n,o)}};FL=MP,RK=function(e){if(!this.ended)switch(er(this,Vle,e,"f"),ce(this,Ud,"m",dUt).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":ce(this,Ud,"m",hUt).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":ce(this,Ud,"m",cUt).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":ce(this,Ud,"m",lUt).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},NK=function(){if(this.ended)throw new gt("stream has ended, this shouldn't happen");if(!ce(this,kL,"f"))throw Error("Final run has not been received");return ce(this,kL,"f")},lUt=function(e){let[r,n]=ce(this,Ud,"m",pUt).call(this,e,ce(this,l_,"f"));er(this,l_,r,"f"),ce(this,Hle,"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!=ce(this,I2,"f")){if(ce(this,LL,"f"))switch(ce(this,LL,"f").type){case"text":this._emit("textDone",ce(this,LL,"f").text,ce(this,l_,"f"));break;case"image_file":this._emit("imageFileDone",ce(this,LL,"f").image_file,ce(this,l_,"f"));break}er(this,I2,o.index,"f")}er(this,LL,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(ce(this,I2,"f")!==void 0){let o=e.data.content[ce(this,I2,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,ce(this,l_,"f"));break;case"text":this._emit("textDone",o.text,ce(this,l_,"f"));break}}ce(this,l_,"f")&&this._emit("messageDone",e.data),er(this,l_,void 0,"f")}},cUt=function(e){let r=ce(this,Ud,"m",fUt).call(this,e);switch(er(this,jK,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==ce(this,Kle,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(ce(this,ag,"f")&&this._emit("toolCallDone",ce(this,ag,"f")),er(this,Kle,i.index,"f"),er(this,ag,r.step_details.tool_calls[i.index],"f"),ce(this,ag,"f")&&this._emit("toolCallCreated",ce(this,ag,"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":er(this,jK,void 0,"f"),e.data.step_details.type=="tool_calls"&&ce(this,ag,"f")&&(this._emit("toolCallDone",ce(this,ag,"f")),er(this,ag,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},dUt=function(e){ce(this,Dke,"f").push(e),this._emit("event",e)},fUt=function(e){switch(e.event){case"thread.run.step.created":return ce(this,QC,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=ce(this,QC,"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=FL.accumulateDelta(r,n.delta);ce(this,QC,"f")[e.data.id]=o}return ce(this,QC,"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":ce(this,QC,"f")[e.data.id]=e.data;break}if(ce(this,QC,"f")[e.data.id])return ce(this,QC,"f")[e.data.id];throw new Error("No snapshot available")},pUt=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]=ce(this,Ud,"m",mUt).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")},mUt=function(e,r){return FL.accumulateDelta(r,e)},hUt=function(e){switch(er(this,Wle,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":case"thread.run.incomplete":er(this,kL,e.data,"f"),ce(this,ag,"f")&&(this._emit("toolCallDone",ce(this,ag,"f")),er(this,ag,void 0,"f"));break;case"thread.run.cancelling":break}}});var $L,Fke=b(()=>{jr();Nke();Nke();Ka();Ou();Lke();m2();oa();$L=class extends qe{constructor(){super(...arguments),this.steps=new A2(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(Le`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(Le`/threads/${o}/runs/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(Le`/threads/${o}/runs/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(Le`/threads/${e}/runs`,Sn,{query:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(Le`/threads/${o}/runs/${e}/cancel`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(o.id,{thread_id:e},n)}createAndStream(e,r,n){return MP.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o=mt([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){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 GC(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return MP.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post(Le`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}async submitToolOutputsAndPoll(e,r,n){let o=await this.submitToolOutputs(e,r,n);return await this.poll(o.id,r,n)}submitToolOutputsStream(e,r,n){return MP.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};$L.Steps=A2});var HM,kke=b(()=>{jr();Rke();Rke();Fke();Fke();Ou();Lke();oa();HM=class extends qe{constructor(){super(...arguments),this.runs=new $L(this._client),this.messages=new T2(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(Le`/threads/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(Le`/threads/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete(Le`/threads/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:mt([{"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.id,{thread_id:n.thread_id},r)}createAndRunStream(e,r){return MP.createThreadAssistantStream(e,this._client.beta.threads,r)}};HM.Runs=$L;HM.Messages=T2});var eO,$ke=b(()=>{jr();Tke();Tke();Mke();Mke();kke();kke();eO=class extends qe{constructor(){super(...arguments),this.realtime=new qM(this._client),this.assistants=new O2(this._client),this.threads=new HM(this._client)}};eO.Realtime=qM;eO.Assistants=O2;eO.Threads=HM});var BL,Bke=b(()=>{jr();BL=class extends qe{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var M2,zke=b(()=>{jr();Ou();oa();M2=class extends qe{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(Le`/containers/${o}/files/${e}/content`,{...n,headers:mt([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}}});var zL,Uke=b(()=>{jr();zke();zke();Ka();Ou();PP();oa();zL=class extends qe{constructor(){super(...arguments),this.content=new M2(this._client)}create(e,r,n){return this._client.post(Le`/containers/${e}/files`,ig({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(Le`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList(Le`/containers/${e}/files`,Sn,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(Le`/containers/${o}/files/${e}`,{...n,headers:mt([{Accept:"*/*"},n?.headers])})}};zL.Content=M2});var VM,qke=b(()=>{jr();Uke();Uke();Ka();Ou();oa();VM=class extends qe{constructor(){super(...arguments),this.files=new zL(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get(Le`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",Sn,{query:e,...r})}delete(e,r){return this._client.delete(Le`/containers/${e}`,{...r,headers:mt([{Accept:"*/*"},r?.headers])})}};VM.Files=zL});var UL,Hke=b(()=>{jr();MK();UL=class extends qe{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&uu(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(uu(this._client).debug("embeddings/decoding base64 embeddings from base64"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=sUt(u)}),a)))}}});var R2,Vke=b(()=>{jr();Ka();oa();R2=class extends qe{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get(Le`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList(Le`/evals/${o}/runs/${e}/output_items`,Sn,{query:i,...n})}}});var qL,Wke=b(()=>{jr();Vke();Vke();Ka();oa();qL=class extends qe{constructor(){super(...arguments),this.outputItems=new R2(this._client)}create(e,r,n){return this._client.post(Le`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(Le`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList(Le`/evals/${e}/runs`,Sn,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(Le`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(Le`/evals/${o}/runs/${e}`,n)}};qL.OutputItems=R2});var WM,Kke=b(()=>{jr();Wke();Wke();Ka();oa();WM=class extends qe{constructor(){super(...arguments),this.runs=new qL(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(Le`/evals/${e}`,r)}update(e,r,n){return this._client.post(Le`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",Sn,{query:e,...r})}delete(e,r){return this._client.delete(Le`/evals/${e}`,r)}};WM.Runs=qL});var HL,Gke=b(()=>{jr();Ka();Ou();m2();s_();PP();oa();HL=class extends qe{create(e,r){return this._client.post("/files",ig({body:e,...r},this._client))}retrieve(e,r){return this._client.get(Le`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",Sn,{query:e,...r})}delete(e,r){return this._client.delete(Le`/files/${e}`,r)}content(e,r){return this._client.get(Le`/files/${e}/content`,{...r,headers:mt([{Accept:"application/binary"},r?.headers]),__binaryResponse:!0})}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 GC(r),a=await this.retrieve(e),Date.now()-i>n)throw new VC({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}}});var N2,Jke=b(()=>{jr();N2=class extends qe{}});var j2,Zke=b(()=>{jr();j2=class extends qe{run(e,r){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...r})}validate(e,r){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...r})}}});var VL,Yke=b(()=>{jr();Zke();Zke();VL=class extends qe{constructor(){super(...arguments),this.graders=new j2(this._client)}};VL.Graders=j2});var D2,Xke=b(()=>{jr();Ka();oa();D2=class extends qe{create(e,r,n){return this._client.getAPIList(Le`/fine_tuning/checkpoints/${e}/permissions`,YC,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get(Le`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(Le`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}}});var WL,Qke=b(()=>{jr();Xke();Xke();WL=class extends qe{constructor(){super(...arguments),this.permissions=new D2(this._client)}};WL.Permissions=D2});var L2,e$e=b(()=>{jr();Ka();oa();L2=class extends qe{list(e,r={},n){return this._client.getAPIList(Le`/fine_tuning/jobs/${e}/checkpoints`,Sn,{query:r,...n})}}});var KL,t$e=b(()=>{jr();e$e();e$e();Ka();oa();KL=class extends qe{constructor(){super(...arguments),this.checkpoints=new L2(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(Le`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",Sn,{query:e,...r})}cancel(e,r){return this._client.post(Le`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList(Le`/fine_tuning/jobs/${e}/events`,Sn,{query:r,...n})}pause(e,r){return this._client.post(Le`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post(Le`/fine_tuning/jobs/${e}/resume`,r)}};KL.Checkpoints=L2});var c_,r$e=b(()=>{jr();Jke();Jke();Yke();Yke();Qke();Qke();t$e();t$e();c_=class extends qe{constructor(){super(...arguments),this.methods=new N2(this._client),this.jobs=new KL(this._client),this.checkpoints=new WL(this._client),this.alpha=new VL(this._client)}};c_.Methods=N2;c_.Jobs=KL;c_.Checkpoints=WL;c_.Alpha=VL});var F2,n$e=b(()=>{jr();F2=class extends qe{}});var KM,o$e=b(()=>{jr();n$e();n$e();KM=class extends qe{constructor(){super(...arguments),this.graderModels=new F2(this._client)}};KM.GraderModels=F2});var GL,i$e=b(()=>{jr();PP();GL=class extends qe{createVariation(e,r){return this._client.post("/images/variations",ig({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",ig({body:e,...r,stream:e.stream??!1},this._client))}generate(e,r){return this._client.post("/images/generations",{body:e,...r,stream:e.stream??!1})}}});var JL,a$e=b(()=>{jr();Ka();oa();JL=class extends qe{retrieve(e,r){return this._client.get(Le`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",YC,e)}delete(e,r){return this._client.delete(Le`/models/${e}`,r)}}});var ZL,s$e=b(()=>{jr();ZL=class extends qe{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function gUt(t,e){return!e||!cfn(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)}:u$e(t,e)}function u$e(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:pfn(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:lfn(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||Gle(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 lfn(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function cfn(t){return!!xK(t.text?.format)}function dfn(t){return t?.$brand==="auto-parseable-tool"}function ffn(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function pfn(t,e){let r=ffn(t.tools??[],e.name);return{...e,...e,parsed_arguments:dfn(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function Gle(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 Jle=b(()=>{s_();y2()});function mfn(t,e){return gUt(t,e)}var k2,Zle,GM,Yle,yUt,bUt,_Ut,vUt,Xle,wUt=b(()=>{Oy();s_();kle();Jle();Xle=class t extends BM{constructor(e){super(),k2.add(this),Zle.set(this,void 0),GM.set(this,void 0),Yle.set(this,void 0),er(this,Zle,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createOrRetrieveResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createOrRetrieveResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),ce(this,k2,"m",yUt).call(this);let i,a=null;"response_id"in r?(i=await e.responses.retrieve(r.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),a=r.starting_after??null):i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(let s of i)ce(this,k2,"m",bUt).call(this,s,a);if(i.controller.signal?.aborted)throw new ks;return ce(this,k2,"m",_Ut).call(this)}[(Zle=new WeakMap,GM=new WeakMap,Yle=new WeakMap,k2=new WeakSet,yUt=function(){this.ended||er(this,GM,void 0,"f")},bUt=function(r,n){if(this.ended)return;let o=(a,s)=>{(n==null||s.sequence_number>n)&&this._emit(a,s)},i=ce(this,k2,"m",vUt).call(this,r);switch(o("event",r),r.type){case"response.output_text.delta":{let a=i.output[r.output_index];if(!a)throw new gt(`missing output at index ${r.output_index}`);if(a.type==="message"){let s=a.content[r.content_index];if(!s)throw new gt(`missing content at index ${r.content_index}`);if(s.type!=="output_text")throw new gt(`expected content to be 'output_text', got ${s.type}`);o("response.output_text.delta",{...r,snapshot:s.text})}break}case"response.function_call_arguments.delta":{let a=i.output[r.output_index];if(!a)throw new gt(`missing output at index ${r.output_index}`);a.type==="function_call"&&o("response.function_call_arguments.delta",{...r,snapshot:a.arguments});break}default:o(r.type,r);break}},_Ut=function(){if(this.ended)throw new gt("stream has ended, this shouldn't happen");let r=ce(this,GM,"f");if(!r)throw new gt("request ended without sending any events");er(this,GM,void 0,"f");let n=mfn(r,ce(this,Zle,"f"));return er(this,Yle,n,"f"),n},vUt=function(r){let n=ce(this,GM,"f");if(!n){if(r.type!=="response.created")throw new gt(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=er(this,GM,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 gt(`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 gt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new gt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new gt(`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 gt(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{er(this,GM,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=ce(this,Yle,"f");if(!e)throw new gt("stream ended without producing a ChatCompletion");return e}}});var $2,l$e=b(()=>{jr();Ka();oa();$2=class extends qe{list(e,r={},n){return this._client.getAPIList(Le`/responses/${e}/input_items`,Sn,{query:r,...n})}}});var JM,c$e=b(()=>{Jle();wUt();jr();l$e();l$e();Ou();oa();JM=class extends qe{constructor(){super(...arguments),this.inputItems=new $2(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"&&Gle(n),n))}retrieve(e,r={},n){return this._client.get(Le`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&Gle(o),o))}delete(e,r){return this._client.delete(Le`/responses/${e}`,{...r,headers:mt([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>u$e(n,e))}stream(e,r){return Xle.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(Le`/responses/${e}/cancel`,r)}};JM.InputItems=$2});var B2,d$e=b(()=>{jr();PP();oa();B2=class extends qe{create(e,r,n){return this._client.post(Le`/uploads/${e}/parts`,ig({body:r,...n},this._client))}}});var ZM,f$e=b(()=>{jr();d$e();d$e();oa();ZM=class extends qe{constructor(){super(...arguments),this.parts=new B2(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(Le`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(Le`/uploads/${e}/complete`,{body:r,...n})}};ZM.Parts=B2});var xUt,SUt=b(()=>{xUt=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 z2,p$e=b(()=>{jr();Ka();Ou();m2();SUt();oa();z2=class extends qe{create(e,r,n){return this._client.post(Le`/vector_stores/${e}/file_batches`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(Le`/vector_stores/${o}/file_batches/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{vector_store_id:o}=r;return this._client.post(Le`/vector_stores/${o}/file_batches/${e}/cancel`,{...n,headers:mt([{"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){let{vector_store_id:o,...i}=r;return this._client.getAPIList(Le`/vector_stores/${o}/file_batches/${e}/files`,Sn,{query:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async poll(e,r,n){let o=mt([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:a}=await this.retrieve(r,{vector_store_id:e},{...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 GC(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 h=await s.files.create({file:p,purpose:"assistants"},o);l.push(h.id)}}let d=Array(a).fill(u).map(c);return await xUt(d),await this.createAndPoll(e,{file_ids:l})}}});var U2,m$e=b(()=>{jr();Ka();Ou();MK();oa();U2=class extends qe{create(e,r,n){return this._client.post(Le`/vector_stores/${e}/files`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(Le`/vector_stores/${o}/files/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{vector_store_id:o,...i}=r;return this._client.post(Le`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(Le`/vector_stores/${e}/files`,Sn,{query:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{vector_store_id:o}=r;return this._client.delete(Le`/vector_stores/${o}/files/${e}`,{...n,headers:mt([{"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=mt([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(r,{vector_store_id:e},{...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 GC(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){let{vector_store_id:o}=r;return this._client.getAPIList(Le`/vector_stores/${o}/files/${e}/content`,YC,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var RP,h$e=b(()=>{jr();p$e();p$e();m$e();m$e();Ka();Ou();oa();RP=class extends qe{constructor(){super(...arguments),this.files=new U2(this._client),this.fileBatches=new z2(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(Le`/vector_stores/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(Le`/vector_stores/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",Sn,{query:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(Le`/vector_stores/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList(Le`/vector_stores/${e}/search`,YC,{body:r,method:"post",...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};RP.Files=U2;RP.FileBatches=z2});var q2,CUt,Qle,YL,g$e=b(()=>{Oy();s_();jr();Ou();YL=class extends qe{constructor(){super(...arguments),q2.add(this)}async unwrap(e,r,n=this._client.webhookSecret,o=300){return await this.verifySignature(e,r,n,o),JSON.parse(e)}async verifySignature(e,r,n=this._client.webhookSecret,o=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");ce(this,q2,"m",CUt).call(this,n);let i=mt([r]).values,a=ce(this,q2,"m",Qle).call(this,i,"webhook-signature"),s=ce(this,q2,"m",Qle).call(this,i,"webhook-timestamp"),u=ce(this,q2,"m",Qle).call(this,i,"webhook-id"),l=parseInt(s,10);if(isNaN(l))throw new WC("Invalid webhook timestamp format");let c=Math.floor(Date.now()/1e3);if(c-l>o)throw new WC("Webhook timestamp is too old");if(l>c+o)throw new WC("Webhook timestamp is too new");let d=a.split(" ").map(m=>m.startsWith("v1,")?m.substring(3):m),f=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),p=u?`${u}.${s}.${e}`:`${s}.${e}`,h=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let m of d)try{let g=Buffer.from(m,"base64");if(await crypto.subtle.verify("HMAC",h,g,new TextEncoder().encode(p)))return}catch{continue}throw new WC("The given webhook signature does not match the expected signature")}};q2=new WeakSet,CUt=function(e){if(typeof e!="string"||e.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},Qle=function(e,r){if(!e)throw new Error("Headers are required");let n=e.get(r);if(n==null)throw new Error(`Missing required header: ${r}`);return n}});var OUt=b(()=>{oUt();iUt();Eke();Pke();$ke();Bke();qke();Hke();Kke();Gke();r$e();o$e();i$e();a$e();s$e();c$e();f$e();h$e();g$e()});var y$e,b$e,ece,EUt,Or,tce=b(()=>{Oy();RFe();OP();m2();_le();DFe();pK();Ozt();jzt();jFe();KC();Ka();eke();OUt();Ale();Pke();Bke();Hke();Gke();i$e();a$e();s$e();g$e();Eke();$ke();xke();qke();Kke();r$e();o$e();c$e();f$e();h$e();DFe();Ou();jke();hK();OP();Or=class{constructor({baseURL:e=u_("OPENAI_BASE_URL"),apiKey:r=u_("OPENAI_API_KEY"),organization:n=u_("OPENAI_ORG_ID")??null,project:o=u_("OPENAI_PROJECT_ID")??null,webhookSecret:i=u_("OPENAI_WEBHOOK_SECRET")??null,...a}={}){if(y$e.add(this),ece.set(this,void 0),this.completions=new BL(this),this.chat=new UM(this),this.embeddings=new UL(this),this.files=new HL(this),this.images=new GL(this),this.audio=new XC(this),this.moderations=new ZL(this),this.models=new JL(this),this.fineTuning=new c_(this),this.graders=new KM(this),this.vectorStores=new RP(this),this.webhooks=new YL(this),this.beta=new eO(this),this.batches=new DL(this),this.uploads=new ZM(this),this.responses=new JM(this),this.evals=new WM(this),this.containers=new VM(this),r===void 0)throw new gt("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 s={apiKey:r,organization:n,project:o,webhookSecret:i,...a,baseURL:e||"https://api.openai.com/v1"};if(!s.dangerouslyAllowBrowser&&vzt())throw new gt(`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
`);this.baseURL=s.baseURL,this.timeout=s.timeout??b$e.DEFAULT_TIMEOUT,this.logger=s.logger??console;let u="warn";this.logLevel=u,this.logLevel=VFe(s.logLevel,"ClientOptions.logLevel",this)??VFe(u_("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??u,this.fetchOptions=s.fetchOptions,this.maxRetries=s.maxRetries??2,this.fetch=s.fetch??xzt(),er(this,ece,Czt,"f"),this._options=s,this.apiKey=r,this.organization=n,this.project=o,this.webhookSecret=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return mt([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return qFe(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${$M}`}defaultIdempotencyKey(){return`stainless-node-retry-${MFe()}`}makeStatusError(e,r,n,o){return mc.generate(e,r,n,o)}buildURL(e,r,n){let o=!ce(this,y$e,"m",EUt).call(this)&&n||this.baseURL,i=dzt(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return pzt(a)||(r={...a,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}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(o=>({method:e,path:r,...o})))}request(e,r=null){return new ML(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,i=o.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(o);let{req:a,url:s,timeout:u}=await this.buildRequest(o,{retryCount:i-r});await this.prepareRequest(a,{url:s,options:o});let l="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),c=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if(uu(this).debug(`[${l}] sending request`,EP({retryOfRequestLogID:n,method:o.method,url:s,options:o,headers:a.headers})),o.signal?.aborted)throw new ks;let f=new AbortController,p=await this.fetchWithTimeout(s,a,u,f).catch(fK),h=Date.now();if(p instanceof Error){let y=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new ks;let _=dK(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return uu(this).info(`[${l}] connection ${_?"timed out":"failed"} - ${y}`),uu(this).debug(`[${l}] connection ${_?"timed out":"failed"} (${y})`,EP({retryOfRequestLogID:n,url:s,durationMs:h-d,message:p.message})),this.retryRequest(o,r,n??l);throw uu(this).info(`[${l}] connection ${_?"timed out":"failed"} - error; no more retries left`),uu(this).debug(`[${l}] connection ${_?"timed out":"failed"} (error; no more retries left)`,EP({retryOfRequestLogID:n,url:s,durationMs:h-d,message:p.message})),_?new VC:new kM({cause:p})}let m=[...p.headers.entries()].filter(([y])=>y==="x-request-id").map(([y,_])=>", "+y+": "+JSON.stringify(_)).join(""),g=`[${l}${c}${m}] ${a.method} ${s} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${h-d}ms`;if(!p.ok){let y=await this.shouldRetry(p);if(r&&y){let P=`retrying, ${r} attempts remaining`;return await Szt(p.body),uu(this).info(`${g} - ${P}`),uu(this).debug(`[${l}] response error (${P})`,EP({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-d})),this.retryRequest(o,r,n??l,p.headers)}let _=y?"error; no more retries left":"error; not retryable";uu(this).info(`${g} - ${_}`);let w=await p.text().catch(P=>fK(P).message),S=gzt(w),C=S?void 0:w;throw uu(this).debug(`[${l}] response error (${_})`,EP({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:C,durationMs:Date.now()-d})),this.makeStatusError(p.status,S,C,p.headers)}return uu(this).info(g),uu(this).debug(`[${l}] response start`,EP({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-d})),{response:p,options:o,controller:f,requestLogID:l,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new bK(this,n,e)}async fetchWithTimeout(e,r,n,o){let{signal:i,method:a,...s}=r||{};i&&i.addEventListener("abort",()=>o.abort());let u=setTimeout(()=>o.abort(),n),l=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body=="object"&&s.body!==null&&Symbol.asyncIterator in s.body,c={signal:o.signal,...l?{duplex:"half"}:{},method:"GET",...s};a&&(c.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,c)}finally{clearTimeout(u)}}async 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,o){let i,a=o?.get("retry-after-ms");if(a){let u=parseFloat(a);Number.isNaN(u)||(i=u)}let s=o?.get("retry-after");if(s&&!i){let u=parseFloat(s);Number.isNaN(u)?i=Date.parse(s)-Date.now():i=u*1e3}if(!(i&&0<=i&&i<60*1e3)){let u=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,u)}return await GC(i),this.makeRequest(e,r-1,n)}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}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:a,defaultBaseURL:s}=n,u=this.buildURL(i,a,s);"timeout"in n&&hzt("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:l,body:c}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:l,retryCount:r});return{req:{method:o,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&c instanceof globalThis.ReadableStream&&{duplex:"half"},...c&&{body:c},...this.fetchOptions??{},...n.fetchOptions??{}},url:u,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let a=mt([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...wzt(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=mt([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:vle(e)}:ce(this,ece,"f").call(this,{body:e,headers:n})}};b$e=Or,ece=new WeakMap,y$e=new WeakSet,EUt=function(){return this.baseURL!=="https://api.openai.com/v1"};Or.OpenAI=b$e;Or.DEFAULT_TIMEOUT=6e5;Or.OpenAIError=gt;Or.APIError=mc;Or.APIConnectionError=kM;Or.APIConnectionTimeoutError=VC;Or.APIUserAbortError=ks;Or.NotFoundError=a2;Or.ConflictError=s2;Or.RateLimitError=l2;Or.BadRequestError=n2;Or.AuthenticationError=o2;Or.InternalServerError=c2;Or.PermissionDeniedError=i2;Or.UnprocessableEntityError=u2;Or.InvalidWebhookSignatureError=WC;Or.toFile=vK;Or.Completions=BL;Or.Chat=UM;Or.Embeddings=UL;Or.Files=HL;Or.Images=GL;Or.Audio=XC;Or.Moderations=ZL;Or.Models=JL;Or.FineTuning=c_;Or.Graders=KM;Or.VectorStores=RP;Or.Webhooks=YL;Or.Beta=eO;Or.Batches=DL;Or.Uploads=ZM;Or.Responses=JM;Or.Evals=WM;Or.Containers=VM});var XL,vfn,PUt,TUt=b(()=>{s_();MK();tce();Ou();XL=class extends Or{constructor({baseURL:e=u_("OPENAI_BASE_URL"),apiKey:r=u_("AZURE_OPENAI_API_KEY"),apiVersion:n=u_("OPENAI_API_VERSION"),endpoint:o,deployment:i,azureADTokenProvider:a,dangerouslyAllowBrowser:s,...u}={}){if(!n)throw new gt("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 gt("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(a&&r)throw new gt("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(r??(r=PUt),u.defaultQuery={...u.defaultQuery,"api-version":n},e){if(o)throw new gt("baseURL and endpoint are mutually exclusive")}else{if(o||(o=process.env.AZURE_OPENAI_ENDPOINT),!o)throw new gt("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}async buildRequest(e,r={}){if(vfn.has(e.path)&&e.method==="post"&&e.body!==void 0){if(!p2(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 gt(`Expected 'azureADTokenProvider' argument to return a string but it returned ${e}`);return e}}async authHeaders(e){}async prepareOptions(e){if(e.headers=mt([e.headers]),e.headers.values.get("Authorization")||e.headers.values.get("api-key"))return super.prepareOptions(e);let r=await this._getAzureADToken();if(r)e.headers.values.set("Authorization",`Bearer ${r}`);else if(this.apiKey!==PUt)e.headers.values.set("api-key",this.apiKey);else throw new gt("Unable to handle auth");return super.prepareOptions(e)}},vfn=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"]),PUt="<Missing Key>"});var tO=b(()=>{tce();eke();Ale();tce();Ka();KC();TUt()});function Xm(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=bB(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new Ah([`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 rO(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 Qm(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var _$e,qd,AUt=b(()=>{DB();cSe();qA();cj();gE();_$e=class extends _j{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(Vi(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=>Xm(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}},qd=class extends _$e{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 vQe(this.zodSchema,e);if(r.success)return r.data;throw new Ah(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error?.issues)}`,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}}});var IUt=b(()=>{AUt()});var H2=b(()=>{IUt()});var v$e=b(()=>{mj()});function NP(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}var YM=b(()=>{});var RUt,MUt,NUt,rce=b(()=>{RUt=Symbol("Let zodToJsonSchema decide on which parser to use"),MUt={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"},NUt=t=>typeof t=="string"?{...MUt,basePath:["#"],definitions:{},name:t}:{...MUt,basePath:["#"],definitions:{},...t}});function jUt(t){if(!t)return!0;for(let e in t)return!1;return!0}var DK,w$e=b(()=>{DK=t=>"_def"in t?t._def:t});var DUt,x$e=b(()=>{rce();w$e();DUt=t=>{let e=NUt(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])=>[DK(o),{def:DK(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function S$e(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function fo(t,e,r,n,o){t[e]=r,S$e(t,e,n,o)}var XM=b(()=>{});function LUt(){return{}}var C$e=b(()=>{});function FUt(t,e){let r={type:"array"};return t.type?._def?.typeName!==re.ZodAny&&(r.items=Er(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&fo(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&fo(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(fo(r,"minItems",t.exactLength.value,t.exactLength.message,e),fo(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var O$e=b(()=>{vd();XM();Eu()});function kUt(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?fo(r,"minimum",n.value,n.message,e):fo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),fo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?fo(r,"maximum",n.value,n.message,e):fo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),fo(r,"maximum",n.value,n.message,e));break;case"multipleOf":fo(r,"multipleOf",n.value,n.message,e);break}return r}var E$e=b(()=>{XM()});function $Ut(){return{type:"boolean"}}var P$e=b(()=>{});function BUt(t,e){return Er(t.type._def,e)}var T$e=b(()=>{Eu()});var zUt,A$e=b(()=>{Eu();zUt=(t,e)=>Er(t.innerType._def,e)});function I$e(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>I$e(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 wfn(t,e)}}var wfn,M$e=b(()=>{XM();wfn=(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":fo(r,"minimum",n.value,n.message,e);break;case"max":fo(r,"maximum",n.value,n.message,e);break}return r}});function UUt(t,e){return{...Er(t.innerType._def,e),default:t.defaultValue()}}var R$e=b(()=>{Eu()});function qUt(t,e,r){return e.effectStrategy==="input"?Er(t.schema._def,e,r):{}}var N$e=b(()=>{Eu()});function HUt(t){return{type:"string",enum:[...t.values]}}var j$e=b(()=>{});function VUt(t,e){let r=[Er(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Er(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(xfn(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 xfn,D$e=b(()=>{Eu();xfn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function WUt(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 L$e=b(()=>{});function nce(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?Sfn(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":fo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":fo(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":d_(r,"email",o.message,e);break;case"format:idn-email":d_(r,"idn-email",o.message,e);break;case"pattern:zod":f_(r,QL.email,o.message,e);break}break;case"url":d_(r,"uri",o.message,e);break;case"uuid":d_(r,"uuid",o.message,e);break;case"regex":f_(r,o.regex,o.message,e);break;case"cuid":f_(r,QL.cuid,o.message,e);break;case"cuid2":f_(r,QL.cuid2,o.message,e);break;case"startsWith":f_(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":f_(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":d_(r,"date-time",o.message,e);break;case"date":d_(r,"date",o.message,e);break;case"time":d_(r,"time",o.message,e);break;case"duration":d_(r,"duration",o.message,e);break;case"length":fo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),fo(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{f_(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&d_(r,"ipv4",o.message,e),o.version!=="v4"&&d_(r,"ipv6",o.message,e);break}case"emoji":f_(r,QL.emoji,o.message,e);break;case"ulid":{f_(r,QL.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{d_(r,"binary",o.message,e);break}case"contentEncoding:base64":{fo(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{f_(r,QL.base64,o.message,e);break}}break}case"nanoid":f_(r,QL.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var F$e,QL,Sfn,d_,f_,KUt,oce=b(()=>{XM();QL={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:()=>(F$e===void 0&&(F$e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),F$e),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}$/};Sfn=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),d_=(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}}})):fo(t,"format",e,r,n)},f_=(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:KUt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):fo(t,"pattern",KUt(e,n),r,n)},KUt=(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 ice(t,e){if(e.target==="openApi3"&&t.keyType?._def.typeName===re.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:Er(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Er(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===re.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(nce(t.keyType._def,e)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===re.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}var ace=b(()=>{vd();Eu();oce()});function GUt(t,e){if(e.mapStrategy==="record")return ice(t,e);let r=Er(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=Er(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 k$e=b(()=>{Eu();ace()});function JUt(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 $$e=b(()=>{});function ZUt(){return{not:{}}}var B$e=b(()=>{});function YUt(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var z$e=b(()=>{});function QUt(t,e){if(e.target==="openApi3")return XUt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in LK&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=LK[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 XUt(t,e)}var LK,XUt,sce=b(()=>{Eu();LK={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};XUt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Er(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 eqt(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:LK[t.innerType._def.typeName],nullable:!0}:{type:[LK[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Er(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Er(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var U$e=b(()=>{Eu();sce()});function tqt(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",S$e(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?fo(r,"minimum",n.value,n.message,e):fo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),fo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?fo(r,"maximum",n.value,n.message,e):fo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),fo(r,"maximum",n.value,n.message,e));break;case"multipleOf":fo(r,"multipleOf",n.value,n.message,e);break}return r}var q$e=b(()=>{XM()});function Cfn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":Er(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":Er(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function rqt(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=Er(i._def,{...e,currentPath:a,propertyPath:a});if(s===void 0)return n;if(e.openaiStrictMode&&i.isOptional()&&!i.isNullable()&&typeof i._def?.defaultValue>"u")throw new Error(`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`);return{properties:{...n.properties,[o]:s},required:i.isOptional()&&!e.openaiStrictMode?n.required:[...n.required,o]}},{properties:{},required:[]}),additionalProperties:Cfn(t,e)};return r.required.length||delete r.required,r}var H$e=b(()=>{Eu()});var nqt,V$e=b(()=>{Eu();nqt=(t,e)=>{if(e.propertyPath&&e.currentPath.slice(0,e.propertyPath.length).toString()===e.propertyPath.toString())return Er(t.innerType._def,{...e,currentPath:e.currentPath});let r=Er(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var oqt,W$e=b(()=>{Eu();oqt=(t,e)=>{if(e.pipeStrategy==="input")return Er(t.in._def,e);if(e.pipeStrategy==="output")return Er(t.out._def,e);let r=Er(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Er(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function iqt(t,e){return Er(t.type._def,e)}var K$e=b(()=>{Eu()});function aqt(t,e){let n={type:"array",uniqueItems:!0,items:Er(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&fo(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&fo(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var G$e=b(()=>{XM();Eu()});function sqt(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Er(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Er(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Er(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var J$e=b(()=>{Eu()});function uqt(){return{not:{}}}var Z$e=b(()=>{});function lqt(){return{}}var Y$e=b(()=>{});var cqt,X$e=b(()=>{Eu();cqt=(t,e)=>Er(t.innerType._def,e)});function Er(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==RUt)return a}if(n&&!r){let a=Ofn(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=Pfn(t,t.typeName,e,r);return i&&Tfn(t,e,i),o.jsonSchema=i,i}var Ofn,Efn,Pfn,Tfn,Eu=b(()=>{vd();C$e();O$e();E$e();P$e();T$e();A$e();M$e();R$e();N$e();j$e();D$e();L$e();k$e();$$e();B$e();z$e();U$e();q$e();H$e();V$e();W$e();K$e();ace();G$e();oce();J$e();Z$e();sce();Y$e();X$e();rce();Ofn=(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:Efn(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}},Efn=(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("/")},Pfn=(t,e,r,n)=>{switch(e){case re.ZodString:return nce(t,r);case re.ZodNumber:return tqt(t,r);case re.ZodObject:return rqt(t,r);case re.ZodBigInt:return kUt(t,r);case re.ZodBoolean:return $Ut();case re.ZodDate:return I$e(t,r);case re.ZodUndefined:return uqt();case re.ZodNull:return YUt(r);case re.ZodArray:return FUt(t,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return QUt(t,r);case re.ZodIntersection:return VUt(t,r);case re.ZodTuple:return sqt(t,r);case re.ZodRecord:return ice(t,r);case re.ZodLiteral:return WUt(t,r);case re.ZodEnum:return HUt(t);case re.ZodNativeEnum:return JUt(t);case re.ZodNullable:return eqt(t,r);case re.ZodOptional:return nqt(t,r);case re.ZodMap:return GUt(t,r);case re.ZodSet:return aqt(t,r);case re.ZodLazy:return Er(t.getter()._def,r);case re.ZodPromise:return iqt(t,r);case re.ZodNaN:case re.ZodNever:return ZUt();case re.ZodEffects:return qUt(t,r,n);case re.ZodAny:return LUt();case re.ZodUnknown:return lqt();case re.ZodDefault:return UUt(t,r);case re.ZodBranded:return BUt(t,r);case re.ZodReadonly:return cqt(t,r);case re.ZodCatch:return zUt(t,r);case re.ZodPipeline:return oqt(t,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(o=>{})(e)}},Tfn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var Q$e,eBe=b(()=>{Eu();x$e();w$e();Q$e=(t,e)=>{let r=DUt(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=Er(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(jUt(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]=Er(DK(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}});var dqt=b(()=>{rce();x$e();XM();Eu();C$e();O$e();E$e();P$e();T$e();A$e();M$e();R$e();N$e();j$e();D$e();L$e();k$e();$$e();B$e();z$e();U$e();q$e();H$e();V$e();W$e();K$e();X$e();ace();G$e();oce();J$e();Z$e();sce();Y$e();eBe();eBe()});function Afn(t,e){return Q$e(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function fqt(t,e,r){return Wzt({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:Afn(t,{name:e})}},n=>t.parse(JSON.parse(n)))}var pqt=b(()=>{y2();dqt();Jle()});function FK(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var mqt=b(()=>{});function QM(t){let e;return t.constructor.name===VC.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===ks.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=FK(t,"INVALID_TOOL_RESULTS"):t.status===401?e=FK(t,"MODEL_AUTHENTICATION"):t.status===429?e=FK(t,"MODEL_RATE_LIMIT"):t.status===404?e=FK(t,"MODEL_NOT_FOUND"):e=t,e}function tBe(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 Ifn(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function hqt(t,e,r){if(Ph(t))return fqt(t,e,r);if(wm(t))return Ifn({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:j6(t,{cycles:"ref",reused:"ref",override(n){n.jsonSchema.title=e}})}},n=>BQ(t,JSON.parse(n)));throw new Error("Unsupported schema response format")}var eF=b(()=>{tO();rg();PL();v$e();UQ();pqt();mqt()});function Mfn(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function gqt(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(yqt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function yqt(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}: ${uce(o,e)},`):r.push(`${n}?: ${uce(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function uce(t,e){if(Mfn(t))return t.anyOf.map(r=>uce(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["{",yqt(t,e+2),"}"].join(`
`);case"array":return t.items?`${uce(t.items,e)}[]`:"any[]";default:return""}}var bqt=b(()=>{});function _qt(t,e){let r;return Hc(t)?r=zC(t):r=t,r.type==="function"&&e?.strict!==void 0&&(r.function.strict=e.strict),r}function lce(t){return"type"in t&&t.type!=="function"&&t.type!=="custom"}function vqt(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function wqt(t){return typeof t=="object"&&t!==null&&"metadata"in t&&typeof t.metadata=="object"&&t.metadata!==null&&"customTool"in t.metadata&&typeof t.metadata.customTool=="object"&&t.metadata.customTool!==null}function rBe(t){return"type"in t&&t.type==="custom"&&"custom"in t&&typeof t.custom=="object"&&t.custom!==null}function xqt(t){if(t.type==="custom_tool_call")return{...t,type:"tool_call",call_id:t.id,id:t.call_id,name:t.name,isCustomTool:!0,args:{input:t.input}}}function Sqt(t){return t.type==="tool_call"&&"isCustomTool"in t&&t.isCustomTool===!0}function Cqt(t){let e=()=>{if(t.custom.format){if(t.custom.format.type==="grammar")return{type:"grammar",definition:t.custom.format.grammar.definition,syntax:t.custom.format.grammar.syntax};if(t.custom.format.type==="text")return{type:"text"}}};return{type:"custom",name:t.custom.name,description:t.custom.description,format:e()}}function Oqt(t){let e=()=>{if(t.format){if(t.format.type==="grammar")return{type:"grammar",grammar:{definition:t.format.definition,syntax:t.format.syntax}};if(t.format.type==="text")return{type:"text"}}};return{type:"custom",custom:{name:t.name,description:t.description,format:e()}}}var Eqt=b(()=>{rg();eF()});function fce(t){return t&&(/^o\d/.test(t)||t.startsWith("gpt-5"))}function Rfn(t){return t!==void 0&&typeof t.schema=="object"}function Nfn(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 oBe(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(!Js.isInstance(t))throw new Error("Invalid generic chat message");return Nfn(t)}default:throw new Error(`Unknown message type: ${e}`)}}function nBe(t,e){return t.flatMap(r=>{let n=oBe(r);n==="system"&&fce(e)&&(n="developer");let o=typeof r.content=="string"?r.content:r.content.map(a=>Eb(a)?_6(a,Pqt):a),i={role:n,content:o};if(r.name!=null&&(i.name=r.name),r.additional_kwargs.function_call!=null&&(i.function_call=r.additional_kwargs.function_call,i.content=""),Vi(r)&&r.tool_calls?.length?(i.tool_calls=r.tool_calls.map(rO),i.content=""):(r.additional_kwargs.tool_calls!=null&&(i.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(i.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let a={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[i,a]}return i})}var V2,Pqt,kK,cce,dce,nO,pce=b(()=>{tO();Fs();Gf();to();UC();tg();Om();Mb();H2();PL();v$e();YM();eF();bqt();Eqt();V2="__openai_function_call_ids__";Pqt={providerName:"ChatOpenAI",fromStandardTextBlock(t){return{type:"text",text:t.text}},fromStandardImageBlock(t){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url,...t.metadata?.detail?{detail:t.metadata.detail}:{}}};if(t.source_type==="base64")return{type:"image_url",image_url:{url:`data:${t.mime_type??""};base64,${t.data}`,...t.metadata?.detail?{detail:t.metadata.detail}:{}}};throw new Error(`Image content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)},fromStandardAudioBlock(t){if(t.source_type==="url"){let e=_B({dataUrl:t.url});if(!e)throw new Error(`URL audio blocks with source_type ${t.source_type} must be formatted as a data URL for ChatOpenAI`);let r=e.mime_type||t.mime_type||"",n;try{n=K0e(r)}catch{throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`)}if(n.type!=="audio"||n.subtype!=="wav"&&n.subtype!=="mp3")throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`);return{type:"input_audio",input_audio:{format:n.subtype,data:e.data}}}if(t.source_type==="base64"){let e;try{e=K0e(t.mime_type??"")}catch{throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`)}if(e.type!=="audio"||e.subtype!=="wav"&&e.subtype!=="mp3")throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`);return{type:"input_audio",input_audio:{format:e.subtype,data:t.data}}}throw new Error(`Audio content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)},fromStandardFileBlock(t){if(t.source_type==="url"){if(!_B({dataUrl:t.url}))throw new Error(`URL file blocks with source_type ${t.source_type} must be formatted as a data URL for ChatOpenAI`);return{type:"file",file:{file_data:t.url,...t.metadata?.filename||t.metadata?.name?{filename:t.metadata?.filename||t.metadata?.name}:{}}}}if(t.source_type==="base64")return{type:"file",file:{file_data:`data:${t.mime_type??""};base64,${t.data}`,...t.metadata?.filename||t.metadata?.name||t.metadata?.title?{filename:t.metadata?.filename||t.metadata?.name||t.metadata?.title}:{}}};if(t.source_type==="id")return{type:"file",file:{file_id:t.id}};throw new Error(`File content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)}};kK=class extends Cu{_llmType(){return"openai"}static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning","service_tier"]}get lc_secrets(){return{apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{apiKey:"openai_api_key",modelName:"model"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","model","modelName","modelKwargs","stop","stopSequences","timeout","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming","zdrEnabled","reasoning","verbosity","promptCacheKey"]}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}}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}identifyingParams(){return this._identifyingParams()}constructor(e){super(e??{}),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,"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,"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,"reasoning",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"zdrEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"service_tier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"promptCacheKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.apiKey=e?.apiKey??e?.configuration?.apiKey??ct("OPENAI_API_KEY"),this.organization=e?.configuration?.organization??ct("OPENAI_ORGANIZATION"),this.model=e?.model??e?.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.reasoning=e?.reasoning,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.disableStreaming=e?.disableStreaming??this.disableStreaming,this.promptCacheKey=e?.promptCacheKey??this.promptCacheKey,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),e?.service_tier!==void 0&&(this.service_tier=e.service_tier),this.zdrEnabled=e?.zdrEnabled??!1}_getReasoningParams(e){if(!fce(this.model))return;let r;return this.reasoning!==void 0&&(r={...r,...this.reasoning}),e?.reasoning!==void 0&&(r={...r,...e.reasoning}),r}_getResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&Th(e.json_schema.schema)?hqt(e.json_schema.schema,e.json_schema.name,{description:e.json_schema.description}):e}_combineCallOptions(e){return{...this.defaultOptions,...e??{}}}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=NP(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Or(i)}return{...this.clientConfig,...e}}_convertChatOpenAIToolToCompletionsTool(e,r){return wqt(e)?Oqt(e.metadata.customTool):kd(e)?r?.strict!==void 0?{...e,function:{...e.function,strict:r.strict}}:e:_qt(e,r)}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.withConfig({tools:e.map(o=>lce(o)?o:this._convertChatOpenAIToolToCompletionsTool(o,{strict:n})),...r})}async stream(e,r){return super.stream(e,this._combineCallOptions(r))}async invoke(e,r){return super.invoke(e,this._combineCallOptions(r))}_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}})}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(oBe(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 _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 _getEstimatedTokenCountFromPrompt(e,r,n){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(r&&n!=="auto"){let i=gqt(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}_getStructuredOutputMethod(e){let r={...e};if(!this.model.startsWith("gpt-3")&&!this.model.startsWith("gpt-4-")&&this.model!=="gpt-4"){if(r?.method===void 0)return"jsonSchema"}else r.method==="jsonSchema"&&console.warn(`[WARNING]: JSON Schema is not supported for model "${this.model}". Falling back to tool calling.`);return r.method}withStructuredOutput(e,r){let n,o,i,a;Rfn(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(i=this._getStructuredOutputMethod({...r,method:i}),i==="jsonMode"){Th(n)?u=wd.fromZodSchema(n):u=new xd;let f=xm(n);s=this.withConfig({response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"json_mode"},schema:{title:o??"extract",...f}}})}else if(i==="jsonSchema"){let f={name:o??"extract",description:pj(n),schema:n,strict:r?.strict},p=xm(f.schema);if(s=this.withConfig({response_format:{type:"json_schema",json_schema:f},ls_structured_output_format:{kwargs:{method:"json_schema"},schema:{title:f.name,description:f.description,...p}}}),Th(n)){let h=wd.fromZodSchema(n);u=Ep.from(m=>"parsed"in m.additional_kwargs?m.additional_kwargs.parsed:h)}else u=new xd}else{let f=o??"extract";if(Th(n)){let p=xm(n);s=this.withConfig({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:f}},ls_structured_output_format:{kwargs:{method:"function_calling"},schema:{title:f,...p}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new qd({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});let h=xm(n);s=this.withConfig({tools:[{type:"function",function:p}],tool_choice:{type:"function",function:{name:f}},ls_structured_output_format:{kwargs:{method:"function_calling"},schema:{title:f,...h}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new qd({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=jo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=jo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return ji.from([{raw:s},d])}},cce=class extends kK{invocationParams(e){let r;e?.strict!==void 0?r=e.strict:this.supportsStrictToolCalling!==void 0&&(r=this.supportsStrictToolCalling);let n={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?this._reduceChatOpenAITools(e.tools,{stream:this.streaming,strict:r}):void 0,tool_choice:vqt(e?.tool_choice)?e?.tool_choice:(()=>{let i=tBe(e?.tool_choice);if(typeof i=="object"&&"type"in i){if(i.type==="function")return{type:"function",name:i.function.name};if(i.type==="allowed_tools")return{type:"allowed_tools",mode:i.allowed_tools.mode,tools:i.allowed_tools.tools};if(i.type==="custom")return{type:"custom",name:i.custom.name}}})(),text:(()=>{if(e?.text)return e.text;let i=this._getResponseFormat(e?.response_format);return i?.type==="json_schema"?i.json_schema.schema!=null?{format:{type:"json_schema",schema:i.json_schema.schema,description:i.json_schema.description,name:i.json_schema.name,strict:i.json_schema.strict}}:void 0:{format:i}})(),parallel_tool_calls:e?.parallel_tool_calls,max_output_tokens:this.maxTokens===-1?void 0:this.maxTokens,prompt_cache_key:e?.promptCacheKey??this.promptCacheKey,...this.zdrEnabled?{store:!1}:{},...this.modelKwargs},o=this._getReasoningParams(e);return o!==void 0&&(n.reasoning=o),n}async _generate(e,r){let n=this.invocationParams(r);if(n.stream){let o=this._streamResponseChunks(e,r),i;for await(let a of o)a.message.response_metadata={...a.generationInfo,...a.message.response_metadata},i=i?.concat(a)??a;return{generations:i?[i]:[],llmOutput:{estimatedTokenUsage:i?.message?.usage_metadata}}}else{let o=this._convertMessagesToResponsesParams(e),i=await this.completionWithRetry({input:o,...n,stream:!1},{signal:r?.signal,...r?.options});return{generations:[{text:i.output_text,message:this._convertResponsesMessageToBaseMessage(i)}],llmOutput:{id:i.id,estimatedTokenUsage:i.usage?{promptTokens:i.usage.input_tokens,completionTokens:i.usage.output_tokens,totalTokens:i.usage.total_tokens}:void 0}}}}async*_streamResponseChunks(e,r,n){let o=await this.completionWithRetry({...this.invocationParams(r),input:this._convertMessagesToResponsesParams(e),stream:!0},r);for await(let i of o){let a=this._convertResponsesDeltaToBaseMessageChunk(i);a!=null&&(yield a,await n?.handleLLMNewToken(a.text||"",{prompt:r.promptIndex??0,completion:0},void 0,void 0,void 0,{chunk:a}))}}async completionWithRetry(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 QM(o)}})}_convertResponsesMessageToBaseMessage(e){if(e.error){let u=new Error(e.error.message);throw u.name=e.error.code,u}let r,n=[],o=[],i=[],a={model:e.model,created_at:e.created_at,id:e.id,incomplete_details:e.incomplete_details,metadata:e.metadata,object:e.object,status:e.status,user:e.user,service_tier:e.service_tier,model_name:e.model},s={};for(let u of e.output)if(u.type==="message")r=u.id,n.push(...u.content.flatMap(l=>l.type==="output_text"?("parsed"in l&&l.parsed!=null&&(s.parsed=l.parsed),{type:"text",text:l.text,annotations:l.annotations}):l.type==="refusal"?(s.refusal=l.refusal,[]):l));else if(u.type==="function_call"){let l={function:{name:u.name,arguments:u.arguments},id:u.call_id};try{o.push(Xm(l,{returnId:!0}))}catch(c){let d;typeof c=="object"&&c!=null&&"message"in c&&typeof c.message=="string"&&(d=c.message),i.push(Qm(l,d))}s[V2]??(s[V2]={}),u.id&&(s[V2][u.call_id]=u.id)}else if(u.type==="reasoning")s.reasoning=u;else if(u.type==="custom_tool_call"){let l=xqt(u);l?o.push(l):i.push(Qm(u,"Malformed custom tool call"))}else s.tool_outputs??(s.tool_outputs=[]),s.tool_outputs.push(u);return new Fn({id:r,content:n,tool_calls:o,invalid_tool_calls:i,usage_metadata:e.usage,additional_kwargs:s,response_metadata:a})}_convertResponsesDeltaToBaseMessageChunk(e){let r=[],n={},o,i=[],a={},s={},u;if(e.type==="response.output_text.delta")r.push({type:"text",text:e.delta,index:e.content_index});else if(e.type==="response.output_text.annotation.added")r.push({type:"text",text:"",annotations:[e.annotation],index:e.content_index});else if(e.type==="response.output_item.added"&&e.item.type==="message")u=e.item.id;else if(e.type==="response.output_item.added"&&e.item.type==="function_call")i.push({type:"tool_call_chunk",name:e.item.name,args:e.item.arguments,id:e.item.call_id,index:e.output_index}),s[V2]={[e.item.call_id]:e.item.id};else if(e.type==="response.output_item.done"&&["web_search_call","file_search_call","computer_call","code_interpreter_call","mcp_call","mcp_list_tools","mcp_approval_request","image_generation_call","custom_tool_call"].includes(e.item.type))s.tool_outputs=[e.item];else if(e.type==="response.created")a.id=e.response.id,a.model_name=e.response.model,a.model=e.response.model;else if(e.type==="response.completed"){let l=this._convertResponsesMessageToBaseMessage(e.response);o=e.response.usage,e.response.text?.format?.type==="json_schema"&&(s.parsed??(s.parsed=JSON.parse(l.text)));for(let[c,d]of Object.entries(e.response))c!=="id"&&(a[c]=d)}else if(e.type==="response.function_call_arguments.delta")i.push({type:"tool_call_chunk",args:e.delta,index:e.output_index});else if(e.type==="response.web_search_call.completed"||e.type==="response.file_search_call.completed")n={tool_outputs:{id:e.item_id,type:e.type.replace("response.","").replace(".completed",""),status:"completed"}};else if(e.type==="response.refusal.done")s.refusal=e.refusal;else if(e.type==="response.output_item.added"&&"item"in e&&e.item.type==="reasoning"){let l=e.item.summary?e.item.summary.map((c,d)=>({...c,index:d})):void 0;s.reasoning={id:e.item.id,type:e.item.type,...l?{summary:l}:{}}}else if(e.type==="response.reasoning_summary_part.added")s.reasoning={type:"reasoning",summary:[{...e.part,index:e.summary_index}]};else if(e.type==="response.reasoning_summary_text.delta")s.reasoning={type:"reasoning",summary:[{text:e.delta,type:"summary_text",index:e.summary_index}]};else return e.type==="response.image_generation_call.partial_image",null;return new so({text:r.map(l=>l.text).join(""),message:new xr({id:u,content:r,tool_call_chunks:i,usage_metadata:o,additional_kwargs:s,response_metadata:a}),generationInfo:n})}_convertMessagesToResponsesParams(e){return e.flatMap(r=>{let n=r.additional_kwargs,o=oBe(r);if(o==="system"&&fce(this.model)&&(o="developer"),o==="function")throw new Error("Function messages are not supported in Responses API");if(o==="tool"){let i=r;return n?.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}:i.metadata?.customTool?{type:"custom_tool_call_output",call_id:i.tool_call_id,output:i.content}:{type:"function_call_output",call_id:i.tool_call_id,id:i.id?.startsWith("fc_")?i.id:void 0,output:typeof i.content!="string"?JSON.stringify(i.content):i.content}}if(o==="assistant"){if(!this.zdrEnabled&&r.response_metadata.output!=null&&Array.isArray(r.response_metadata.output)&&r.response_metadata.output.length>0&&r.response_metadata.output.every(c=>"type"in c))return r.response_metadata.output;let i=[];if(n?.reasoning&&!this.zdrEnabled){let c=this._convertReasoningSummary(n.reasoning);i.push(c)}let{content:a}=r;n?.refusal&&(typeof a=="string"&&(a=[{type:"output_text",text:a,annotations:[]}]),a=[...a,{type:"refusal",refusal:n.refusal}]),(typeof a=="string"||a.length>0)&&i.push({type:"message",role:"assistant",...r.id&&!this.zdrEnabled&&r.id.startsWith("msg_")?{id:r.id}:{},content:typeof a=="string"?a:a.flatMap(c=>c.type==="text"?{type:"output_text",text:c.text,annotations:c.annotations??[]}:c.type==="output_text"||c.type==="refusal"?c:[])});let s=n?.[V2];Vi(r)&&r.tool_calls?.length?i.push(...r.tool_calls.map(c=>Sqt(c)?{type:"custom_tool_call",id:c.call_id,call_id:c.id??"",input:c.args.input,name:c.name}:{type:"function_call",name:c.name,arguments:JSON.stringify(c.args),call_id:c.id,...this.zdrEnabled?{id:s?.[c.id]}:{}})):n?.tool_calls&&i.push(...n.tool_calls.map(c=>({type:"function_call",name:c.function.name,call_id:c.id,arguments:c.function.arguments,...this.zdrEnabled?{id:s?.[c.id]}:{}})));let u=r.response_metadata.output?.length?r.response_metadata.output:n.tool_outputs,l=["computer_call","mcp_call","code_interpreter_call","image_generation_call"];if(u!=null){let d=u?.filter(f=>l.includes(f.type));d.length>0&&i.push(...d)}return i}if(o==="user"||o==="system"||o==="developer"){if(typeof r.content=="string")return{type:"message",role:o,content:r.content};let i=[],a=r.content.flatMap(s=>(s.type==="mcp_approval_response"&&i.push({type:"mcp_approval_response",approval_request_id:s.approval_request_id,approve:s.approve}),Eb(s)?_6(s,Pqt):s.type==="text"?{type:"input_text",text:s.text}:s.type==="image_url"?{type:"input_image",image_url:typeof s.image_url=="string"?s.image_url:s.image_url.url,detail:typeof s.image_url=="string"?"auto":s.image_url.detail}:s.type==="input_text"||s.type==="input_image"||s.type==="input_file"?s:[]));return a.length>0&&i.push({type:"message",role:o,content:a}),i}return console.warn(`Unsupported role found when converting to OpenAI Responses API: ${o}`),[]})}_convertReasoningSummary(e){let r=(e.summary.length>1?e.summary.reduce((n,o)=>{let i=n.at(-1);return i.index===o.index?i.text+=o.text:n.push(o),n},[{...e.summary[0]}]):e.summary).map(n=>Object.fromEntries(Object.entries(n).filter(([o])=>o!=="index")));return{...e,summary:r}}_reduceChatOpenAITools(e,r){let n=[];for(let o of e)lce(o)?(o.type==="image_generation"&&r?.stream&&(o.partial_images=1),n.push(o)):kd(o)?n.push({type:"function",name:o.function.name,parameters:o.function.parameters,description:o.function.description,strict:r?.strict??null}):rBe(o)&&n.push(Cqt(o));return n}},dce=class extends kK{invocationParams(e,r){let n;e?.strict!==void 0?n=e.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling);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=>this._convertChatOpenAIToolToCompletionsTool(s,{strict:n})):void 0,tool_choice:tBe(e?.tool_choice),response_format:this._getResponseFormat(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,prompt_cache_key:e?.promptCacheKey??this.promptCacheKey};e?.prediction!==void 0&&(i.prediction=e.prediction),this.service_tier!==void 0&&(i.service_tier=this.service_tier),e?.service_tier!==void 0&&(i.service_tier=e.service_tier);let a=this._getReasoningParams(e);return a!==void 0&&a.effort!==void 0&&(i.reasoning_effort=a.effort),fce(i.model)?i.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens:i.max_tokens=this.maxTokens===-1?void 0:this.maxTokens,i}async _generate(e,r,n){let o={},i=this.invocationParams(r),a=nBe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let h of s){h.message.response_metadata={...h.generationInfo,...h.message.response_metadata};let m=h.generationInfo?.completion??0;u[m]===void 0?u[m]=h:u[m]=u[m].concat(h)}let l=Object.entries(u).sort(([h],[m])=>parseInt(h,10)-parseInt(m,10)).map(([h,m])=>m),{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=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}),{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 h of s?.choices??[]){let g={text:h.message?.content??"",message:this._convertCompletionsMessageToBaseMessage(h.message??{role:"assistant"},s)};g.generationInfo={...h.finish_reason?{finish_reason:h.finish_reason}:{},...h.logprobs?{logprobs:h.logprobs}:{}},Vi(g.message)&&(g.message.usage_metadata=o),g.message=new Fn(Object.fromEntries(Object.entries(g.message).filter(([y])=>!y.startsWith("lc_")))),p.push(g)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async*_streamResponseChunks(e,r,n){let o=nBe(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._convertCompletionsDeltaToBaseMessageChunk(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 h={...p};c.finish_reason!=null&&(h.finish_reason=c.finish_reason,h.system_fingerprint=l.system_fingerprint,h.model_name=l.model,h.service_tier=l.service_tier),this.logprobs&&(h.logprobs=c.logprobs);let m=new so({message:f,text:f.content,generationInfo:h});yield m,await n?.handleLLMNewToken(m.text??"",p,void 0,void 0,void 0,{chunk:m})}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 so({message:new xr({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")}async completionWithRetry(e,r){let n=this._getClientOptions(r),o=e.response_format&&e.response_format.type==="json_schema";return this.caller.call(async()=>{try{return o&&!e.stream?await this.client.chat.completions.parse(e,n):(console.log("request",e),await this.client.chat.completions.create(e,n))}catch(i){throw QM(i)}})}_convertCompletionsMessageToBaseMessage(e,r){let n=e.tool_calls;switch(e.role){case"assistant":{let o=[],i=[];for(let u of n??[])try{o.push(Xm(u,{returnId:!0}))}catch(l){i.push(Qm(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 Fn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Js(e.content||"",e.role??"unknown")}}_convertCompletionsDeltaToBaseMessageChunk(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 xp({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 xr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Of({content:i,response_metadata:s}):o==="developer"?new Of({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Ch({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Bg({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new wp({content:i,role:o,response_metadata:s})}},nO=class t extends kK{get lc_serializable_keys(){return[...super.lc_serializable_keys,"useResponsesApi"]}constructor(e){super(e),Object.defineProperty(this,"fields",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"useResponsesApi",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"responses",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"completions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.useResponsesApi=e?.useResponsesApi??!1,this.responses=e?.responses??new cce(e),this.completions=e?.completions??new dce(e)}_useResponsesApi(e){let r=e?.tools?.some(lce),n=e?.previous_response_id!=null||e?.text!=null||e?.truncation!=null||e?.include!=null||e?.reasoning?.summary!=null||this.reasoning?.summary!=null,o=e?.tools?.some(rBe);return this.useResponsesApi||r||n||o}getLsParams(e){let r=this._combineCallOptions(e);return this._useResponsesApi(e)?this.responses.getLsParams(r):this.completions.getLsParams(r)}invocationParams(e){let r=this._combineCallOptions(e);return this._useResponsesApi(e)?this.responses.invocationParams(r):this.completions.invocationParams(r)}async _generate(e,r,n){return this._useResponsesApi(r)?this.responses._generate(e,r):this.completions._generate(e,r,n)}async*_streamResponseChunks(e,r,n){if(this._useResponsesApi(r)){yield*this.responses._streamResponseChunks(e,this._combineCallOptions(r),n);return}yield*this.completions._streamResponseChunks(e,this._combineCallOptions(r),n)}withConfig(e){let r=new t(this.fields);return r.defaultOptions={...this.defaultOptions,...e},r}}});function Tqt(t){return typeof Headers<"u"&&t!==null&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Headers]"}function mce(t){let e=jfn(()=>{if(Tqt(t))return t;if(Array.isArray(t))return new Headers(t);if(typeof t=="object"&&t!==null&&"values"in t&&Tqt(t.values))return t.values;if(typeof t=="object"&&t!==null){let r=Object.entries(t).filter(([,n])=>typeof n=="string").map(([n,o])=>[n,o]);return new Headers(r)}return new Headers});return Object.fromEntries(e.entries())}var jfn,hce=b(()=>{jfn=t=>t()});var Aqt=b(()=>{tO();to();pce();YM();hce()});var iBe=b(()=>{tO();tg();Gf();to();wL();Cy();YM();eF()});var Rqt=b(()=>{tO();to();iBe();YM();hce()});var jP,aBe=b(()=>{tO();to();CP();Cy();YM();eF();jP=class extends zp{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??ct("OPENAI_API_KEY");this.organization=r?.configuration?.organization??ct("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=Up(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=NP(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Or(i)}let r={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw QM(n)}})}}});var gce,Nqt=b(()=>{tO();to();aBe();YM();eF();hce();gce=class extends jP{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??ct("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=e?.azureOpenAIApiVersion??e?.openAIApiVersion??ct("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=e?.azureOpenAIBasePath??ct("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=e?.azureOpenAIApiInstanceName??ct("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(e?.azureOpenAIApiEmbeddingsDeploymentName||e?.azureOpenAIApiDeploymentName)??(ct("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||ct("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=NP(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};this.azureADTokenProvider||(i.apiKey=n.azureOpenAIApiKey),i.baseURL||delete i.baseURL;let a=mce(i.defaultHeaders);i.defaultHeaders={...i.defaultHeaders,"User-Agent":a["User-Agent"]?`${a["User-Agent"]}: langchainjs-azure-openai-v2`:"langchainjs-azure-openai-v2"},this.client=new XL({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 QM(n)}})}}});var jqt=b(()=>{});function Dfn(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!HYe(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new fE({content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new fE({content:Lfn(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function Lfn(t){try{return JSON.stringify(t,null,2)??""}catch{return`${t}`}}var sBe,eR,Dqt=b(()=>{MX();L6();FA();oK();bv();vB();fj();OQ();gE();mj();tle();sBe=class extends Yq{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"}),Object.defineProperty(this,"defaultConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.verboseParsingErrors=e?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=e?.responseFormat??this.responseFormat,this.defaultConfig=e?.defaultConfig??this.defaultConfig,this.metadata=e?.metadata??this.metadata}async invoke(e,r){let n,o=An(SB(this.defaultConfig,r));return jA(e)?(n=e.args,o={...o,toolCall:e}):n=e,this.call(n,o)}async call(e,r,n){let o=jA(e)?e.args:e,i;if(Th(this.schema))try{i=await NB(this.schema,o)}catch(h){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m}
Details: ${h.message}`),new lj(m,JSON.stringify(e))}else{let h=_a(o,this.schema);if(!h.valid){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m}
Details: ${h.errors.map(g=>`${g.keywordLocation}: ${g.error}`).join(`
`)}`),new lj(m,JSON.stringify(e))}i=o}let a=O6(r),u=await mu.configure(a.callbacks,this.callbacks,a.tags||n,this.tags,a.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof e=="string"?e:JSON.stringify(e),a.runId,void 0,void 0,void 0,a.runName);delete a.runId;let l;try{l=await this._call(i,u,a)}catch(h){throw await u?.handleToolError(h),h}let c,d;if(this.responseFormat==="content_and_artifact")if(Array.isArray(l)&&l.length===2)[c,d]=l;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.
Result: ${JSON.stringify(l)}`);else c=l;let f;jA(e)&&(f=e.id),!f&&FYe(a)&&(f=a.toolCall.id);let p=Dfn({content:c,artifact:d,toolCallId:f,name:this.name,metadata:this.metadata});return await u?.handleToolEnd(p),p}},eR=class extends sBe{constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:ht.object({input:ht.string().optional()}).transform(r=>r.input)})}call(e,r){let n=typeof e=="string"||e==null?{input:e}:e;return super.call(n,r)}}});var $K=b(()=>{Dqt()});var uBe,Lqt=b(()=>{to();tO();$K();uBe=class extends eR{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??ct("OPENAI_API_KEY"),n=e?.organization??ct("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseURL:e?.baseUrl};this.client=new Or(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(uBe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"})});var Fqt=b(()=>{Lqt()});var kqt=b(()=>{pce()});var $qt=b(()=>{fj()});var Bqt=b(()=>{Om();$qt();$K()});var zqt=b(()=>{tO();pce();Aqt();iBe();Rqt();Nqt();aBe();jqt();eF();YM();Fqt();kqt();Bqt()});var yce=b(()=>{zqt()});var bce,Uqt=b(()=>{CP();Cy();to();bce=class extends zp{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||ct("JINA_API_KEY")||ct("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=Up(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 qqt=b(()=>{Uqt()});var _ce,Hqt=b(()=>{qqt();_ce=class extends bce{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}}});var BK,Vqt=b(()=>{yce();BK=class extends jP{constructor(e){super(e),this.customConfig=e}async embedQuery(e){return(await this.callEmbeddingAPI([e]))[0]}async embedDocuments(e){return await this.callEmbeddingAPI(e)}async callEmbeddingAPI(e){let r={model:this.customConfig.modelName,input:e,encoding_format:"float"},o=`${this.customConfig.configuration?.baseURL||"https://api.openai.com/v1"}/embeddings`,i=this.customConfig.apiKey,s=await(this.customConfig.configuration?.fetch||fetch)(o,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok){let l=await s.text();throw new Error(`Embedding API request failed: ${s.status} ${s.statusText} - ${l}`)}let u=await s.json();if(!u.data||!Array.isArray(u.data))throw new Error("Invalid API response format: missing or invalid data array");return u.data.map(l=>{if(!l.embedding||!Array.isArray(l.embedding))throw new Error("Invalid API response format: missing or invalid embedding array");return l.embedding})}}});var vce,Ffn,Pu,tF=b(()=>{nr();Aj();vE();bt();Ey();fr();lFe();gFe();IFe();yce();vce=require("obsidian");Hqt();Vqt();Ffn={"copilot-plus":BK,"copilot-plus-jina":_ce,openai:jP,cohereai:ale,google:ple,"azure openai":gce,ollama:ble,"lm-studio":BK,"3rd party (openai-format)":jP},Pu=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>oe().plusLicenseKey,"copilot-plus-jina":()=>oe().plusLicenseKey,openai:()=>oe().openAIApiKey,cohereai:()=>oe().cohereApiKey,google:()=>oe().googleApiKey,"azure openai":()=>oe().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key"};this.initialize(),va(()=>this.initialize())}initialize(){let e=oe().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let r=Ffn[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(GA).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=en(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=en(r);return e===n})[0]}async getEmbeddingsAPI(){let{embeddingModelKey:e}=oe();if(!t.modelMap.hasOwnProperty(e))throw new tn(`No embedding model found for: ${e}`);let r=this.getCustomModel(e);if(r.plusExclusive&&!oe().isPlusUser)throw new vce.Notice("Plus-only model, please consider upgrading to Plus to access it."),new tn("Plus-only model selected but user is not on Plus plan");if(r.believerExclusive){let a=await Gi.getInstance().validateLicenseKey();if(!a.plan||a.plan.toLowerCase()!=="believer")throw new vce.Notice("Believer-only model, please consider upgrading to Believer to access it."),new tn("Believer-only model selected but user is not on Believer plan")}let n=t.modelMap[e];if(!n.hasApiKey)throw new tn(`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 tn(`Error creating embedding model: ${e}. ${i.message}`)}}async getEmbeddingConfig(e){let r=oe(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await _o(r.plusLicenseKey),timeout:1e4,batchSize:oe().embeddingBatchSize,configuration:{baseURL:ZA,fetch:e.enableCors?yu:void 0}},"copilot-plus-jina":{model:n,apiKey:await _o(r.plusLicenseKey),timeout:1e4,batchSize:oe().embeddingBatchSize,dimensions:e.dimensions,baseUrl:ZA+"/embeddings",configuration:{fetch:e.enableCors?yu:void 0}},openai:{modelName:n,apiKey:await _o(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:oe().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?yu:void 0}},cohereai:{model:n,apiKey:await _o(e.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await _o(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await _o(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 _o(e.apiKey||"default-key")}`}},"lm-studio":{modelName:n,openAIApiKey:await _o(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?yu:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await _o(e.apiKey||""),batchSize:oe().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?yu: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 vce.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: `+Xn(n)+`
with CORS Error: `+Xn(o);throw new Error(i)}}}}});function Gqt(t){return t!==void 0&&zK.includes(t)?Wqt[t]:void 0}var Wqt,Kqt,zK,wce=b(()=>{Wqt={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"},Kqt={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},zK=Object.keys(Wqt)});function ia(t,e){if(e.length<lBe)Array.prototype.push.apply(t,e);else{let r=e.length;for(let n=0;n<r;n+=lBe)Array.prototype.push.apply(t,e.slice(n,n+lBe))}}function Qqt(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 Bfn(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function zfn(){return typeof process<"u"&&process.release&&process.release.name==="node"}function Xqt(){return BigInt(Math.floor(performance.now()*1e6))}function rF(t){return typeof t=="number"&&(t=BigInt(t)),t<Jqt?`${t}ns`:t<Zqt?`${t/Jqt}\u03BCs`:t<Yqt?`${t/Zqt}ms`:`${t/Yqt}s`}function p_(){return Bfn()?Xqt():zfn()||typeof process<"u"&&typeof process?.hrtime?.bigint=="function"?process.hrtime.bigint():typeof performance<"u"?Xqt():BigInt(0)}function UK(){return`${kfn}-${$fn++}`}function W2(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 e2t(t,e){return e[1]===t[1]?t[0]-e[0]:e[1]-t[1]}function K2(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 xce(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 G2(t,e){return xce(t,[e])[e]}function cBe(t,e){let r=Ufn[e];if(r===void 0)throw new Error(Yt("INVALID_DISTANCE_SUFFIX",t).message);return t*r}function Sce(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 Tu(t){return t?.constructor?.name==="AsyncFunction"}var kfn,$fn,Jqt,Zqt,Yqt,lBe,Ufn,lu=b(()=>{Wc();kfn=Date.now().toString().slice(5),$fn=0,Jqt=BigInt(1e3),Zqt=BigInt(1e6),Yqt=BigInt(1e9),lBe=65535;Ufn={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344}});function Yt(t,...e){let r=new Error(Qqt(Hfn[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}var qfn,Hfn,Wc=b(()=>{wce();lu();qfn=zK.join(`
- `),Hfn={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:
- ${qfn}`,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 t2t(t){return{raw:Number(t),formatted:rF(t)}}function r2t(t){if(t.id){if(typeof t.id!="string")throw Yt("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return UK()}function dBe(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(DP(n)){let i=pBe(n);if(!Array.isArray(o)||o.length!==i)throw Yt("INVALID_INPUT_VECTOR",r,i,o.length);continue}if(J2(n)){if(!Array.isArray(o))return r;let i=fBe(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=dBe(o,n);if(i)return r+"."+i;continue}if(typeof o!==n)return r}}}function n2t(t){return t==="geopoint"}function DP(t){return typeof t=="string"&&/^vector\[\d+\]$/.test(t)}function J2(t){return typeof t=="string"&&Vfn[t]}function fBe(t){return Wfn[t]}function pBe(t){let e=Number(t.slice(7,-1));switch(!0){case isNaN(e):throw Yt("INVALID_VECTOR_VALUE",t);case e<=0:throw Yt("INVALID_VECTOR_SIZE",t);default:return e}}var Vfn,Wfn,qK=b(()=>{Wc();lu();lu();Vfn={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},Wfn={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"}});function o2t(){return{idToInternalId:new Map,internalIdToId:[],save:Kfn,load:Gfn}}function Kfn(t){return{internalIdToId:t.internalIdToId}}function Gfn(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 $i(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?$i(t,e.toString()):e}function Py(t,e){if(t.internalIdToId.length<e)throw new Error(`Invalid internalId ${e}`);return t.internalIdToId[e-1]}var Ty=b(()=>{});function Zfn(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function Yfn(t,e){let r=$i(t.sharedInternalDocumentStore,e);return t.docs[r]}function Xfn(t,e){let r=e.length,n=Array.from({length:r});for(let o=0;o<r;o++){let i=$i(t.sharedInternalDocumentStore,e[o]);n[o]=t.docs[i]}return n}function Qfn(t){return t.docs}function epn(t,e,r){let n=$i(t.sharedInternalDocumentStore,e);return typeof t.docs[n]<"u"?!1:(t.docs[n]=r,t.count++,!0)}function tpn(t,e){let r=$i(t.sharedInternalDocumentStore,e);return typeof t.docs[r]>"u"?!1:(delete t.docs[r],t.count--,!0)}function rpn(t){return t.count}function npn(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function opn(t){return{docs:t.docs,count:t.count}}function i2t(){return{create:Zfn,get:Yfn,getMultiple:Xfn,getAll:Qfn,store:epn,remove:tpn,count:rpn,load:npn,save:opn}}var mBe=b(()=>{Ty()});function s2t(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),Yt("PLUGIN_CRASHED")}return r}var a2t,u2t=b(()=>{Wc();a2t=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"]});function m_(t,e,r,n){if(t.some(Tu))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function nF(t,e,r){if(t.some(Tu))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function Z2(t,e,r,n,o){if(t.some(Tu))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function Y2(t,e,r,n){if(t.some(Tu))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function c2t(t,e){if(t.some(Tu))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}var l2t,hBe,tR=b(()=>{lu();l2t=["tokenizer","index","documentsStore","sorter"],hBe=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"]});function gBe(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(Ay(t.l),Ay(t.r))+1,e.h=Math.max(Ay(e.l),Ay(e.r))+1,e}function yBe(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(Ay(t.l),Ay(t.r))+1,e.h=Math.max(Ay(e.l),Ay(e.r))+1,e}function f2t(t,e,r){let n=[];function o(i){i!==null&&(e<i.k&&o(i.l),i.k>=e&&i.k<=r&&ia(n,i.v),r>i.k&&o(i.r))}return o(t.root),n}function bBe(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&&ia(n,i.v),!r&&i.k>e&&ia(n,i.v),o.push(i.r),o.push(i.l))}return n}function _Be(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&&ia(n,i.v),!r&&i.k<e&&ia(n,i.v),o.push(i.r),o.push(i.l))}return n}function p2t(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 m2t(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}function h2t(t,e,r,n=500){function o(i,a,s){if(i===null)return d2t++,{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 d2t%n===0?apn(i,a):i}t.root=o(t.root,e,r)}function apn(t,e){t.h=1+Math.max(Ay(t.l),Ay(t.r));let r=Ay(t.l)-Ay(t.r);return r>1&&e<t.l.k?yBe(t):r<-1&&e>t.r.k?gBe(t):r>1&&e>t.l.k?(t.l=gBe(t.l),yBe(t)):r<-1&&e<t.r.k?(t.r=yBe(t.r),gBe(t)):t}function Ay(t){return t!==null?t.h:-1}function g2t(t,e){let r=p2t(t.root,e);return r===null?null:r.v}function spn(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 y2t(t,e,r){let n=p2t(t.root,r);if(n){if(n.v.length===1){spn(t,r);return}n.v.splice(n.v.indexOf(e),1)}}var d2t,b2t=b(()=>{lu();d2t=0});function _2t(){return{numberToDocumentId:new Map}}function v2t(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function w2t(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 x2t(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&&ia(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&&ia(i,u)}return i}}throw new Error("Invalid operation")}function S2t(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 K2(i)}}throw new Error("Invalid operation")}var C2t=b(()=>{lu()});function upn(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 vBe(t,e,r){let n=upn(t,e,r);return{distance:n,isBounded:n>=0}}var wBe=b(()=>{});function X2(t,e){t.w=e.w+t.s}function Cce(t,e){t.d.push(e)}function lpn(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function SBe(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(W2(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&vBe(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),W2(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))SBe(t.c[i],e,r,n,o);return e}function O2t(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 oF(t=!1,e="",r=""){return new xBe(r,e,t)}function E2t(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=O2t(u,a),d=c.length;if(u===a){Cce(s,r),s.e=!0;return}let f=u[d];if(d<l&&d===a.length){let p=oF(!0,a,i);p.c[f]=s;let h=p.c[f];h.s=u.substring(d),h.k=f,t.c[i]=p,X2(p,t),X2(h,p),Cce(p,r);return}if(d<l&&d<a.length){let p=oF(!1,c,i);p.c[f]=s,t.c[i]=p;let h=p.c[f];h.s=u.substring(d),h.k=f;let m=a[d],g=oF(!0,e.substring(o+d),m);Cce(g,r),p.c[m]=g,X2(p,t),X2(g,p),X2(h,p);return}o+=l-1,t=s}else{let u=oF(!0,a,i);Cce(u,r),t.c[i]=u,X2(u,t);return}}}function HK(t,e,r,n,o,i){if(!(n<0)){if(t.w.startsWith(e)){SBe(t,i,e,!1,0);return}if(t.e){let{w:a,d:s}=t;if(a&&(vBe(e,a,o).isBounded&&(i[a]=[]),W2(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&&HK(t.c[e[r]],e,r+1,n,o,i),HK(t,e,r+1,n-1,o,i);for(let a in t.c)HK(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&HK(t.c[a],e,r+1,n-1,o,i)}}}function CBe(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,HK(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=O2t(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 SBe(t,i,e,r,n),i}}function P2t(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||lpn(t,r)}else return!1}return!0}var xBe,T2t=b(()=>{wBe();lu();xBe=class{constructor(e,r,n){gd(this,"k");gd(this,"s");gd(this,"c",{});gd(this,"d",[]);gd(this,"e");gd(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 A2t(){return{root:null}}function I2t(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 M2t(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 R2t(t,e,r,n=!0,o="asc",i=!1){let a=i?D2t:j2t,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 N2t(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=dpn(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=cpn(e);if(n){let u=o?D2t:j2t;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 cpn(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 dpn(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 j2t(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 D2t(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),h=Math.cos(c),m=u,g,y=1e3,_,w,S,C,E;do{let D=Math.sin(m),k=Math.cos(m);S=Math.sqrt(h*D*(h*D)+(f*p-d*h*k)*(f*p-d*h*k)),C=d*p+f*h*k,E=Math.atan2(S,C),_=f*h*D/S,w=1-_*_;let F=C-2*d*p/w,K=n/16*w*(4+n*(4-3*w));g=m,m=u+(1-K)*n*_*(E+K*S*(F+K*C*(-1+2*F*F)))}while(Math.abs(m-g)>1e-12&&--y>0);let P=w*(6378137*6378137-o*o)/(o*o),T=1+P/16384*(4096+P*(-768+P*(320-175*P))),I=P/1024*(256+P*(-128+P*(74-47*P))),N=I*S*(C-2*d*p/w+I/4*(C*(-1+2*S*S)-I/6*E*(-3+4*S*S)*(-3+4*E*E)));return o*T*(E-N)}var L2t=b(()=>{});function Oce(t,e,r=0,n){if(e===0)throw Yt("INVALID_BOOST_VALUE");let o=new Map,i=t.length;for(let m=0;m<i;m++){let g=t[m],y=g.length;for(let _=0;_<y;_++){let[w,S]=g[_],C=S*e,E=o.get(w)?.[0];E!==void 0?o.set(w,[E*1.5+C,(o?.get(w)?.[1]||0)+1]):o.set(w,[C,1])}}let a=[];for(let m of o.entries())a.push([m[0],m[1][0]]);let s=a.sort((m,g)=>g[1]-m[1]);if(r===1)return s;let u=s.length,l=[];for(let m of o.entries())l.push([m[0],m[1][0],m[1][1]]);let c=l.sort((m,g)=>m[2]>g[2]?-1:m[2]<g[2]?1:m[1]>g[1]?-1:m[1]<g[1]?1:0),d;for(let m=0;m<u&&c[m][2]===n;m++)d=m;if(typeof d>"u"){if(r===0)return[];d=0}let f=c.length,p=new Array(f);for(let m=0;m<f;m++)p[m]=[c[m][0],c[m][1]];if(r===0)return p.slice(0,d+1);let h=d+Math.ceil(r*100*(u-d)/100);return p.slice(0,u+h)}function OBe(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))}var VK=b(()=>{Wc()});function EBe(t,e){let r=0;for(let n=0;n<e;n++)r+=t[n]*t[n];return Math.sqrt(r)}function Ece(t,e,r,n=.8){let o=EBe(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])}var Pce=b(()=>{});function fpn(t,e,r,n,o){let i=$i(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 ppn(t,e,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=$i(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 mpn(t,e,r,n){let o=$i(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 hpn(t,e,r){t.tokenOccurrences[e][r]--}function gpn(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 h=$i(e.sharedInternalDocumentStore,i[p]),m=l?.[h]?.[n]??0,g=OBe(m,c,t.docsCount,s[h],a,t.params.relevance);d.push([h,g])}return d}function k2t(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)){k2t(t,e,a,n,s);continue}if(DP(a))n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a,n.vectorIndexes[s]={size:pBe(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:m2t(0,[]),isArray:u};break;case"string":case"string[]":n.indexes[s]={type:"Radix",node:oF(),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:_2t(),isArray:u};break;case"geopoint":n.indexes[s]={type:"BKD",node:A2t(),isArray:u};break;default:throw Yt("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,s)}n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a}}return n}function ypn(t,e,r,n,o,i,a,s){return u=>{let l=$i(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;h2t(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),E2t(d,p,l);break}case"Flat":{v2t(d,u,l);break}case"BKD":{I2t(d,u,[l]);break}}}}function bpn(t,e,r,n,o,i,a,s,u,l){if(DP(i))return _pn(e,r,o,n);let c=ypn(t,e,r,n,a,s,u,l);if(!J2(i))return c(o);let d=o,f=d.length;for(let p=0;p<f;p++)c(d[p])}function _pn(t,e,r,n){r instanceof Float32Array||(r=new Float32Array(r));let o=t.vectorIndexes[e].size,i=EBe(r,o);t.vectorIndexes[e].vectors[n]=[i,r]}function F2t(t,e,r,n,o,i,a,s,u){let l=$i(e.sharedInternalDocumentStore,n);if(DP(i))return delete e.vectorIndexes[r].vectors[n],!0;let{type:c,node:d}=e.indexes[r];switch(c){case"AVL":return y2t(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),P2t(d,p,l);return!0}case"Flat":return w2t(d,l,o),!0;case"BKD":return M2t(d,o,l),!1}}function vpn(t,e,r,n,o,i,a,s,u){if(!J2(i))return F2t(t,e,r,n,o,i,a,s,u);let l=fBe(i),c=o,d=c.length;for(let f=0;f<d;f++)F2t(t,e,r,n,c[f],l,a,s,u);return!0}function wpn(t,e,r,n){if(!(r in e.tokenOccurrences))return[];let{node:o,type:i}=e.indexes[r];if(i!=="Radix")throw Yt("WRONG_SEARCH_PROPERTY_TYPE",r);let{exact:a,tolerance:s}=t.params,u=CBe(o,{term:n,exact:a,tolerance:s}),l=new Set;for(let c in u)if(W2(u,c))for(let f of u[c])l.add(f);return t.index.calculateResultScores(t,e,r,n,Array.from(l))}function xpn(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 Yt("UNKNOWN_FILTER_PROPERTY",i);let{node:s,type:u,isArray:l}=e.indexes[i];if(u==="Bool"){let f=s[a.toString()];ia(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:h="m",inside:m=!0,highPrecision:g=!1}=a[d],y=cBe(f,h),_=R2t(s.root,p,y,m,void 0,g);ia(o[i],_.flatMap(({docIDs:w})=>w))}else{let{coordinates:f,inside:p=!0,highPrecision:h=!1}=a[d],m=N2t(s.root,f,p,void 0,h);ia(o[i],m.flatMap(({docIDs:g})=>g))}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 h=CBe(s,{term:p,exact:!0});ia(o[i],Object.values(h).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw Yt("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?S2t:x2t;ia(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=bBe(s,f,!1);break}case"gte":{p=bBe(s,f,!0);break}case"lt":{p=_Be(s,f,!1);break}case"lte":{p=_Be(s,f,!0);break}case"eq":{p=g2t(s,f)??[];break}case"between":{let[h,m]=f;p=f2t(s,h,m);break}}ia(o[i],p)}}return K2(Object.values(o))}function Spn(t){return t.searchableProperties}function Cpn(t){return t.searchablePropertiesWithTypes}function $2t(t){let e=oF(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]=$2t(t.c[r]);return e}function Opn(t){return{numberToDocumentId:new Map(t)}}function Epn(t){return Array.from(t.numberToDocumentId.entries())}function Ppn(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:h,isArray:m}=r[f];switch(h){case"Radix":c[f]={type:"Radix",node:$2t(p),isArray:m};break;case"Flat":c[f]={type:"Flat",node:Opn(p),isArray:m};break;default:c[f]=r[f]}}for(let f of Object.keys(n)){let p=n[f].vectors;for(let h in p)p[h]=[p[h][0],new Float32Array(p[h][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 Tpn(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:h}=e[d];if(f!=="Flat"){c[d]=e[d];continue}c[d]={type:"Flat",node:Epn(p),isArray:h}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function B2t(){return{create:k2t,insert:bpn,remove:vpn,insertDocumentScoreParameters:fpn,insertTokenScoreParameters:ppn,removeDocumentScoreParameters:mpn,removeTokenScoreParameters:hpn,calculateResultScores:gpn,search:wpn,searchByWhereClause:xpn,getSearchableProperties:Spn,getSearchablePropertiesWithTypes:Cpn,load:Ppn,save:Tpn}}var PBe=b(()=>{Wc();b2t();C2t();T2t();L2t();lu();VK();Pce();qK();Ty()});function z2t(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=z2t(t,e,s,n,u);ia(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!DP(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 Yt("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function Ipn(t,e,r,n){return n?.enabled!==!1?z2t(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function Mpn(t,e,r,n){if(!t.enabled)return;t.isSorted=!1;let o=$i(t.sharedInternalDocumentStore,r),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&TBe(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function U2t(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)Dpn(t,r);t.isSorted=!0}function Rpn(t,e,r){return e[1].localeCompare(r[1],Gqt(t))}function Npn(t,e){return t[1]-e[1]}function jpn(t,e){return e[1]?-1:1}function Dpn(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=Rpn.bind(null,t.language);break;case"number":n=Npn.bind(null);break;case"boolean":n=jpn.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 Lpn(t){let e=Object.keys(t.sorts);for(let r of e)TBe(t,r)}function TBe(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 Fpn(t,e,r){if(!t.enabled)return;let n=t.sorts[e],o=$i(t.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function kpn(t,e,r){if(!t.enabled)throw Yt("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw Yt("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return TBe(t,n),U2t(t),e.sort((a,s)=>{let u=i.docs.get($i(t.sharedInternalDocumentStore,a[0])),l=i.docs.get($i(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 $pn(t){return t.enabled?t.sortableProperties:[]}function Bpn(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function zpn(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 Upn(t){if(!t.enabled)return{enabled:!1};Lpn(t),U2t(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 q2t(){return{create:Ipn,insert:Mpn,remove:Fpn,save:Upn,load:zpn,sortBy:kpn,getSortableProperties:$pn,getSortablePropertiesWithTypes:Bpn}}var ABe=b(()=>{Wc();qK();Ty();lu();wce()});function Vpn(t){return t<192||t>383?t:Hpn[t-192]||t}function H2t(t){let e=[];for(let r=0;r<t.length;r++)e[r]=Vpn(t.charCodeAt(r));return String.fromCharCode(...e)}var Hpn,V2t=b(()=>{Hpn=[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 K2t(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(IBe),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(W2t),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+oO+Ace+"[^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(W2t),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(IBe),e&&n.test(e)&&(t=e+Wpn[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(IBe),e&&n.test(e)&&(t=e+Kpn[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(Tce),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(Tce),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(Tce),o=new RegExp(Jpn),i=new RegExp("^"+oO+Ace+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(Tce),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}var Wpn,Kpn,Gpn,Ace,oO,WK,IBe,Jpn,Tce,W2t,G2t=b(()=>{Wpn={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"},Kpn={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},Gpn="[^aeiou]",Ace="[aeiouy]",oO=Gpn+"[^aeiouy]*",WK=Ace+"[aeiou]*",IBe="^("+oO+")?"+WK+oO,Jpn="^("+oO+")?"+WK+oO+"("+WK+")?$",Tce="^("+oO+")?"+WK+oO+WK+oO,W2t="^("+oO+")?"+Ace});function MBe(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=H2t(e),this.normalizationCache.set(r,e),e)}function Zpn(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function J2t(t,e,r){if(e&&e!==this.language)throw Yt("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=Kqt[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=Zpn(n);return this.allowDuplicates?o:Array.from(new Set(o))}function RBe(t={}){if(!t.language)t.language="english";else if(!zK.includes(t.language))throw Yt("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw Yt("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=K2t;else throw Yt("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 Yt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw Yt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw Yt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:J2t,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:MBe,normalizationCache:new Map};return n.tokenize=J2t.bind(n),n.normalizeToken=MBe,n}var Ice=b(()=>{Wc();V2t();wce();G2t()});function Xpn(t){let e={formatElapsedTime:t2t,getDocumentIndexId:r2t,getDocumentProperties:xce,validateSchema:dBe};for(let r of hBe){let n=r;if(t[n]){if(typeof t[n]!="function")throw Yt("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!l2t.includes(r)&&!hBe.includes(r))throw Yt("UNSUPPORTED_COMPONENT",r)}function Q2({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=UK());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=RBe(a):a=RBe({language:r??"english"}),n.tokenizer&&r)throw Yt("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=o2t();s||(s=B2t()),l||(l=q2t()),u||(u=i2t()),Xpn(n);let{getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,formatElapsedTime:h}=n,m={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:h,id:o,plugins:i,version:Qpn()};m.data={index:m.index.create(m,c,t),docs:m.documentsStore.create(m,c),sorting:m.sorter.create(m,c,t,e)};for(let y of a2t)m[y]=(m[y]??[]).concat(s2t(m,y));let g=m.afterCreate;return g&&c2t(g,m),m}function Qpn(){return"{{VERSION}}"}var Z2t=b(()=>{qK();mBe();u2t();tR();PBe();Ty();ABe();Ice();Wc();lu()});var Y2t=b(()=>{});var NBe=b(()=>{qK();mBe();PBe();Ice();ABe();Ty()});var Mce,jBe,DBe,LBe=b(()=>{Mce="fulltext",jBe="hybrid",DBe="vector"});var rR,nR,FBe=b(()=>{LBe();rR=Symbol("orama.insertions"),nR=Symbol("orama.removals")});function kBe(t){typeof t[rR]!="number"&&(queueMicrotask(()=>{t[rR]=void 0}),t[rR]=0),t[rR]>1e3?(X2t("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[rR]=-1):t[rR]>=0&&t[rR]++}function $Be(t){typeof t[nR]!="number"&&(queueMicrotask(()=>{t[nR]=void 0}),t[nR]=0),t[nR]>1e3?(X2t("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[nR]=-1):t[nR]>=0&&t[nR]++}var X2t,BBe=b(()=>{FBe();X2t=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)}});function KK(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw Yt("SCHEMA_VALIDATION_FAILURE",i);return Tu(t.index.beforeInsert)||Tu(t.index.insert)||Tu(t.index.afterInsert)?nmn(t,e,r,n,o):omn(t,e,r,n,o)}async function nmn(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Yt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Yt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await m_(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 h=typeof p,m=c[f];Q2t(h,m,f,p)}return await imn(t,s,l,d,u,r,e,o),n||await m_(t.afterInsert,t,s,e),kBe(t),s}function omn(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Yt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Yt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||m_(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 h=typeof p,m=c[f];Q2t(h,m,f,p)}return amn(t,s,l,d,u,r,e,o),n||m_(t.afterInsert,t,s,e),kBe(t),s}function Q2t(t,e,r,n){if(!(n2t(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(DP(e)&&Array.isArray(n))&&!(J2(e)&&Array.isArray(n))&&!(tmn.has(e)&&rmn.has(t))&&t!==e)throw Yt("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function imn(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 amn(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)}}var tmn,rmn,zBe=b(()=>{NBe();lu();tR();BBe();Wc();tmn=new Set(["enum","enum[]"]),rmn=new Set(["string","number"])});function iF(t,e,r,n){return Tu(t.index.beforeRemove)||Tu(t.index.remove)||Tu(t.index.afterRemove)?smn(t,e,r,n):umn(t,e,r,n)}async function smn(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=Py(t.internalDocumentIDStore,$i(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await m_(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let m of c){let g=f[m];if(typeof g>"u")continue;let y=d[m];await t.index.beforeRemove?.(t.data.index,m,u,g,y,r,t.tokenizer,l),await t.index.remove(t.index,t.data.index,m,e,g,y,r,t.tokenizer,l)||(o=!1),await t.index.afterRemove?.(t.data.index,m,u,g,y,r,t.tokenizer,l)}let p=await t.sorter.getSortableProperties(t.data.sorting),h=await t.getDocumentProperties(s,p);for(let m of p)typeof h[m]>"u"||t.sorter.remove(t.data.sorting,m,e);return n||await m_(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),$Be(t),o}function umn(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=Py(t.internalDocumentIDStore,$i(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||m_(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let m of c){let g=f[m];if(typeof g>"u")continue;let y=d[m];t.index.beforeRemove?.(t.data.index,m,u,g,y,r,t.tokenizer,l),t.index.remove(t.index,t.data.index,m,e,g,y,r,t.tokenizer,l)||(o=!1),t.index.afterRemove?.(t.data.index,m,u,g,y,r,t.tokenizer,l)}let p=t.sorter.getSortableProperties(t.data.sorting),h=t.getDocumentProperties(s,p);for(let m of p)typeof h[m]>"u"||t.sorter.remove(t.data.sorting,m,e);return n||m_(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),$Be(t),o}function GK(t,e,r,n,o){return Tu(t.index.beforeRemove)||Tu(t.index.remove)||Tu(t.index.afterRemove)||Tu(t.beforeRemoveMultiple)||Tu(t.afterRemoveMultiple)?lmn(t,e,r,n,o):cmn(t,e,r,n,o)}async function lmn(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>Py(t.internalDocumentIDStore,$i(t.internalDocumentIDStore,s)));return o||await nF(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 iF(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await nF(t.afterRemoveMultiple,t,a),i}function cmn(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>Py(t.internalDocumentIDStore,$i(t.internalDocumentIDStore,l)));o||nF(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)iF(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||nF(t.afterRemoveMultiple,t,a),i}var UBe=b(()=>{tR();Ty();BBe();lu()});function dmn(t,e){return t[1]-e[1]}function fmn(t,e){return e[1]-t[1]}function pmn(t="desc"){return t.toLowerCase()==="asc"?dmn:fmn}function e4(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 h=0;h<f;h++){let m=d[h];p[h]=[`${m.from}-${m.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(".")?G2(c,d):c[d],p=s[d],h=n[d].values;switch(p){case"number":{let m=r[d].ranges;e4t(m,h)(f);break}case"number[]":{let m=new Set,g=r[d].ranges,y=e4t(g,h,m);for(let _ of f)y(_);break}case"boolean":case"enum":case"string":{t4t(h,p)(f);break}case"boolean[]":case"enum[]":case"string[]":{let y=t4t(h,p==="boolean[]"?"boolean":"string",new Set);for(let _ of f)y(_);break}default:throw Yt("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=pmn(d.sort);c.values=Object.fromEntries(Object.entries(c.values).sort(f).slice(d.offset??0,d.limit??10))}}return n}function e4t(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 t4t(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))}}var Rce=b(()=>{Wc();lu()});function t4(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 Nce=b(()=>{});function r4(t,e,r){let n=r.properties,o=n.length,i=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let y=0;y<o;y++){let _=n[y];if(typeof i[_]>"u")throw Yt("UNKNOWN_GROUP_BY_PROPERTY",_);if(!r4t.includes(i[_]))throw Yt("INVALID_GROUP_BY_PROPERTY",_,r4t.join(", "),i[_])}let a=e.map(([y])=>Py(t.internalDocumentIDStore,y)),s=t.documentsStore.getMultiple(t.data.docs,a),u=s.length,l=r.maxResult||Number.MAX_SAFE_INTEGER,c=[],d={};for(let y=0;y<o;y++){let _=n[y],w={property:_,perValue:{}},S=new Set;for(let C=0;C<u;C++){let E=s[C],P=G2(E,_);if(typeof P>"u")continue;let T=typeof P!="boolean"?P:""+P,I=w.perValue[T]??{indexes:[],count:0};I.count>=l||(I.indexes.push(C),I.count++,w.perValue[T]=I,S.add(P))}c.push(Array.from(S)),d[_]=w}let f=n4t(c),p=f.length,h=[];for(let y=0;y<p;y++){let _=f[y],w=_.length,S={values:[],indexes:[]},C=[];for(let E=0;E<w;E++){let P=_[E],T=n[E];C.push(d[T].perValue[typeof P!="boolean"?P:""+P].indexes),S.values.push(P)}S.indexes=K2(C).sort((E,P)=>E-P),S.indexes.length!==0&&h.push(S)}let m=h.length,g=Array.from({length:m});for(let y=0;y<m;y++){let _=h[y],w=r.reduce||mmn,S=_.indexes.map(T=>({id:a[T],score:e[T][1],document:s[T]})),C=w.reducer.bind(null,_.values),E=w.getInitialValue(_.indexes.length),P=S.reduce(C,E);g[y]={values:_.values,result:P}}return g}function n4t(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=n4t(t,e+1),o=[];for(let i of r)for(let a of n){let s=[i];ia(s,a),o.push(s)}return o}var mmn,r4t,jce=b(()=>{Wc();lu();Ty();mmn={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},r4t=["string","number","boolean"]});function o4t(t,e,r){let n=p_(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(Dce,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:h,includeVectors:m=!1}=e,g=e.preflight===!0,{index:y,docs:_}=t.data,w=t.tokenizer.tokenize(d??"",r),S=t.caches.propertiesToSearch;if(!S){let D=t.index.getSearchablePropertiesWithTypes(y);S=t.index.getSearchableProperties(y),S=S.filter(k=>D[k].startsWith("string")),t.caches.propertiesToSearch=S}if(f&&f!=="*"){for(let D of f)if(!S.includes(D))throw Yt("UNKNOWN_INDEX",D,S.join(", "));S=S.filter(D=>f.includes(D))}let C=aF(t.tokenizer,t.index,t.documentsStore,r,e,S,w,t.documentsStore.count(_),n),E=Object.keys(e.where??{}).length>0,P=[];E&&(P=t.index.searchByWhereClause(C,y,e.where));let T=w.length;if(T||f?.length){let D=S.length;for(let k=0;k<D;k++){let F=S[k],K=C.indexMap[F];if(T!==0)for(let L=0;L<T;L++){let Q=w[L],z=t.index.search(C,y,F,Q);ia(K[Q],z)}else{K[""]=[];let L=t.index.search(C,y,F,"");ia(K[""],L)}let U=Object.values(K);C.docsIntersection[F]=Oce(U,e?.boost?.[F]??1,p,T);let Y=C.docsIntersection[F],ee=Y.length;for(let L=0;L<ee;L++){let[Q,z]=Y[L],W=C.uniqueDocsIDs[Q];W?C.uniqueDocsIDs[Q]=W+z+.5:C.uniqueDocsIDs[Q]=z}}}else w.length===0&&d?C.uniqueDocsIDs={}:C.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(D=>[D,0]));let I=Object.entries(C.uniqueDocsIDs).map(([D,k])=>[+D,k]);if(E&&(I=t4(P,I)),e.sortBy)if(typeof e.sortBy=="function"){let D=I.map(([K])=>K),F=t.documentsStore.getMultiple(t.data.docs,D).map((K,U)=>[I[U][0],I[U][1],K]);F.sort(e.sortBy),I=F.map(([K,U])=>[K,U])}else I=t.sorter.sortBy(t.data.sorting,I,e.sortBy).map(([D,k])=>[$i(t.internalDocumentIDStore,D),k]);else I=I.sort(e2t);let N;g||(N=h?a4t(t,I,c,l,h):Lce(t,I,c,l));let M={elapsed:{formatted:"",raw:0},hits:[],count:I.length};if(typeof N<"u"&&(M.hits=N.filter(Boolean),m||Sce(M,s)),u){let D=e4(t,I,e.facets);M.facets=D}return e.groupBy&&(M.groups=r4(t,I,e.groupBy)),M.elapsed=t.formatElapsedTime(p_()-C.timeStart),M}async function a(){t.beforeSearch&&await Y2(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await Z2(t.afterSearch,t,e,r,s),s}return o?a():i()}var i4t=b(()=>{VK();Rce();Nce();jce();tR();Ty();Wc();lu();sF()});function qBe(t,e,r="english"){let n=p_(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw Yt("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,h=e.facets&&Object.keys(e.facets).length>0,m=Object.keys(e.where??{}).length>0,{index:g,docs:y}=t.data;if(s?.value.length!==f)throw s?.property===void 0||s?.value.length===void 0?Yt("INVALID_INPUT_VECTOR","undefined",f,"undefined"):Yt("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let _=Ece(s.value,p,f,e.similarity).map(([D,k])=>[$i(t.internalDocumentIDStore,D),k]),w=t.caches.propertiesToSearch;if(!w){let D=t.index.getSearchablePropertiesWithTypes(g);w=t.index.getSearchableProperties(g),w=w.filter(k=>D[k].startsWith("string")),t.caches.propertiesToSearch=w}let S=[],C=aF(t.tokenizer,t.index,t.documentsStore,r,e,w,S,t.documentsStore.count(y),n),E=[];m&&(E=t.index.searchByWhereClause(C,g,e.where),_=t4(E,_));let P=[];h&&(P=e4(t,_,e.facets));let T=Array.from({length:u});for(let D=0;D<u;D++){let k=_[D+l];if(!k)break;let F=t.data.docs.docs[k[0]];if(F){c||(F[s.property]=null);let K={id:Py(t.internalDocumentIDStore,k[0]),score:k[1],document:F};T[D]=K}}let I=[];e.groupBy&&(I=r4(t,_,e.groupBy));let M=p_()-n;return{count:_.length,hits:T.filter(Boolean),elapsed:{raw:Number(M),formatted:rF(M)},...P?{facets:P}:{},...I?{groups:I}:{}}}async function a(){t.beforeSearch&&await Y2(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await Z2(t.afterSearch,t,e,r,s),s}return o?a():i()}var HBe=b(()=>{sF();lu();Rce();Wc();Pce();Nce();jce();Ty();tR()});function u4t(t,e,r){let n=p_(),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=hmn(t,e,r),f=gmn(t,e),{index:p,docs:h}=t.data,m=e.hybridWeights,g=bmn(d,f,e.term??"",m),y=t.tokenizer.tokenize(e.term??"",r),_=t.caches.propertiesToSearch;if(!_){let M=t.index.getSearchablePropertiesWithTypes(p);_=t.index.getSearchableProperties(p),_=_.filter(D=>M[D].startsWith("string")),t.caches.propertiesToSearch=_}if(e.properties&&e.properties!=="*"){for(let M of e.properties)if(!_.includes(M))throw Yt("UNKNOWN_INDEX",M,_.join(", "));_=_.filter(M=>e.properties.includes(M))}let w=aF(t.tokenizer,t.index,t.documentsStore,r,e,_,y,t.documentsStore.count(h),n),S=Object.keys(e.where??{}).length>0,C=[];S&&(C=t.index.searchByWhereClause(w,p,e.where),g=t4(C,g));let E;c&&(E=e4(t,g,e.facets));let P;e.groupBy&&(P=r4(t,g,e.groupBy));let T=Lce(t,g,s,u).filter(Boolean),I=p_(),N={count:g.length,elapsed:{raw:Number(I-n),formatted:rF(I-n)},hits:T,...E?{facets:E}:{},...P?{groups:P}:{}};if(!l){let M=Object.keys(t.data.index.vectorIndexes);Sce(N,M)}return N}async function a(){t.beforeSearch&&await Y2(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await Z2(t.afterSearch,t,e,r,s),s}return o?a():i()}function hmn(t,e,r){let n=p_();e.relevance=Object.assign(Dce,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 h=t.index.getSearchablePropertiesWithTypes(s);c=t.index.getSearchableProperties(s),c=c.filter(m=>h[m].startsWith("string")),t.caches.propertiesToSearch=c}if(i&&i!=="*"){let h=new Set(c),m=new Set(i);for(let g of i)if(!h.has(g))throw Yt("UNKNOWN_INDEX",g,c.join(", "));c=c.filter(g=>m.has(g))}let d=aF(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 h=c.length;for(let m=0;m<h;m++){let g=c[m];if(f!==0)for(let C=0;C<f;C++){let E=l[C],P=t.index.search(d,s,g,E);ia(d.indexMap[g][E],P)}else{let C=[];d.indexMap[g][""]=C;let E=t.index.search(d,s,g,"");ia(C,E)}let y=d.indexMap[g],_=Object.values(y);d.docsIntersection[g]=Oce(_,e?.boost?.[g]??1,a,f);let w=d.docsIntersection[g],S=w.length;for(let C=0;C<S;C++){let[E,P]=w[C],T=d.uniqueDocsIDs[E];d.uniqueDocsIDs[E]=T?T+P+.5:P}}}else l.length===0&&o?d.uniqueDocsIDs={}:d.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(h=>[h,0]));let p=Object.entries(d.uniqueDocsIDs).map(([h,m])=>[+h,m]).sort((h,m)=>m[1]-h[1]);return l4t(p)}function gmn(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 Yt("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw Yt("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=Ece(r.value,i,o,e.similarity).map(([s,u])=>[$i(t.internalDocumentIDStore,s),u]);return l4t(a)}function VBe([,t]){return t}function l4t(t){let e=Math.max.apply(Math,t.map(VBe));return t.map(([r,n])=>[r,n/e])}function s4t(t,e){return t/e}function ymn(t,e){return(r,n)=>r*t+n*e}function bmn(t,e,r,n){let o=Math.max.apply(Math,t.map(VBe)),i=Math.max.apply(Math,e.map(VBe)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:_mn(r),l=new Map,c=t.length,d=ymn(s,u);for(let p=0;p<c;p++){let[h,m]=t[p],g=s4t(m,o),y=d(g,0);l.set(h,y)}let f=e.length;for(let p=0;p<f;p++){let[h,m]=e[p],g=s4t(m,i),y=l.get(h)??0;l.set(h,y+d(0,g))}return[...l].sort((p,h)=>h[1]-p[1])}function _mn(t){return{text:.5,vector:.5}}var c4t=b(()=>{lu();Nce();VK();Wc();sF();Rce();jce();Pce();Ty();sF();tR()});function aF(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 Vp(t,e,r){let n=e.mode??Mce;if(n===Mce)return o4t(t,e,r);if(n===DBe)return qBe(t,e);if(n===jBe)return u4t(t,e);throw Yt("INVALID_SEARCH_MODE",n)}function a4t(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,h]=f;if(u.has(p))continue;let m=t.documentsStore.get(i,p),g=G2(m,o);if(!(typeof g>"u"||a.has(g))&&(a.set(g,!0),c++,!(c<=r)&&(s.push({id:Py(t.internalDocumentIDStore,p),score:h,document:m}),u.add(p),c>=r+n)))break}return s}function Lce(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:Py(t.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}var Dce,sF=b(()=>{Ty();Wc();lu();LBe();i4t();HBe();c4t();Dce={k:1.2,b:.75,d:.5}});function Fce(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 WBe(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 d4t=b(()=>{});var f4t=b(()=>{tR();Wc();zBe();UBe();lu()});var p4t=b(()=>{Wc();sF()});var m4t=b(()=>{wBe();lu();VK();Ice()});var kce=b(()=>{Z2t();Y2t();zBe();UBe();sF();HBe();d4t();f4t();p4t();FBe();NBe();m4t()});function Smn(t,e){let r=h4t(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function h4t(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var Nui,jui,wmn,xmn,KBe,Cmn,uF,GBe=b(()=>{Nui=new Error("timeout while waiting for mutex to become available"),jui=new Error("mutex already locked"),wmn=new Error("request for lock canceled"),xmn=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())})},KBe=class{constructor(e,r=wmn){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=h4t(this._queue,s=>r<=s.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return xmn(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]=[]),Smn(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}};Cmn=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())})},uF=class{constructor(e){this._semaphore=new KBe(1,e)}acquire(){return Cmn(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 g4t=x(()=>{});var ro=x(($ce,y4t)=>{(function(t,e){typeof $ce=="object"?y4t.exports=$ce=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})($ce,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=g4t()}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 y(){}return function(_){var w;return y.prototype=_,w=new y,y.prototype=null,w}}(),a={},s=a.lib={},u=s.Base=function(){return{extend:function(y){var _=i(this);return y&&_.mixIn(y),(!_.hasOwnProperty("init")||this.init===_.init)&&(_.init=function(){_.$super.init.apply(this,arguments)}),_.init.prototype=_,_.$super=this,_},create:function(){var y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var _ in y)y.hasOwnProperty(_)&&(this[_]=y[_]);y.hasOwnProperty("toString")&&(this.toString=y.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=s.WordArray=u.extend({init:function(y,_){y=this.words=y||[],_!=r?this.sigBytes=_:this.sigBytes=y.length*4},toString:function(y){return(y||d).stringify(this)},concat:function(y){var _=this.words,w=y.words,S=this.sigBytes,C=y.sigBytes;if(this.clamp(),S%4)for(var E=0;E<C;E++){var P=w[E>>>2]>>>24-E%4*8&255;_[S+E>>>2]|=P<<24-(S+E)%4*8}else for(var T=0;T<C;T+=4)_[S+T>>>2]=w[T>>>2];return this.sigBytes+=C,this},clamp:function(){var y=this.words,_=this.sigBytes;y[_>>>2]&=4294967295<<32-_%4*8,y.length=e.ceil(_/4)},clone:function(){var y=u.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var _=[],w=0;w<y;w+=4)_.push(o());return new l.init(_,y)}}),c=a.enc={},d=c.Hex={stringify:function(y){for(var _=y.words,w=y.sigBytes,S=[],C=0;C<w;C++){var E=_[C>>>2]>>>24-C%4*8&255;S.push((E>>>4).toString(16)),S.push((E&15).toString(16))}return S.join("")},parse:function(y){for(var _=y.length,w=[],S=0;S<_;S+=2)w[S>>>3]|=parseInt(y.substr(S,2),16)<<24-S%8*4;return new l.init(w,_/2)}},f=c.Latin1={stringify:function(y){for(var _=y.words,w=y.sigBytes,S=[],C=0;C<w;C++){var E=_[C>>>2]>>>24-C%4*8&255;S.push(String.fromCharCode(E))}return S.join("")},parse:function(y){for(var _=y.length,w=[],S=0;S<_;S++)w[S>>>2]|=(y.charCodeAt(S)&255)<<24-S%4*8;return new l.init(w,_)}},p=c.Utf8={stringify:function(y){try{return decodeURIComponent(escape(f.stringify(y)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(y){return f.parse(unescape(encodeURIComponent(y)))}},h=s.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(y){typeof y=="string"&&(y=p.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes},_process:function(y){var _,w=this._data,S=w.words,C=w.sigBytes,E=this.blockSize,P=E*4,T=C/P;y?T=e.ceil(T):T=e.max((T|0)-this._minBufferSize,0);var I=T*E,N=e.min(I*4,C);if(I){for(var M=0;M<I;M+=E)this._doProcessBlock(S,M);_=S.splice(0,I),w.sigBytes-=N}return new l.init(_,N)},clone:function(){var y=u.clone.call(this);return y._data=this._data.clone(),y},_minBufferSize:0}),m=s.Hasher=h.extend({cfg:u.extend(),init:function(y){this.cfg=this.cfg.extend(y),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(y){return this._append(y),this._process(),this},finalize:function(y){y&&this._append(y);var _=this._doFinalize();return _},blockSize:512/32,_createHelper:function(y){return function(_,w){return new y.init(w).finalize(_)}},_createHmacHelper:function(y){return function(_,w){return new g.HMAC.init(y,w).finalize(_)}}}),g=a.algo={};return a}(Math);return t})});var JK=x((Bce,b4t)=>{(function(t,e){typeof Bce=="object"?b4t.exports=Bce=e(ro()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Bce,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 v4t=x((zce,_4t)=>{(function(t,e){typeof zce=="object"?_4t.exports=zce=e(ro()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(zce,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 x4t=x((Uce,w4t)=>{(function(t,e){typeof Uce=="object"?w4t.exports=Uce=e(ro()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Uce,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 oR=x((qce,S4t)=>{(function(t,e){typeof qce=="object"?S4t.exports=qce=e(ro()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(qce,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,h=u[f+1>>>2]>>>24-(f+1)%4*8&255,m=u[f+2>>>2]>>>24-(f+2)%4*8&255,g=p<<16|h<<8|m,y=0;y<4&&f+y*.75<l;y++)d.push(c.charAt(g>>>6*(3-y)&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,h=l[s.charCodeAt(f)]>>>6-f%4*2,m=p|h;c[d>>>2]|=m<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64})});var O4t=x((Hce,C4t)=>{(function(t,e){typeof Hce=="object"?C4t.exports=Hce=e(ro()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Hce,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 h=l[p>>>2]>>>24-p%4*8&255,m=l[p+1>>>2]>>>24-(p+1)%4*8&255,g=l[p+2>>>2]>>>24-(p+2)%4*8&255,y=h<<16|m<<8|g,_=0;_<4&&p+_*.75<c;_++)f.push(d.charAt(y>>>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 h=s.indexOf(p);h!==-1&&(l=h)}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,h=l[s.charCodeAt(f)]>>>6-f%4*2,m=p|h;c[d>>>2]|=m<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64url})});var iR=x((Vce,E4t)=>{(function(t,e){typeof Vce=="object"?E4t.exports=Vce=e(ro()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Vce,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,h){for(var m=0;m<16;m++){var g=h+m,y=p[g];p[g]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360}var _=this._hash.words,w=p[h+0],S=p[h+1],C=p[h+2],E=p[h+3],P=p[h+4],T=p[h+5],I=p[h+6],N=p[h+7],M=p[h+8],D=p[h+9],k=p[h+10],F=p[h+11],K=p[h+12],U=p[h+13],Y=p[h+14],ee=p[h+15],L=_[0],Q=_[1],z=_[2],W=_[3];L=l(L,Q,z,W,w,7,s[0]),W=l(W,L,Q,z,S,12,s[1]),z=l(z,W,L,Q,C,17,s[2]),Q=l(Q,z,W,L,E,22,s[3]),L=l(L,Q,z,W,P,7,s[4]),W=l(W,L,Q,z,T,12,s[5]),z=l(z,W,L,Q,I,17,s[6]),Q=l(Q,z,W,L,N,22,s[7]),L=l(L,Q,z,W,M,7,s[8]),W=l(W,L,Q,z,D,12,s[9]),z=l(z,W,L,Q,k,17,s[10]),Q=l(Q,z,W,L,F,22,s[11]),L=l(L,Q,z,W,K,7,s[12]),W=l(W,L,Q,z,U,12,s[13]),z=l(z,W,L,Q,Y,17,s[14]),Q=l(Q,z,W,L,ee,22,s[15]),L=c(L,Q,z,W,S,5,s[16]),W=c(W,L,Q,z,I,9,s[17]),z=c(z,W,L,Q,F,14,s[18]),Q=c(Q,z,W,L,w,20,s[19]),L=c(L,Q,z,W,T,5,s[20]),W=c(W,L,Q,z,k,9,s[21]),z=c(z,W,L,Q,ee,14,s[22]),Q=c(Q,z,W,L,P,20,s[23]),L=c(L,Q,z,W,D,5,s[24]),W=c(W,L,Q,z,Y,9,s[25]),z=c(z,W,L,Q,E,14,s[26]),Q=c(Q,z,W,L,M,20,s[27]),L=c(L,Q,z,W,U,5,s[28]),W=c(W,L,Q,z,C,9,s[29]),z=c(z,W,L,Q,N,14,s[30]),Q=c(Q,z,W,L,K,20,s[31]),L=d(L,Q,z,W,T,4,s[32]),W=d(W,L,Q,z,M,11,s[33]),z=d(z,W,L,Q,F,16,s[34]),Q=d(Q,z,W,L,Y,23,s[35]),L=d(L,Q,z,W,S,4,s[36]),W=d(W,L,Q,z,P,11,s[37]),z=d(z,W,L,Q,N,16,s[38]),Q=d(Q,z,W,L,k,23,s[39]),L=d(L,Q,z,W,U,4,s[40]),W=d(W,L,Q,z,w,11,s[41]),z=d(z,W,L,Q,E,16,s[42]),Q=d(Q,z,W,L,I,23,s[43]),L=d(L,Q,z,W,D,4,s[44]),W=d(W,L,Q,z,K,11,s[45]),z=d(z,W,L,Q,ee,16,s[46]),Q=d(Q,z,W,L,C,23,s[47]),L=f(L,Q,z,W,w,6,s[48]),W=f(W,L,Q,z,N,10,s[49]),z=f(z,W,L,Q,Y,15,s[50]),Q=f(Q,z,W,L,T,21,s[51]),L=f(L,Q,z,W,K,6,s[52]),W=f(W,L,Q,z,E,10,s[53]),z=f(z,W,L,Q,k,15,s[54]),Q=f(Q,z,W,L,S,21,s[55]),L=f(L,Q,z,W,M,6,s[56]),W=f(W,L,Q,z,ee,10,s[57]),z=f(z,W,L,Q,I,15,s[58]),Q=f(Q,z,W,L,U,21,s[59]),L=f(L,Q,z,W,P,6,s[60]),W=f(W,L,Q,z,F,10,s[61]),z=f(z,W,L,Q,C,15,s[62]),Q=f(Q,z,W,L,D,21,s[63]),_[0]=_[0]+L|0,_[1]=_[1]+Q|0,_[2]=_[2]+z|0,_[3]=_[3]+W|0},_doFinalize:function(){var p=this._data,h=p.words,m=this._nDataBytes*8,g=p.sigBytes*8;h[g>>>5]|=128<<24-g%32;var y=e.floor(m/4294967296),_=m;h[(g+64>>>9<<4)+15]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,h[(g+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,p.sigBytes=(h.length+1)*4,this._process();for(var w=this._hash,S=w.words,C=0;C<4;C++){var E=S[C];S[C]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}return w},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});function l(p,h,m,g,y,_,w){var S=p+(h&m|~h&g)+y+w;return(S<<_|S>>>32-_)+h}function c(p,h,m,g,y,_,w){var S=p+(h&g|m&~g)+y+w;return(S<<_|S>>>32-_)+h}function d(p,h,m,g,y,_,w){var S=p+(h^m^g)+y+w;return(S<<_|S>>>32-_)+h}function f(p,h,m,g,y,_,w){var S=p+(m^(h|~g))+y+w;return(S<<_|S>>>32-_)+h}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),t.MD5})});var JBe=x((Wce,P4t)=>{(function(t,e){typeof Wce=="object"?P4t.exports=Wce=e(ro()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Wce,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],h=c[3],m=c[4],g=0;g<80;g++){if(g<16)a[g]=u[l+g]|0;else{var y=a[g-3]^a[g-8]^a[g-14]^a[g-16];a[g]=y<<1|y>>>31}var _=(d<<5|d>>>27)+m+a[g];g<20?_+=(f&p|~f&h)+1518500249:g<40?_+=(f^p^h)+1859775393:g<60?_+=(f&p|f&h|p&h)-1894007588:_+=(f^p^h)-899497514,m=h,h=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]+h|0,c[4]=c[4]+m|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 Gce=x((Kce,T4t)=>{(function(t,e){typeof Kce=="object"?T4t.exports=Kce=e(ro()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Kce,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(m){for(var g=e.sqrt(m),y=2;y<=g;y++)if(!(m%y))return!1;return!0}function f(m){return(m-(m|0))*4294967296|0}for(var p=2,h=0;h<64;)d(p)&&(h<8&&(s[h]=f(e.pow(p,1/2))),u[h]=f(e.pow(p,1/3)),h++),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,h=p[0],m=p[1],g=p[2],y=p[3],_=p[4],w=p[5],S=p[6],C=p[7],E=0;E<64;E++){if(E<16)l[E]=d[f+E]|0;else{var P=l[E-15],T=(P<<25|P>>>7)^(P<<14|P>>>18)^P>>>3,I=l[E-2],N=(I<<15|I>>>17)^(I<<13|I>>>19)^I>>>10;l[E]=T+l[E-7]+N+l[E-16]}var M=_&w^~_&S,D=h&m^h&g^m&g,k=(h<<30|h>>>2)^(h<<19|h>>>13)^(h<<10|h>>>22),F=(_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25),K=C+F+M+u[E]+l[E],U=k+D;C=S,S=w,w=_,_=y+K|0,y=g,g=m,m=h,h=K+U|0}p[0]=p[0]+h|0,p[1]=p[1]+m|0,p[2]=p[2]+g|0,p[3]=p[3]+y|0,p[4]=p[4]+_|0,p[5]=p[5]+w|0,p[6]=p[6]+S|0,p[7]=p[7]+C|0},_doFinalize:function(){var d=this._data,f=d.words,p=this._nDataBytes*8,h=d.sigBytes*8;return f[h>>>5]|=128<<24-h%32,f[(h+64>>>9<<4)+14]=e.floor(p/4294967296),f[(h+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 I4t=x((Jce,A4t)=>{(function(t,e,r){typeof Jce=="object"?A4t.exports=Jce=e(ro(),Gce()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(Jce,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 ZBe=x((Zce,M4t)=>{(function(t,e,r){typeof Zce=="object"?M4t.exports=Zce=e(ro(),JK()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(Zce,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 h=this._hash.words,m=h[0],g=h[1],y=h[2],_=h[3],w=h[4],S=h[5],C=h[6],E=h[7],P=m.high,T=m.low,I=g.high,N=g.low,M=y.high,D=y.low,k=_.high,F=_.low,K=w.high,U=w.low,Y=S.high,ee=S.low,L=C.high,Q=C.low,z=E.high,W=E.low,V=P,q=T,H=I,G=N,Z=M,de=D,pe=k,ae=F,Te=K,Ae=U,ke=Y,St=ee,Nr=L,Ir=Q,Hn=z,Yr=W,Sr=0;Sr<80;Sr++){var Me,Ge,je=c[Sr];if(Sr<16)Ge=je.high=f[p+Sr*2]|0,Me=je.low=f[p+Sr*2+1]|0;else{var le=c[Sr-15],ne=le.high,fe=le.low,be=(ne>>>1|fe<<31)^(ne>>>8|fe<<24)^ne>>>7,ye=(fe>>>1|ne<<31)^(fe>>>8|ne<<24)^(fe>>>7|ne<<25),ze=c[Sr-2],mr=ze.high,Ti=ze.low,yi=(mr>>>19|Ti<<13)^(mr<<3|Ti>>>29)^mr>>>6,yf=(Ti>>>19|mr<<13)^(Ti<<3|mr>>>29)^(Ti>>>6|mr<<26),fp=c[Sr-7],qi=fp.high,md=fp.low,hd=c[Sr-16],bf=hd.high,Vn=hd.low;Me=ye+md,Ge=be+qi+(Me>>>0<ye>>>0?1:0),Me=Me+yf,Ge=Ge+yi+(Me>>>0<yf>>>0?1:0),Me=Me+Vn,Ge=Ge+bf+(Me>>>0<Vn>>>0?1:0),je.high=Ge,je.low=Me}var wA=Te&ke^~Te&Nr,RN=Ae&St^~Ae&Ir,xA=V&H^V&Z^H&Z,Ts=q&G^q&de^G&de,pu=(V>>>28|q<<4)^(V<<30|q>>>2)^(V<<25|q>>>7),rs=(q>>>28|V<<4)^(q<<30|V>>>2)^(q<<25|V>>>7),pp=(Te>>>14|Ae<<18)^(Te>>>18|Ae<<14)^(Te<<23|Ae>>>9),_f=(Ae>>>14|Te<<18)^(Ae>>>18|Te<<14)^(Ae<<23|Te>>>9),Ws=l[Sr],um=Ws.high,mp=Ws.low,Zn=Yr+_f,Qe=Hn+pp+(Zn>>>0<Yr>>>0?1:0),Zn=Zn+RN,Qe=Qe+wA+(Zn>>>0<RN>>>0?1:0),Zn=Zn+mp,Qe=Qe+um+(Zn>>>0<mp>>>0?1:0),Zn=Zn+Me,Qe=Qe+Ge+(Zn>>>0<Me>>>0?1:0),hp=rs+Ts,xh=pu+xA+(hp>>>0<rs>>>0?1:0);Hn=Nr,Yr=Ir,Nr=ke,Ir=St,ke=Te,St=Ae,Ae=ae+Zn|0,Te=pe+Qe+(Ae>>>0<ae>>>0?1:0)|0,pe=Z,ae=de,Z=H,de=G,H=V,G=q,q=Zn+hp|0,V=Qe+xh+(q>>>0<Zn>>>0?1:0)|0}T=m.low=T+q,m.high=P+V+(T>>>0<q>>>0?1:0),N=g.low=N+G,g.high=I+H+(N>>>0<G>>>0?1:0),D=y.low=D+de,y.high=M+Z+(D>>>0<de>>>0?1:0),F=_.low=F+ae,_.high=k+pe+(F>>>0<ae>>>0?1:0),U=w.low=U+Ae,w.high=K+Te+(U>>>0<Ae>>>0?1:0),ee=S.low=ee+St,S.high=Y+ke+(ee>>>0<St>>>0?1:0),Q=C.low=Q+Ir,C.high=L+Nr+(Q>>>0<Ir>>>0?1:0),W=E.low=W+Yr,E.high=z+Hn+(W>>>0<Yr>>>0?1:0)},_doFinalize:function(){var f=this._data,p=f.words,h=this._nDataBytes*8,m=f.sigBytes*8;p[m>>>5]|=128<<24-m%32,p[(m+128>>>10<<5)+30]=Math.floor(h/4294967296),p[(m+128>>>10<<5)+31]=h,f.sigBytes=p.length*4,this._process();var g=this._hash.toX32();return g},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 N4t=x((Yce,R4t)=>{(function(t,e,r){typeof Yce=="object"?R4t.exports=Yce=e(ro(),JK(),ZBe()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(Yce,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 D4t=x((Xce,j4t)=>{(function(t,e,r){typeof Xce=="object"?j4t.exports=Xce=e(ro(),JK()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(Xce,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 h=1,m=0,g=0;g<24;g++){l[h+5*m]=(g+1)*(g+2)/2%64;var y=m%5,_=(2*h+3*m)%5;h=y,m=_}for(var h=0;h<5;h++)for(var m=0;m<5;m++)c[h+5*m]=m+(2*h+3*m)%5*5;for(var w=1,S=0;S<24;S++){for(var C=0,E=0,P=0;P<7;P++){if(w&1){var T=(1<<P)-1;T<32?E^=1<<T:C^=1<<T-32}w&128?w=w<<1^113:w<<=1}d[S]=s.create(C,E)}})();var f=[];(function(){for(var h=0;h<25;h++)f[h]=s.create()})();var p=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var h=this._state=[],m=0;m<25;m++)h[m]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(h,m){for(var g=this._state,y=this.blockSize/2,_=0;_<y;_++){var w=h[m+2*_],S=h[m+2*_+1];w=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,S=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360;var C=g[_];C.high^=S,C.low^=w}for(var E=0;E<24;E++){for(var P=0;P<5;P++){for(var T=0,I=0,N=0;N<5;N++){var C=g[P+5*N];T^=C.high,I^=C.low}var M=f[P];M.high=T,M.low=I}for(var P=0;P<5;P++)for(var D=f[(P+4)%5],k=f[(P+1)%5],F=k.high,K=k.low,T=D.high^(F<<1|K>>>31),I=D.low^(K<<1|F>>>31),N=0;N<5;N++){var C=g[P+5*N];C.high^=T,C.low^=I}for(var U=1;U<25;U++){var T,I,C=g[U],Y=C.high,ee=C.low,L=l[U];L<32?(T=Y<<L|ee>>>32-L,I=ee<<L|Y>>>32-L):(T=ee<<L-32|Y>>>64-L,I=Y<<L-32|ee>>>64-L);var Q=f[c[U]];Q.high=T,Q.low=I}var z=f[0],W=g[0];z.high=W.high,z.low=W.low;for(var P=0;P<5;P++)for(var N=0;N<5;N++){var U=P+5*N,C=g[U],V=f[U],q=f[(P+1)%5+5*N],H=f[(P+2)%5+5*N];C.high=V.high^~q.high&H.high,C.low=V.low^~q.low&H.low}var C=g[0],G=d[E];C.high^=G.high,C.low^=G.low}},_doFinalize:function(){var h=this._data,m=h.words,g=this._nDataBytes*8,y=h.sigBytes*8,_=this.blockSize*32;m[y>>>5]|=1<<24-y%32,m[(e.ceil((y+1)/_)*_>>>5)-1]|=128,h.sigBytes=m.length*4,this._process();for(var w=this._state,S=this.cfg.outputLength/8,C=S/8,E=[],P=0;P<C;P++){var T=w[P],I=T.high,N=T.low;I=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,N=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,E.push(N),E.push(I)}return new o.init(E,S)},clone:function(){for(var h=i.clone.call(this),m=h._state=this._state.slice(0),g=0;g<25;g++)m[g]=m[g].clone();return h}});r.SHA3=i._createHelper(p),r.HmacSHA3=i._createHmacHelper(p)}(Math),t.SHA3})});var F4t=x((Qce,L4t)=>{(function(t,e){typeof Qce=="object"?L4t.exports=Qce=e(ro()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Qce,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(S,C){for(var E=0;E<16;E++){var P=C+E,T=S[P];S[P]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}var I=this._hash.words,N=d.words,M=f.words,D=s.words,k=u.words,F=l.words,K=c.words,U,Y,ee,L,Q,z,W,V,q,H;z=U=I[0],W=Y=I[1],V=ee=I[2],q=L=I[3],H=Q=I[4];for(var G,E=0;E<80;E+=1)G=U+S[C+D[E]]|0,E<16?G+=h(Y,ee,L)+N[0]:E<32?G+=m(Y,ee,L)+N[1]:E<48?G+=g(Y,ee,L)+N[2]:E<64?G+=y(Y,ee,L)+N[3]:G+=_(Y,ee,L)+N[4],G=G|0,G=w(G,F[E]),G=G+Q|0,U=Q,Q=L,L=w(ee,10),ee=Y,Y=G,G=z+S[C+k[E]]|0,E<16?G+=_(W,V,q)+M[0]:E<32?G+=y(W,V,q)+M[1]:E<48?G+=g(W,V,q)+M[2]:E<64?G+=m(W,V,q)+M[3]:G+=h(W,V,q)+M[4],G=G|0,G=w(G,K[E]),G=G+H|0,z=H,H=q,q=w(V,10),V=W,W=G;G=I[1]+ee+q|0,I[1]=I[2]+L+H|0,I[2]=I[3]+Q+z|0,I[3]=I[4]+U+W|0,I[4]=I[0]+Y+V|0,I[0]=G},_doFinalize:function(){var S=this._data,C=S.words,E=this._nDataBytes*8,P=S.sigBytes*8;C[P>>>5]|=128<<24-P%32,C[(P+64>>>9<<4)+14]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,S.sigBytes=(C.length+1)*4,this._process();for(var T=this._hash,I=T.words,N=0;N<5;N++){var M=I[N];I[N]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}return T},clone:function(){var S=i.clone.call(this);return S._hash=this._hash.clone(),S}});function h(S,C,E){return S^C^E}function m(S,C,E){return S&C|~S&E}function g(S,C,E){return(S|~C)^E}function y(S,C,E){return S&E|C&~E}function _(S,C,E){return S^(C|~E)}function w(S,C){return S<<C|S>>>32-C}r.RIPEMD160=i._createHelper(p),r.HmacRIPEMD160=i._createHmacHelper(p)}(Math),t.RIPEMD160})});var tde=x((ede,k4t)=>{(function(t,e){typeof ede=="object"?k4t.exports=ede=e(ro()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(ede,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(),h=f.words,m=p.words,g=0;g<c;g++)h[g]^=1549556828,m[g]^=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 B4t=x((rde,$4t)=>{(function(t,e,r){typeof rde=="object"?$4t.exports=rde=e(ro(),Gce(),tde()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(rde,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(),h=o.create([1]),m=p.words,g=h.words,y=d.keySize,_=d.iterations;m.length<y;){var w=f.update(c).finalize(h);f.reset();for(var S=w.words,C=S.length,E=w,P=1;P<_;P++){E=f.finalize(E),f.reset();for(var T=E.words,I=0;I<C;I++)S[I]^=T[I]}p.concat(w),g[0]++}return p.sigBytes=y*4,p}});e.PBKDF2=function(l,c,d){return u.create(d).compute(l,c)}}(),t.PBKDF2})});var LP=x((nde,z4t)=>{(function(t,e,r){typeof nde=="object"?z4t.exports=nde=e(ro(),JBe(),tde()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(nde,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(),h=p.words,m=d.keySize,g=d.iterations;h.length<m;){c&&f.update(c),c=f.update(u).finalize(l),f.reset();for(var y=1;y<g;y++)c=f.finalize(c),f.reset();p.concat(c)}return p.sigBytes=m*4,p}});e.EvpKDF=function(u,l,c){return s.create(c).compute(u,l)}}(),t.EvpKDF})});var yc=x((ode,U4t)=>{(function(t,e,r){typeof ode=="object"?U4t.exports=ode=e(ro(),LP()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(ode,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(M,D){return this.create(this._ENC_XFORM_MODE,M,D)},createDecryptor:function(M,D){return this.create(this._DEC_XFORM_MODE,M,D)},init:function(M,D,k){this.cfg=this.cfg.extend(k),this._xformMode=M,this._key=D,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(M){return this._append(M),this._process()},finalize:function(M){M&&this._append(M);var D=this._doFinalize();return D},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function M(D){return typeof D=="string"?N:P}return function(D){return{encrypt:function(k,F,K){return M(F).encrypt(D,k,F,K)},decrypt:function(k,F,K){return M(F).decrypt(D,k,F,K)}}}}()}),p=n.StreamCipher=f.extend({_doFinalize:function(){var M=this._process(!0);return M},blockSize:1}),h=r.mode={},m=n.BlockCipherMode=o.extend({createEncryptor:function(M,D){return this.Encryptor.create(M,D)},createDecryptor:function(M,D){return this.Decryptor.create(M,D)},init:function(M,D){this._cipher=M,this._iv=D}}),g=h.CBC=function(){var M=m.extend();M.Encryptor=M.extend({processBlock:function(k,F){var K=this._cipher,U=K.blockSize;D.call(this,k,F,U),K.encryptBlock(k,F),this._prevBlock=k.slice(F,F+U)}}),M.Decryptor=M.extend({processBlock:function(k,F){var K=this._cipher,U=K.blockSize,Y=k.slice(F,F+U);K.decryptBlock(k,F),D.call(this,k,F,U),this._prevBlock=Y}});function D(k,F,K){var U,Y=this._iv;Y?(U=Y,this._iv=e):U=this._prevBlock;for(var ee=0;ee<K;ee++)k[F+ee]^=U[ee]}return M}(),y=r.pad={},_=y.Pkcs7={pad:function(M,D){for(var k=D*4,F=k-M.sigBytes%k,K=F<<24|F<<16|F<<8|F,U=[],Y=0;Y<F;Y+=4)U.push(K);var ee=i.create(U,F);M.concat(ee)},unpad:function(M){var D=M.words[M.sigBytes-1>>>2]&255;M.sigBytes-=D}},w=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:g,padding:_}),reset:function(){var M;f.reset.call(this);var D=this.cfg,k=D.iv,F=D.mode;this._xformMode==this._ENC_XFORM_MODE?M=F.createEncryptor:(M=F.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==M?this._mode.init(this,k&&k.words):(this._mode=M.call(F,this,k&&k.words),this._mode.__creator=M)},_doProcessBlock:function(M,D){this._mode.processBlock(M,D)},_doFinalize:function(){var M,D=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(D.pad(this._data,this.blockSize),M=this._process(!0)):(M=this._process(!0),D.unpad(M)),M},blockSize:128/32}),S=n.CipherParams=o.extend({init:function(M){this.mixIn(M)},toString:function(M){return(M||this.formatter).stringify(this)}}),C=r.format={},E=C.OpenSSL={stringify:function(M){var D,k=M.ciphertext,F=M.salt;return F?D=i.create([1398893684,1701076831]).concat(F).concat(k):D=k,D.toString(l)},parse:function(M){var D,k=l.parse(M),F=k.words;return F[0]==1398893684&&F[1]==1701076831&&(D=i.create(F.slice(2,4)),F.splice(0,4),k.sigBytes-=16),S.create({ciphertext:k,salt:D})}},P=n.SerializableCipher=o.extend({cfg:o.extend({format:E}),encrypt:function(M,D,k,F){F=this.cfg.extend(F);var K=M.createEncryptor(k,F),U=K.finalize(D),Y=K.cfg;return S.create({ciphertext:U,key:k,iv:Y.iv,algorithm:M,mode:Y.mode,padding:Y.padding,blockSize:M.blockSize,formatter:F.format})},decrypt:function(M,D,k,F){F=this.cfg.extend(F),D=this._parse(D,F.format);var K=M.createDecryptor(k,F).finalize(D.ciphertext);return K},_parse:function(M,D){return typeof M=="string"?D.parse(M,this):M}}),T=r.kdf={},I=T.OpenSSL={execute:function(M,D,k,F,K){if(F||(F=i.random(64/8)),K)var U=d.create({keySize:D+k,hasher:K}).compute(M,F);else var U=d.create({keySize:D+k}).compute(M,F);var Y=i.create(U.words.slice(D),k*4);return U.sigBytes=D*4,S.create({key:U,iv:Y,salt:F})}},N=n.PasswordBasedCipher=P.extend({cfg:P.cfg.extend({kdf:I}),encrypt:function(M,D,k,F){F=this.cfg.extend(F);var K=F.kdf.execute(k,M.keySize,M.ivSize,F.salt,F.hasher);F.iv=K.iv;var U=P.encrypt.call(this,M,D,K.key,F);return U.mixIn(K),U},decrypt:function(M,D,k,F){F=this.cfg.extend(F),D=this._parse(D,F.format);var K=F.kdf.execute(k,M.keySize,M.ivSize,D.salt,F.hasher);F.iv=K.iv;var U=P.decrypt.call(this,M,D,K.key,F);return U}})}()})});var H4t=x((ide,q4t)=>{(function(t,e,r){typeof ide=="object"?q4t.exports=ide=e(ro(),yc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(ide,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 W4t=x((ade,V4t)=>{(function(t,e,r){typeof ade=="object"?V4t.exports=ade=e(ro(),yc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(ade,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 G4t=x((sde,K4t)=>{(function(t,e,r){typeof sde=="object"?K4t.exports=sde=e(ro(),yc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(sde,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 Z4t=x((ude,J4t)=>{(function(t,e,r){typeof ude=="object"?J4t.exports=ude=e(ro(),yc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(ude,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 X4t=x((lde,Y4t)=>{(function(t,e,r){typeof lde=="object"?Y4t.exports=lde=e(ro(),yc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(lde,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 e3t=x((cde,Q4t)=>{(function(t,e,r){typeof cde=="object"?Q4t.exports=cde=e(ro(),yc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(cde,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 r3t=x((dde,t3t)=>{(function(t,e,r){typeof dde=="object"?t3t.exports=dde=e(ro(),yc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(dde,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 o3t=x((fde,n3t)=>{(function(t,e,r){typeof fde=="object"?n3t.exports=fde=e(ro(),yc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(fde,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 a3t=x((pde,i3t)=>{(function(t,e,r){typeof pde=="object"?i3t.exports=pde=e(ro(),yc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(pde,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 u3t=x((mde,s3t)=>{(function(t,e,r){typeof mde=="object"?s3t.exports=mde=e(ro(),yc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(mde,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var c3t=x((hde,l3t)=>{(function(t,e,r){typeof hde=="object"?l3t.exports=hde=e(ro(),yc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(hde,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 f3t=x((gde,d3t)=>{(function(t,e,r){typeof gde=="object"?d3t.exports=gde=e(ro(),oR(),iR(),LP(),yc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(gde,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=[],h=[];(function(){for(var y=[],_=0;_<256;_++)_<128?y[_]=_<<1:y[_]=_<<1^283;for(var w=0,S=0,_=0;_<256;_++){var C=S^S<<1^S<<2^S<<3^S<<4;C=C>>>8^C&255^99,i[w]=C,a[C]=w;var E=y[w],P=y[E],T=y[P],I=y[C]*257^C*16843008;s[w]=I<<24|I>>>8,u[w]=I<<16|I>>>16,l[w]=I<<8|I>>>24,c[w]=I;var I=T*16843009^P*65537^E*257^w*16843008;d[C]=I<<24|I>>>8,f[C]=I<<16|I>>>16,p[C]=I<<8|I>>>24,h[C]=I,w?(w=E^y[y[y[T^E]]],S^=y[y[S]]):w=S=1}})();var m=[0,1,2,4,8,16,32,64,128,27,54],g=o.AES=n.extend({_doReset:function(){var y;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var _=this._keyPriorReset=this._key,w=_.words,S=_.sigBytes/4,C=this._nRounds=S+6,E=(C+1)*4,P=this._keySchedule=[],T=0;T<E;T++)T<S?P[T]=w[T]:(y=P[T-1],T%S?S>6&&T%S==4&&(y=i[y>>>24]<<24|i[y>>>16&255]<<16|i[y>>>8&255]<<8|i[y&255]):(y=y<<8|y>>>24,y=i[y>>>24]<<24|i[y>>>16&255]<<16|i[y>>>8&255]<<8|i[y&255],y^=m[T/S|0]<<24),P[T]=P[T-S]^y);for(var I=this._invKeySchedule=[],N=0;N<E;N++){var T=E-N;if(N%4)var y=P[T];else var y=P[T-4];N<4||T<=4?I[N]=y:I[N]=d[i[y>>>24]]^f[i[y>>>16&255]]^p[i[y>>>8&255]]^h[i[y&255]]}}},encryptBlock:function(y,_){this._doCryptBlock(y,_,this._keySchedule,s,u,l,c,i)},decryptBlock:function(y,_){var w=y[_+1];y[_+1]=y[_+3],y[_+3]=w,this._doCryptBlock(y,_,this._invKeySchedule,d,f,p,h,a);var w=y[_+1];y[_+1]=y[_+3],y[_+3]=w},_doCryptBlock:function(y,_,w,S,C,E,P,T){for(var I=this._nRounds,N=y[_]^w[0],M=y[_+1]^w[1],D=y[_+2]^w[2],k=y[_+3]^w[3],F=4,K=1;K<I;K++){var U=S[N>>>24]^C[M>>>16&255]^E[D>>>8&255]^P[k&255]^w[F++],Y=S[M>>>24]^C[D>>>16&255]^E[k>>>8&255]^P[N&255]^w[F++],ee=S[D>>>24]^C[k>>>16&255]^E[N>>>8&255]^P[M&255]^w[F++],L=S[k>>>24]^C[N>>>16&255]^E[M>>>8&255]^P[D&255]^w[F++];N=U,M=Y,D=ee,k=L}var U=(T[N>>>24]<<24|T[M>>>16&255]<<16|T[D>>>8&255]<<8|T[k&255])^w[F++],Y=(T[M>>>24]<<24|T[D>>>16&255]<<16|T[k>>>8&255]<<8|T[N&255])^w[F++],ee=(T[D>>>24]<<24|T[k>>>16&255]<<16|T[N>>>8&255]<<8|T[M&255])^w[F++],L=(T[k>>>24]<<24|T[N>>>16&255]<<16|T[M>>>8&255]<<8|T[D&255])^w[F++];y[_]=U,y[_+1]=Y,y[_+2]=ee,y[_+3]=L},keySize:256/32});e.AES=n._createHelper(g)}(),t.AES})});var m3t=x((yde,p3t)=>{(function(t,e,r){typeof yde=="object"?p3t.exports=yde=e(ro(),oR(),iR(),LP(),yc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(yde,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 m=this._key,g=m.words,y=[],_=0;_<56;_++){var w=a[_]-1;y[_]=g[w>>>5]>>>31-w%32&1}for(var S=this._subKeys=[],C=0;C<16;C++){for(var E=S[C]=[],P=u[C],_=0;_<24;_++)E[_/6|0]|=y[(s[_]-1+P)%28]<<31-_%6,E[4+(_/6|0)]|=y[28+(s[_+24]-1+P)%28]<<31-_%6;E[0]=E[0]<<1|E[0]>>>31;for(var _=1;_<7;_++)E[_]=E[_]>>>(_-1)*4+3;E[7]=E[7]<<5|E[7]>>>27}for(var T=this._invSubKeys=[],_=0;_<16;_++)T[_]=S[15-_]},encryptBlock:function(m,g){this._doCryptBlock(m,g,this._subKeys)},decryptBlock:function(m,g){this._doCryptBlock(m,g,this._invSubKeys)},_doCryptBlock:function(m,g,y){this._lBlock=m[g],this._rBlock=m[g+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=y[_],S=this._lBlock,C=this._rBlock,E=0,P=0;P<8;P++)E|=l[P][((C^w[P])&c[P])>>>0];this._lBlock=C,this._rBlock=S^E}var T=this._lBlock;this._lBlock=this._rBlock,this._rBlock=T,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),m[g]=this._lBlock,m[g+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(m,g){var y=(this._lBlock>>>m^this._rBlock)&g;this._rBlock^=y,this._lBlock^=y<<m}function p(m,g){var y=(this._rBlock>>>m^this._lBlock)&g;this._lBlock^=y,this._rBlock^=y<<m}e.DES=o._createHelper(d);var h=i.TripleDES=o.extend({_doReset:function(){var m=this._key,g=m.words;if(g.length!==2&&g.length!==4&&g.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var y=g.slice(0,2),_=g.length<4?g.slice(0,2):g.slice(2,4),w=g.length<6?g.slice(0,2):g.slice(4,6);this._des1=d.createEncryptor(n.create(y)),this._des2=d.createEncryptor(n.create(_)),this._des3=d.createEncryptor(n.create(w))},encryptBlock:function(m,g){this._des1.encryptBlock(m,g),this._des2.decryptBlock(m,g),this._des3.encryptBlock(m,g)},decryptBlock:function(m,g){this._des3.decryptBlock(m,g),this._des2.encryptBlock(m,g),this._des1.decryptBlock(m,g)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=o._createHelper(h)}(),t.TripleDES})});var g3t=x((bde,h3t)=>{(function(t,e,r){typeof bde=="object"?h3t.exports=bde=e(ro(),oR(),iR(),LP(),yc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(bde,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 h=f%c,m=l[h>>>2]>>>24-h%4*8&255;p=(p+d[f]+m)%256;var g=d[f];d[f]=d[p],d[p]=g}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 b3t=x((_de,y3t)=>{(function(t,e,r){typeof _de=="object"?y3t.exports=_de=e(ro(),oR(),iR(),LP(),yc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(_de,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],h=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++)h[f]^=p[f+4&7];if(d){var m=d.words,g=m[0],y=m[1],_=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,w=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,S=_>>>16|w&4294901760,C=w<<16|_&65535;h[0]^=_,h[1]^=S,h[2]^=w,h[3]^=C,h[4]^=_,h[5]^=S,h[6]^=w,h[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],h=p&65535,m=p>>>16,g=((h*h>>>17)+h*m>>>15)+m*m,y=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=g^y}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 v3t=x((vde,_3t)=>{(function(t,e,r){typeof vde=="object"?_3t.exports=vde=e(ro(),oR(),iR(),LP(),yc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(vde,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 h=0;h<4;h++)l.call(this);for(var h=0;h<8;h++)p[h]^=f[h+4&7];if(d){var m=d.words,g=m[0],y=m[1],_=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,w=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,S=_>>>16|w&4294901760,C=w<<16|_&65535;p[0]^=_,p[1]^=S,p[2]^=w,p[3]^=C,p[4]^=_,p[5]^=S,p[6]^=w,p[7]^=C;for(var h=0;h<4;h++)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],h=p&65535,m=p>>>16,g=((h*h>>>17)+h*m>>>15)+m*m,y=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=g^y}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 x3t=x((wde,w3t)=>{(function(t,e,r){typeof wde=="object"?w3t.exports=wde=e(ro(),oR(),iR(),LP(),yc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(wde,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(h,m){let g=m>>24&255,y=m>>16&255,_=m>>8&255,w=m&255,S=h.sbox[0][g]+h.sbox[1][y];return S=S^h.sbox[2][_],S=S+h.sbox[3][w],S}function c(h,m,g){let y=m,_=g,w;for(let S=0;S<i;++S)y=y^h.pbox[S],_=l(h,y)^_,w=y,y=_,_=w;return w=y,y=_,_=w,_=_^h.pbox[i],y=y^h.pbox[i+1],{left:y,right:_}}function d(h,m,g){let y=m,_=g,w;for(let S=i+1;S>1;--S)y=y^h.pbox[S],_=l(h,y)^_,w=y,y=_,_=w;return w=y,y=_,_=w,_=_^h.pbox[1],y=y^h.pbox[0],{left:y,right:_}}function f(h,m,g){for(let C=0;C<4;C++){h.sbox[C]=[];for(let E=0;E<256;E++)h.sbox[C][E]=s[C][E]}let y=0;for(let C=0;C<i+2;C++)h.pbox[C]=a[C]^m[y],y++,y>=g&&(y=0);let _=0,w=0,S=0;for(let C=0;C<i+2;C+=2)S=c(h,_,w),_=S.left,w=S.right,h.pbox[C]=_,h.pbox[C+1]=w;for(let C=0;C<4;C++)for(let E=0;E<256;E+=2)S=c(h,_,w),_=S.left,w=S.right,h.sbox[C][E]=_,h.sbox[C][E+1]=w;return!0}var p=o.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var h=this._keyPriorReset=this._key,m=h.words,g=h.sigBytes/4;f(u,m,g)}},encryptBlock:function(h,m){var g=c(u,h[m],h[m+1]);h[m]=g.left,h[m+1]=g.right},decryptBlock:function(h,m){var g=d(u,h[m],h[m+1]);h[m]=g.left,h[m+1]=g.right},blockSize:64/32,keySize:128/32,ivSize:64/32});e.Blowfish=n._createHelper(p)}(),t.Blowfish})});var n4=x((xde,S3t)=>{(function(t,e,r){typeof xde=="object"?S3t.exports=xde=e(ro(),JK(),v4t(),x4t(),oR(),O4t(),iR(),JBe(),Gce(),I4t(),ZBe(),N4t(),D4t(),F4t(),tde(),B4t(),LP(),yc(),H4t(),W4t(),G4t(),Z4t(),X4t(),e3t(),r3t(),o3t(),a3t(),u3t(),c3t(),f3t(),m3t(),g3t(),b3t(),v3t(),x3t()):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)})(xde,function(t){return t})});var YBe,Omn,Sde,C3t=b(()=>{vE();bt();kce();YBe="copilot-index-chunk-",Omn=".json",Sde=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${YBe}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${YBe}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${Omn}`}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,[]);oe().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,oe().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),oe().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 WBe(e),n=oe().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(oe().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)),oe().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(([h])=>c.some(m=>m.id===h)))}}},docs:{docs:Object.fromEntries(c.map((h,m)=>[(m+1).toString(),h])),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)),oe().debug&&console.log(`Saved partition ${l+1}/${n}`)}oe().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new tn(`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 tn("Invalid legacy database format");let l=await Q2({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await Fce(l,u),l}let r=await this.loadMetadata(),n=await Q2({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 tn("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++):oe().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 Fce(n,o),n}catch(e){throw console.error("Error loading database:",e),new tn(`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}/${YBe}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new tn(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(oe().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 tn("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new tn("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 E3t={};ns(E3t,{categorizePatterns:()=>o4,createPatternSettingsValue:()=>i4,extractAppIgnoreSettings:()=>ZK,getAllQAMarkdownContent:()=>eze,getDecodedPatterns:()=>eh,getExtensionPattern:()=>tze,getFilePattern:()=>a4,getMatchingPatterns:()=>bc,getTagPattern:()=>YK,getVectorLength:()=>QBe,previewPatternValue:()=>Tmn,shouldIndexFile:()=>ys});async function QBe(t){if(!t)throw new tn("Embedding instance not found.");try{let r=await t.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new tn("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${Pu.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new tn("Failed to determine embedding vector length. Please check your embedding model settings.")}}async function eze(t){let e="",{inclusions:r,exclusions:n}=bc(),o=t.vault.getMarkdownFiles().filter(i=>ys(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function eh(t){let e=[];return e.push(...t.split(",").map(r=>decodeURIComponent(r.trim())).filter(r=>r.length>0)),e}function Emn(){return oe().qaExclusions?eh(oe().qaExclusions):[]}function Pmn(){return oe().qaInclusions?eh(oe().qaInclusions):[]}function bc(t){let e=t?.inclusions?eh(t.inclusions):t?.isProject?[]:Pmn(),r=t?.exclusions?eh(t.exclusions):t?.isProject?[]:Emn();return{inclusions:e.length>0?o4(e):null,exclusions:r.length>0?o4(r):null}}function ys(t,e,r,n){return!(r&&O3t(t.path,r)||e&&!O3t(t.path,e)||n&&!e)}function o4(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 Tmn(t){return eh(t).join(", ")}function i4({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function Amn(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof XBe.TFile){let n=Sj(r);if(e.some(o=>n.includes(GB(o))))return!0}return!1}function Imn(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 Mmn(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 Rmn(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof XBe.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function O3t(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return Amn(t,r??[])||Imn(t,n??[])||Mmn(t,o??[])||Rmn(t,i??[])}function ZK(t){let e=[];try{if(typeof t.vault.getConfig=="function"){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}function YK(t){return`#${t}`}function a4(t){return`[[${t.basename}]]`}function tze(t){return`*.${t}`}var XBe,th=b(()=>{vE();tF();bt();fr();XBe=require("obsidian")});var P3t,iO,FP,Cde=b(()=>{tF();vE();Kt();bt();fr();kce();GBe();P3t=j(n4()),iO=require("obsidian");C3t();th();FP=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new uF;va(async()=>{let r=oe();iO.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):iO.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await Pu.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(B("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await Pu.getInstance().getEmbeddingsAPI()),B("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new tn("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new Sde(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),iO.Platform.isMobile&&oe().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new tn("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),B("Loaded existing chunked semantic index database from disk."),this.oramaDb}catch(n){ie("Failed to load existing semantic index database, creating new one:",n)}let r=await this.createNewDb(e);return this.oramaDb=r,r}catch(r){ie("Error initializing semantic index database:",r),new iO.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(iO.Platform.isMobile&&oe().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await Pu.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new tn("Semantic index database not found.")}catch(e){throw ie("Failed to initialize database during save:",e),new tn("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,oe().debug&&B("Semantic index database saved successfully at:",this.dbPath)}catch(e){throw ie("Error saving semantic index 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 iO.Notice("Local Copilot index cleared successfully."),B("Local Copilot index cleared successfully, new instance created.")}catch(r){throw ie("Error clearing the local Copilot index:",r),new iO.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new tn("Semantic index database not found.");try{let r=await Vp(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await GK(this.oramaDb,r.hits.map(n=>n.id),500),oe().debug&&B(`Deleted document from local Copilot index: ${e}`)),this.markUnsavedChanges()}catch(r){ie("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(oe().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),B("Created directory:",r))}return r}getVaultIdentifier(){let e=this.app.vault.getName();return(0,P3t.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new tn("Embedding instance not found.");let r=await QBe(e);if(!r||r===0)throw new tn("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await Q2({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return B(`Created new semantic index database for ${this.dbPath}. Embedding model: ${Pu.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 Vp(e,{term:r,properties:["path"],exact:!0,includeVectors:!0})).hits:void 0}static async getDocsByEmbedding(e,r,n){return(await Vp(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 Vp(e,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return r.hits.length>0?r.hits[0].document.mtime:0}catch(r){return ie("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,oe().numPartitions),o=await Vp(r,{term:e.id,properties:["id"],limit:1});o.hits.length>0&&await iF(r,o.hits[0].id);try{return await KK(r,e),B(`${o.hits.length>0?"Updated":"Inserted"} document ${e.id} in partition ${n}`),this.markUnsavedChanges(),e}catch(i){if(ie(`Failed to ${o.hits.length>0?"update":"insert"} document ${e.id}:`,i),o.hits.length>0)try{await KK(r,o.hits[0].document)}catch(a){ie("Failed to restore previous document version:",a)}return}}catch(n){ie(`Error upserting document ${e.id}:`,n);return}})}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let e=await Vp(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return e.hits.length>0?e.hits[0].document.mtime:0}catch(e){return ie("Error getting latest file mtime from VectorDB:",e),0}}async checkAndHandleEmbeddingModelChange(e){if(!this.oramaDb){B("Embedding model change detected. Semantic index database not found. Initializing new database...");try{return await this.initializeDB(e),!0}catch(o){throw ie("Failed to initialize database:",o),new tn("Failed to initialize semantic index database. Please check your embedding model settings.")}}let r=await Vp(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=Pu.getModelName(e);if(!Iet(n,o))return new iO.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),B(`Detected change in embedding model from "${n}" to "${o}". Rebuilding Copilot index from scratch.`),this.oramaDb=await this.createNewDb(e),await this.saveDB(),!0}else B("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await Vp(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){B("Semantic index database not found during garbage collection. Attempting to initialize...");try{let e=await Pu.getInstance().getEmbeddingsAPI();if(!e)throw new tn("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new tn("Failed to initialize database after attempt.")}catch(e){throw ie("Failed to initialize database during garbage collection:",e),new tn("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:(B("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(o.map(i=>i.path))).join(", ")),o.length===1?await iF(this.oramaDb,o[0].id):await GK(this.oramaDb,o.map(i=>i.id),500),await this.saveDB(),o.length)}catch(e){throw ie("Error garbage collecting the Copilot index:",e),new tn("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new tn("Semantic index 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 ie("Error getting indexed files:",e),new tn("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await Vp(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw ie("Error checking if database is empty:",e),new tn("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 tn("Semantic index 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 tn("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?B("Files missing embeddings after integrity check:",r.join(", ")):B("Index integrity check completed. All documents have embeddings.")}catch(e){throw ie("Error checking index integrity:",e),new tn("Failed to check index integrity.")}}}});var s4,Nmn,Ode,T3t=b(()=>{sa();oc();bt();s4=require("obsidian");th();Nmn=5e3,Ode=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(s4.Platform.isMobile&&oe().disableIndexOnMobile||Jg()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof s4.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}=bc(),u=ys(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(()=>{oe().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},Nmn)};this.handleFileDelete=async e=>{e instanceof s4.TFile&&await this.dbOps.removeDocs(e.path)};this.initializeEventListeners()}initializeEventListeners(){oe().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 XK,A3t=b(()=>{XK=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 rh,I3t=b(()=>{rh=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 Ede,M3t=b(()=>{Pf();Ede=class extends zn{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)}}});var R3t=b(()=>{I3t();M3t()});var QK=b(()=>{R3t()});var N3t=b(()=>{tFe()});var rze,u4,j3t=b(()=>{QK();N3t();rze=class extends Ede{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 h of await this.splitText(c)){let m=i,g=c.indexOf(h,p+1);if(f===null){let S=this.numberOfNewLines(c,0,g);d+=S}else{let S=p+await this.lengthFunction(f);if(S<g){let C=this.numberOfNewLines(c,S,g);d+=C}else if(S>g){let C=this.numberOfNewLines(c,g,S);d-=C}s&&(m+=a)}let y=this.numberOfNewLines(h),_=o[l].loc&&typeof o[l].loc=="object"?{...o[l].loc}:{};_.lines={from:d,to:d+y};let w={...o[l],loc:_};m+=h,u.push(new rh({pageContent:m,metadata:w})),d+=y,f=h,p=g}}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}},u4=class t extends rze{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 D3t=b(()=>{j3t()});var L3t=b(()=>{D3t()});var F3t=b(()=>{L3t()});var nze=b(()=>{F3t()});var k3t,aO,Pde,$3t=b(()=>{nr();tF();Kt();A3t();bt();fr();k3t=j(n4());nze();aO=require("obsidian");th();Pde=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=oe();this.rateLimiter=new XK(o.embeddingRequestsPerMin),this.embeddingBatchSize=o.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize,va(async()=>{let i=oe();this.rateLimiter=new XK(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 aO.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 aO.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],h=l[f];if(!h||!Array.isArray(h)||h.length===0){ie(`Invalid embedding for document ${p.fileInfo.path}: ${h}`),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}try{await this.dbOps.upsert({...p.fileInfo,id:this.getDocHash(p.content),content:p.content,embedding:h,created_at:Date.now(),nchars:p.content.length}),this.state.processedFiles.add(p.fileInfo.path)}catch(m){this.handleError(m,{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),setTimeout(()=>{this.dbOps.saveDB().then(()=>{B("Copilot index final save completed."),this.dbOps.checkIndexIntegrity().catch(s=>{ie("Background integrity check failed:",s)})}).catch(s=>{ie("Background save failed:",s)})},100),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=Pu.getModelName(r),o=u4.fromLanguage("markdown",{chunkSize:Ej}),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:Qs(new Date(a.stat.ctime)).display,modified:Qs(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,k3t.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=bc(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>ys(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(!ys(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 B([`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 aO.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 aO.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=oe(),o=eh(n.qaInclusions);o.length>0&&r.push(`Inclusions: ${o.join(", ")}`);let a=[...ZK(this.app),...eh(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 aO.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 aO.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 aO.Notice("Indexing cancelled");return}e.length>0?new aO.Notice(`Indexing completed with ${e.length} errors. Check console for details.`):new aO.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(),oe().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 Yf={};ns(Yf,{default:()=>kP});var eG,kP,Kc=b(()=>{vE();tF();bt();eG=require("obsidian");Cde();T3t();$3t();kP=class t{constructor(){this.embeddingsManager=Pu.getInstance(),this.dbOps=new FP(app),this.indexOps=new Pde(app,this.dbOps,this.embeddingsManager),this.eventHandler=new Ode(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={...oe()};let e=async()=>{let r=oe(),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())}};va(()=>{this.initializationPromise=e()})}async initialize(){try{let e=3;for(;e>0;)try{let r=await this.embeddingsManager.getEmbeddingsAPI();await this.dbOps.initializeDB(r);break}catch(r){if(r instanceof tn&&r.message.includes("Vault adapter not available")&&(e--,e>0)){await new Promise(n=>setTimeout(n,100));continue}new eG.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(),eG.Platform.isMobile&&oe().disableIndexOnMobile?(new eG.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(),await 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)}}});function UEe(t){return t.split("|")[1]==="copilot-plus"}function l4(){return _n().isPlusUser}async function sO(t){return oe().plusLicenseKey?(await Gi.getInstance().validateLicenseKey(t)).isValid:(uze(),!1)}function z3t(){let t=jmn,e=aze,r=oe().embeddingModelKey;B("applyPlusSettings: Changing embedding model",{from:r,to:e,changed:r!==e}),ptt(t),Ij("copilot_plus"),_E({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e?(B("applyPlusSettings: Embedding model changed, triggering indexing"),Promise.resolve().then(()=>(Kc(),Yf)).then(async n=>{await n.default.getInstance().indexVaultToVectorStore()}).catch(n=>{ie("Failed to trigger indexing after Plus settings applied:",n),new B3t.Notice("Failed to update Copilot index. Please try force reindexing from the command palette.")})):B("applyPlusSettings: No embedding model change, skipping indexing")}function sze(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function tD(t){window.open(sze(t),"_blank")}function U3t(){ot("isPlusUser",!0)}function uze(){let t=oe().isPlusUser;ot("isPlusUser",!1),t&&new sre(app).open()}var B3t,oze,jmn,ize,aze,dci,fci,oy=b(()=>{sa();oc();Nat();nr();Ey();Kt();bt();B3t=require("obsidian"),oze="copilot-plus-flash",jmn=oze+"|"+"copilot-plus",ize="copilot-plus-small",aze=ize+"|"+"copilot-plus",dci=gu.defaultModelKey,fci=gu.embeddingModelKey});var q3t,H3t,Gi,Ey=b(()=>{nr();Aj();Kt();oy();bt();q3t=j(Tm()),H3t=require("obsidian"),Gi=class t{constructor(){this.pluginVersion="Unknown"}static getInstance(){return t.instance||(t.instance=new t),t.instance}checkLicenseKey(){if(!oe().plusLicenseKey)throw new H3t.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=oe().userId;let a=new URL(`${ZA}${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 _o(oe().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 B(`==== ${e} request ====:`,u),{data:u}}async makeFormDataRequest(e,r,n=!1){n||this.checkLicenseKey(),r.append("user_id",oe().userId);let o=new URL(`${ZA}${e}`);try{let i=await fetch(o.toString(),{method:"POST",headers:{Authorization:`Bearer ${await _o(oe().plusLicenseKey)}`,"X-Client-Version":this.pluginVersion},body:r}),a=await i.json();if(!i.ok)try{let s=a.detail,u=new Error(s.reason);return u.name=s.error,{data:null,error:u}}catch{return{data:null,error:new Error(`HTTP error: ${i.status}`)}}return B(`==== ${e} FormData request ====:`,a),{data:a}}catch(i){return{data:null,error:i instanceof Error?i:new Error(String(i))}}}async validateLicenseKey(e){let r={license_key:await _o(oe().plusLicenseKey)};if(e&&typeof e=="object"){let i=Object.fromEntries(Object.entries(e).filter(([s,u])=>u!=null)),a=new Set(["license_key","user_id"]);for(let s of a)s in i&&delete i[s];Object.assign(r,i)}let{data:n,error:o}=await this.makeRequest("/license",r,"POST",!0,!0);return o?o.message==="Invalid license key"?(uze(),{isValid:!1}):{isValid:void 0}:(U3t(),{isValid:!0,plan:n?.plan})}async broca(e,r){let{data:n,error:o}=await this.makeRequest("/broca",{message:e,is_project_mode:r});if(o)throw o;if(!n)throw new Error("No data returned from broca");return n}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=q3t.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 docs4llm(e,r){let n=new FormData,o=this.getMimeTypeFromExtension(r),i=new Blob([e],{type:o}),a=`file.${r}`,s=new File([i],a,{type:o});n.append("files",s),n.append("file_type",r);let{data:u,error:l}=await this.makeFormDataRequest("/docs4llm",n);if(l)throw l;if(!u)throw new Error("No data returned from docs4llm");return u}getMimeTypeFromExtension(e){return{pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",epub:"application/epub+zip",txt:"text/plain",rtf:"application/rtf",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",tiff:"image/tiff",webp:"image/webp",html:"text/html",htm:"text/html",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xls:"application/vnd.ms-excel",csv:"text/csv",mp3:"audio/mpeg",mp4:"video/mp4",wav:"audio/wav",webm:"video/webm"}[e.toLowerCase()]||"application/octet-stream"}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}async autocomplete(e,r="",n=""){let{data:o,error:i}=await this.makeRequest("/autocomplete",{prompt:e,note_context:r,relevant_notes:n,max_tokens:64});if(i)throw i;if(!o)throw new Error("No data returned from autocomplete");return o}async wordcomplete(e,r="",n){let{data:o,error:i}=await this.makeRequest("/wordcomplete",{prefix:e,suffix:r,suggestions:n});if(i)throw i;if(!o)throw new Error("No data returned from wordcomplete");return o}}});var V3t,c4,lze=b(()=>{Kt();V3t=j(n4()),c4=class t{constructor(e){this.memoryCache=new Map;this.cacheDir=e}static getInstance(e=".copilot/file-content-cache"){return t.instance||(t.instance=new t(e)),t.instance}async ensureCacheDir(){await app.vault.adapter.exists(this.cacheDir)||(B("Creating file cache directory:",this.cacheDir),await app.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e,r){let n=`${e.path}:${e.stat.size}:${e.stat.mtime}${r?`:${r}`:""}`;return(0,V3t.MD5)(n).toString()}getCachePath(e){return`${this.cacheDir}/${e}.md`}async get(e){try{let r=this.memoryCache.get(e);if(r)return B("Memory cache hit for file:",e),r.content;let n=this.getCachePath(e);if(await app.vault.adapter.exists(n)){B("File cache hit:",e);let o=await app.vault.adapter.read(n),i,a=o.trim();if(a.startsWith("{")&&a.endsWith("}")||a.startsWith("[")&&a.endsWith("]"))try{i=JSON.parse(o)}catch{i=o}else i=o;let s={content:i,timestamp:Date.now()};return this.memoryCache.set(e,s),s.content}return B("Cache miss for file:",e),null}catch(r){return ie("Error reading from file cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCachePath(e),o=Date.now(),i={content:r,timestamp:o};this.memoryCache.set(e,i);let a;typeof r=="string"?a=r:a=JSON.stringify(r,null,2),await app.vault.adapter.write(n,a),B("Cached file content:",e)}catch(n){ie("Error writing to file cache:",n)}}async remove(e){try{this.memoryCache.delete(e);let r=this.getCachePath(e);await app.vault.adapter.exists(r)&&(await app.vault.adapter.remove(r),B("Removed file from cache:",e))}catch(r){ie("Error removing file from cache:",r)}}async clear(){try{if(this.memoryCache.clear(),await app.vault.adapter.exists(this.cacheDir)){let e=await app.vault.adapter.list(this.cacheDir);B("Clearing file cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){ie("Error clearing file cache:",e)}}}});var fze=x((xci,G3t)=>{var Dmn="Expected a function",W3t=NaN,Lmn="[object Symbol]",Fmn=/^\s+|\s+$/g,kmn=/^[-+]0x[0-9a-f]+$/i,$mn=/^0b[01]+$/i,Bmn=/^0o[0-7]+$/i,zmn=parseInt,Umn=typeof window=="object"&&window&&window.Object===Object&&window,qmn=typeof self=="object"&&self&&self.Object===Object&&self,Hmn=Umn||qmn||Function("return this")(),Vmn=Object.prototype,Wmn=Vmn.toString,Kmn=Math.max,Gmn=Math.min,cze=function(){return Hmn.Date.now()};function Jmn(t,e,r){var n,o,i,a,s,u,l=0,c=!1,d=!1,f=!0;if(typeof t!="function")throw new TypeError(Dmn);e=K3t(e)||0,dze(r)&&(c=!!r.leading,d="maxWait"in r,i=d?Kmn(K3t(r.maxWait)||0,e):i,f="trailing"in r?!!r.trailing:f);function p(E){var P=n,T=o;return n=o=void 0,l=E,a=t.apply(T,P),a}function h(E){return l=E,s=setTimeout(y,e),c?p(E):a}function m(E){var P=E-u,T=E-l,I=e-P;return d?Gmn(I,i-T):I}function g(E){var P=E-u,T=E-l;return u===void 0||P>=e||P<0||d&&T>=i}function y(){var E=cze();if(g(E))return _(E);s=setTimeout(y,m(E))}function _(E){return s=void 0,f&&n?p(E):(n=o=void 0,a)}function w(){s!==void 0&&clearTimeout(s),l=0,n=u=o=s=void 0}function S(){return s===void 0?a:_(cze())}function C(){var E=cze(),P=g(E);if(n=arguments,o=this,u=E,P){if(s===void 0)return h(u);if(d)return s=setTimeout(y,e),p(u)}return s===void 0&&(s=setTimeout(y,e)),a}return C.cancel=w,C.flush=S,C}function dze(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Zmn(t){return!!t&&typeof t=="object"}function Ymn(t){return typeof t=="symbol"||Zmn(t)&&Wmn.call(t)==Lmn}function K3t(t){if(typeof t=="number")return t;if(Ymn(t))return W3t;if(dze(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=dze(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(Fmn,"");var r=$mn.test(t);return r||Bmn.test(t)?zmn(t.slice(2),r?2:8):kmn.test(t)?W3t:+t}G3t.exports=Jmn});var J3t,Tde,Z3t,aR,h_,tG=b(()=>{lze();Kt();th();bt();J3t=j(n4()),Tde=require("obsidian"),Z3t=j(fze());GBe();aR=class aR{constructor(){this.cacheDir=".copilot/project-context-cache";this.memoryCache=new Map;this.projectMutexMap=new Map;this.mutexCreationMutex=new uF;this.handleFileEvent=e=>{e instanceof Tde.TFile&&this.debouncedHandleFileChange(e)};this.handleFileChange=async e=>{try{if(e.extension!=="md")return;let n=oe().projectList||[];for(let o of n){let{inclusions:i,exclusions:a}=bc({inclusions:o.contextSource.inclusions,exclusions:o.contextSource.exclusions,isProject:!0});ys(e,i,a,!0)&&(await this.invalidateMarkdownContext(o),B(`Invalidated markdown context for project ${o.name} due to file change: ${e.path}`))}}catch(r){ie("Error handling file change for project context cache:",r)}};this.debouncedHandleFileChange=(0,Z3t.default)(e=>{this.handleFileChange(e)},aR.DEBOUNCE_DELAY,{leading:!0,trailing:!0});this.vault=app.vault,this.fileCache=c4.getInstance(),this.initializeEventListeners()}static getInstance(){return aR.instance||(aR.instance=new aR),aR.instance}cleanup(){this.debouncedHandleFileChange.cancel(),this.vault.off("create",this.handleFileEvent),this.vault.off("modify",this.handleFileEvent),this.vault.off("delete",this.handleFileEvent),this.vault.off("rename",this.handleFileEvent),this.projectMutexMap.clear()}initializeEventListeners(){this.vault.on("create",this.handleFileEvent),this.vault.on("modify",this.handleFileEvent),this.vault.on("delete",this.handleFileEvent),this.vault.on("rename",this.handleFileEvent)}async ensureCacheDir(){await this.vault.adapter.exists(this.cacheDir)||(B("Creating project context cache directory:",this.cacheDir),await this.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){return(0,J3t.MD5)(e.id).toString()}getCachePath(e){return`${this.cacheDir}/${e}.json`}async getOrCreateProjectMutex(e){let r=e.id,n=this.projectMutexMap.get(r);return n||await this.mutexCreationMutex.runExclusive(async()=>{let o=this.projectMutexMap.get(r);if(o)return o;let i=new uF;return this.projectMutexMap.set(r,i),B(`Created new mutex for project: ${e.name} (ID: ${r})`),i})}async get(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);if(n)return B("Memory cache hit for project:",e.name),n;let o=this.getCachePath(r);if(await this.vault.adapter.exists(o)){B("File cache hit for project:",e.name);let i=await this.vault.adapter.read(o),a=JSON.parse(i);return this.memoryCache.set(r,a),a}return B("Cache miss for project:",e.name),null}catch(r){return ie("Error reading from project context cache:",r),null}}async getOrInitializeCache(e){let r=await this.get(e);if(r)return B(`[getOrInitializeCache] Project ${e.name}: Existing cache found. MarkdownNeedsReload: ${r.markdownNeedsReload}`),r;B(`[getOrInitializeCache] Project ${e.name}: No existing cache found, building fresh context.`);let n=this.createEmptyCache();return await this.setWithoutMutex(e,n),n}getSync(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);return n?(B("Memory cache hit for project:",e.name),n):(B("Memory cache miss for project:",e.name),null)}catch(r){return ie("Error reading from project context memory cache:",r),null}}async set(e,r){let n=await this.getOrCreateProjectMutex(e);return n.isLocked()&&B(`Waiting for project cache lock for project: ${e.name}`),await n.runExclusive(async()=>(B(`Acquired cache lock for project: ${e.name}`),await this.setWithoutMutex(e,r)))}async setWithoutMutex(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);B("Caching context for project:",e.name);let i=JSON.parse(JSON.stringify(r));this.memoryCache.set(n,i),await this.vault.adapter.write(o,JSON.stringify(i))}catch(n){throw ie("Error writing to project context cache:",n),n}}createEmptyCache(){return{markdownContext:"",webContexts:{},youtubeContexts:{},fileContexts:{},timestamp:Date.now(),markdownNeedsReload:!0}}async clearAllCache(){try{let e=new Set;for(let r of Array.from(this.memoryCache.values()))if(r?.fileContexts)for(let n in r.fileContexts)r.fileContexts[n]?.cacheKey&&e.add(r.fileContexts[n].cacheKey);if(this.memoryCache.clear(),await this.vault.adapter.exists(this.cacheDir)){let r=await this.vault.adapter.list(this.cacheDir);B("Clearing project context cache, removing files:",r.files.length),await Promise.all(r.files.map(n=>this.vault.adapter.remove(n)))}for(let r of e)await this.fileCache.remove(r);B(`Cleared ${e.size} file content cache entries associated with projects`)}catch(e){ie("Error clearing project context cache:",e)}}async clearForProject(e){try{B(`[clearForProject] Starting for project: ${e.name} (ID: ${e.id})`);let r=this.getCacheKey(e),n=await this.get(e),o=0;if(n?.fileContexts){let a=Object.keys(n.fileContexts);if(a.length>0){B(`[clearForProject] Project ${e.name}: Found ${a.length} file contexts to remove from FileCache.`);for(let s in n.fileContexts){let u=n.fileContexts[s];u&&u.cacheKey?(await this.fileCache.remove(u.cacheKey),o++):$t(`[clearForProject] Project ${e.name}: Skipped removing FileCache entry for file ${s} due to missing cacheKey.`)}B(`[clearForProject] Project ${e.name}: Attempted to clear ${o} entries from FileCache.`)}}else B(`[clearForProject] Project ${e.name}: No fileContexts found in existing project cache to clear from FileCache.`);this.memoryCache.delete(r),B(`[clearForProject] Project ${e.name}: Removed from ProjectContextCache memory.`);let i=this.getCachePath(r);await this.vault.adapter.exists(i)?(await this.vault.adapter.remove(i),B(`[clearForProject] Project ${e.name}: Successfully removed main project cache file: ${i}`)):B(`[clearForProject] Project ${e.name}: Main project cache file not found (already deleted or never existed): ${i}`),this.projectMutexMap.delete(e.id),B(`[clearForProject] Cleaned up mutex for project: ${e.name}`),B(`[clearForProject] Completed for project: ${e.name}`)}catch(r){ie(`[clearForProject] Error for project ${e.name} (ID: ${e.id}):`,r)}}async invalidateMarkdownContext(e,r=!1){await this.updateCacheSafely(e,n=>{n.markdownContext="",n.markdownNeedsReload=!0,r&&(n.webContexts={},n.youtubeContexts={},B(`Flagged Web/YouTube contexts for full reload for project ${e.name}`));let o=this.cleanupFileReferencesInCache(e,n);return B(`Invalidated markdown context for project ${e.name}`),o},!0)}async updateMarkdownContext(e,r){return await this.updateCacheSafely(e,n=>(n.markdownContext=r,n.markdownNeedsReload=!1,B(`Updated markdown context for project ${e.name}`),n))}async clearMarkdownContext(e){await this.updateCacheSafely(e,r=>(r.markdownContext="",r.markdownNeedsReload=!0,r))}async getOrReuseFileContext(e,r){try{let n=await this.getFileContext(e,r);if(n)return n;let o=await this.searchOtherProjectsForFile(r);return o?(await this.associateCacheWithProject(e,r,o.cacheKey),B(`Reused cached content from other project for: ${r} in project ${e.name}`),o.content):null}catch(n){return ie(`Error in getOrReuseFileContext for ${r} in project ${e.name}:`,n),null}}async getFileContext(e,r){try{if(!r||typeof r!="string")return ie("Error getting file context: filePath is invalid.",{project:e.name,filePath:r}),null;let n=await this.get(e);if(!n||!n.fileContexts||!n.fileContexts[r])return null;let o=n.fileContexts[r];if(!o||!o.cacheKey||typeof o.cacheKey!="string"||o.cacheKey.trim()==="")return $t(`Missing, invalid, or empty cacheKey for filePath: ${r} in project ${e.name}. Entry will be treated as a cache miss.`,{project:e.name,filePath:r,fileContextEntry:o}),null;let{cacheKey:i}=o;return typeof i!="string"?($t(`cacheKey is not a string for filePath: ${r} in project ${e.name}. Treating as cache miss.`,{project:e.name,filePath:r,cacheKey:i}),null):await this.fileCache.get(i)}catch(n){return ie(`Error getting file context for ${r} in project ${e.name}:`,n),null}}async setFileContext(e,r,n){return await this.updateCacheSafelyAsync(e,async o=>{o.fileContexts||(o.fileContexts={});let i=this.vault.getAbstractFileByPath(r);if(!(i instanceof Tde.TFile))throw new Error(`File not found: ${r}`);let a=this.fileCache.getCacheKey(i,e.id);return await this.fileCache.set(a,n),o.fileContexts[r]={timestamp:Date.now(),cacheKey:a},B(`Added/updated file context for ${r} in project ${e.name}`),o})}async removeFileContext(e,r){return await this.updateCacheSafelyAsync(e,async n=>{if(n.fileContexts&&n.fileContexts[r]){let{cacheKey:o}=n.fileContexts[r];delete n.fileContexts[r],await this.fileCache.remove(o),B(`Removed file context for ${r} in project ${e.name}`)}return n})}async searchOtherProjectsForFile(e){try{let n=oe().projectList||[];if(n.length===0)return null;B(`Searching other projects for file: ${e}`);for(let o of n){let i=await this.get(o);if(!(!i||!i.fileContexts)&&i.fileContexts[e]){let{cacheKey:a}=i.fileContexts[e];if(!a)continue;let s=await this.fileCache.get(a);if(s)return B(`Found content for file ${e} in project ${o.name}`),{content:s,cacheKey:a}}}return B(`No content found in any project for file: ${e}`),null}catch(r){return ie(`Error searching other projects for file ${e}:`,r),null}}async associateCacheWithProject(e,r,n){return await this.updateCacheSafelyAsync(e,async o=>(o.fileContexts||(o.fileContexts={}),o.fileContexts[r]={timestamp:Date.now(),cacheKey:n},B(`Associated cache with project ${e.name} for file: ${r}`),o))}cleanupFileReferencesInCache(e,r){if(!r.fileContexts)return r;let{inclusions:n,exclusions:o}=bc({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=0,a={};for(let s in r.fileContexts){let u=this.vault.getAbstractFileByPath(s);!(u instanceof Tde.TFile)||!ys(u,n,o,!0)?i++:a[s]=r.fileContexts[s]}return i>0&&(r.fileContexts=a,B(`Removed ${i} file references from project ${e.name} that no longer match inclusion patterns`)),r}async cleanupProjectFileReferences(e){B(`[cleanupProjectFileReferences] Starting for project: ${e.name}`);try{await this.updateCacheSafely(e,r=>this.cleanupFileReferencesInCache(e,r),!0)}catch(r){ie(`Error cleaning up project file references for ${e.name}:`,r)}}async updateProjectFilesFromPatterns(e,r){try{B(`[updateProjectFilesFromPatterns] Starting for project: ${e.name}`),r.fileContexts||(r.fileContexts={});let{inclusions:n,exclusions:o}=bc({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=this.vault.getFiles(),a=0;for(let s of i)if(ys(s,n,o,!0)){if(r.fileContexts[s.path])continue;let u=this.fileCache.getCacheKey(s,e.id);r.fileContexts[s.path]={timestamp:Date.now(),cacheKey:u},a++}a>0&&B(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${a} new file references to context (in memory).`),B(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(n){ie(`[updateProjectFilesFromPatterns] Error for project ${e.name}:`,n)}return r}updateProjectMarkdownFilesFromPatterns(e,r,n){try{r.fileContexts||(r.fileContexts={});let o=n.filter(a=>a.extension==="md"),i=0;for(let a of o){if(r.fileContexts[a.path])continue;let s=this.fileCache.getCacheKey(a,e.id);r.fileContexts[a.path]={timestamp:Date.now(),cacheKey:s},i++}i>0&&B(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${i} new file references to context (in memory).`),B(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total markdown fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(o){ie(`[updateProjectFilesFromPatterns] Error for project ${e.name}:`,o)}return r}async removeWebUrls(e,r){r.length&&await this.updateCacheSafely(e,n=>{if(n.webContexts){for(let o of r)n.webContexts[o]&&delete n.webContexts[o];B(`Removed web contexts for URLs ${r.join(", ")} in project ${e.name}`)}return n})}async updateWebUrl(e,r,n){return await this.updateCacheSafely(e,o=>(o.webContexts||(o.webContexts={}),o.webContexts[r]=n,B(`Updated web context for URL ${r} in project ${e.name}`),o))}async removeYoutubeUrls(e,r){r.length&&await this.updateCacheSafely(e,n=>{if(n.youtubeContexts){for(let o of r)n.youtubeContexts[o]&&delete n.youtubeContexts[o];B(`removeYoutubeUrls: Removed YouTube contexts for URLs ${r.join(", ")} in project ${e.name}`)}return n})}async updateYoutubeUrl(e,r,n){return await this.updateCacheSafely(e,o=>(o.youtubeContexts||(o.youtubeContexts={}),o.youtubeContexts[r]=n,B(`Updated YouTube context for URL ${r} in project ${e.name}`),o))}async updateCacheSafely(e,r,n=!1){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>{try{let i=await this.get(e);if(!i){if(n)return;throw new Error(`Project: ${e.name} context cache not found, please invoke getOrInitializeCache method before invoke update context cache`)}let a=r(i);await this.setWithoutMutex(e,a)}catch(i){throw ie(`Error updating cache for project ${e.name}:`,i),i}})}async updateCacheSafelyAsync(e,r,n=!1){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>{try{let i=await this.get(e);if(!i){if(n)return;throw new Error(`Project: ${e.name} context cache not found, please invoke getOrInitializeCache method before invoke update context cache`)}let a=await r(i);await this.setWithoutMutex(e,a)}catch(i){throw ie(`Error updating cache for project ${e.name}:`,i),i}})}async setCacheSafely(e,r){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>(B(`External safe set for project: ${e.name}`),await this.setWithoutMutex(e,r)))}};aR.DEBOUNCE_DELAY=5e3;h_=aR});var lF,uO,cF,pze=b(()=>{Kt();fr();lF=require("obsidian"),uO=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 ie(`Unsupported image format from URL path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;try{let c=(await yu(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?(ie(`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 lF.TFile?i.stat.size>this.MAX_IMAGE_SIZE?(ie(`Vault file too large: ${i.stat.size} bytes for path: ${e}`),!1):!0:(ie(`File with image extension not found in vault: ${e}.`),!1)}else return n&&ie(`Unsupported image format for potential vault path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;return ie(`Could not determine image status for URL/path: ${e}`),!1}catch(n){return ie(`Unexpected error in isImageUrl for "${e}":`,n),!1}}static async handleVaultImage(e,r){try{if(e.stat.size>this.MAX_IMAGE_SIZE)return ie(`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 ie(`Invalid MIME type: ${o}, skipping: ${e.path}`),null;let a=Buffer.from(n).toString("base64");return`data:${o};base64,${a}`}catch(n){return ie("Error processing vault image:",n),null}}static async handleWebImage(e){try{let r=await yu(e,{method:"GET",headers:{}});if(!r.ok)return ie(`Failed to fetch image: ${r.statusText}, URL: ${e}`),null;let n=r.headers.get("content-type");if(!n?.startsWith("image/"))return ie(`Invalid content type: ${n}, URL: ${e}`),null;let o=await r.arrayBuffer();if(o.byteLength>this.MAX_IMAGE_SIZE)return ie(`Image too large: ${o.byteLength} bytes, URL: ${e}`),null;let a=Buffer.from(o).toString("base64");return`data:${n};base64,${a}`}catch(r){return ie("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 lF.TFile))return ie(`Local image not found: ${n}`),null;if(o.stat.size>this.MAX_IMAGE_SIZE)return ie(`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 ie(`Invalid MIME type: ${a}, path: ${n}`),null;let u=Buffer.from(i).toString("base64");return`data:${a};base64,${u}`}catch(n){return ie("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 lF.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 lF.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}}:(ie(`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 ie(i),new Error(i)}return o}};uO.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],uO.MAX_IMAGE_SIZE=3*1024*1024,uO.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp"};cF=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 ie("Error processing URL batch:",o),{successfulImages:[],failureDescriptions:e.map(i=>`Image read failed for: ${i}`)}}}static async processSingleUrl(e,r,n){try{if(!await uO.isImageUrl(e,n))return null;let o=await uO.convertToBase64(e,n);return o||(r.push(e),null)}catch(o){return ie(`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){ie("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 uO.convertToBase64(e.image_url.url,n);return o||(r.push(e.image_url.url),null)}catch(o){return ie(`Failed to process chat image: ${e.image_url.url}`,o),r.push(e.image_url.url),null}}static showFailedImagesNotice(e){e.length>0&&new lF.Notice(`Failed to process images:
${e.join(`
`)}`)}}});var sR,Ade=b(()=>{pze();Ey();fr();Kt();sR=class t{constructor(){this.mentions=new Map,this.brevilabsClient=Gi.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=>!Net(n))}async processUrl(e){try{return await this.brevilabsClient.url4llm(e)}catch(r){let n=Xn(r);return ie(`Error processing URL ${e}: ${n}`),{response:e,elapsed_time_ms:0,error:n}}}async processUrls(e){let r=this.extractUrls(e),n="",o=[],i={};if(r.length===0)return{urlContext:n,imageUrls:o,processedErrorUrls:i};let a=r.map(async u=>{if(await uO.isImageUrl(u,app.vault))return o.push(u),null;if(!this.mentions.has(u)){let l=await this.processUrl(u);this.mentions.set(u,{type:"url",original:u,processed:l.response,error:l.error})}return this.mentions.get(u)});return(await Promise.all(a)).forEach(u=>{u?.processed&&(n+=`
<url_content>
<url>${u.original}</url>
<content>
${u.processed}
</content>
</url_content>`),u?.error&&(i[u.original]=u.error)}),{urlContext:n,imageUrls:o,processedErrorUrls:i}}getMentions(){return this.mentions}clearMentions(){this.mentions.clear()}}});var Y3t,Ide,X3t=b(()=>{Kt();Y3t=j(n4()),Ide=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)||(B("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,Y3t.MD5)(r).toString();return B("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)){B("Cache hit for PDF:",e.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return B("Cache miss for PDF:",e.path),null}catch(r){return ie("Error reading from PDF cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);B("Caching PDF response for:",e.path),await app.vault.adapter.write(o,JSON.stringify(r))}catch(n){ie("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);B("Clearing PDF cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){ie("Error clearing PDF cache:",e)}}}});function $P(t){if(!t||typeof t!="object")return!1;let e=t.message||t.toString();return e.includes("Request rate limit exceeded")||e.includes("RATE_LIMIT_EXCEEDED")||e.includes("429")||t.status===429}function Q3t(t){let r=(t?.message||t?.toString()||"").match(/Try again in ([\d\w\s]+)/);return r?r[1]:"some time"}var rG=b(()=>{});var eHt,Rde,tHt,Mde,rHt=b(()=>{eHt=require("obsidian"),Mde=class{constructor(e){this.vault=e;ywe(this,Rde)}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 eHt.TFile?await this.vault.cachedRead(l):"";return{...u,content:c}}return u.type==="text"?{...u,content:u.text??""}:{...u,content:""}})),a=[...o];xGe(this,Rde,tHt).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}};Rde=new WeakSet,tHt=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 nHt,mze,Nde,hze,d4,nG,uR,jde=b(()=>{X3t();tG();Kt();rG();nHt=require("obsidian");rHt();mze=class{constructor(){this.supportedExtensions=["md"]}async parseFile(e,r){return await r.read(e)}},Nde=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=Ide.getInstance()}async parseFile(e,r){try{B("Parsing PDF file:",e.path);let n=await this.pdfCache.get(e);if(n)return B("Using cached PDF content for:",e.path),n.response;let o=await r.readBinary(e);B("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 ie(`Error extracting content from PDF ${e.path}:`,n),`[Error: Could not extract content from PDF ${e.basename}]`}}async clearCache(){B("Clearing PDF cache"),await this.pdfCache.clear()}},hze=class{constructor(){this.supportedExtensions=["canvas"]}async parseFile(e,r){try{B("Parsing Canvas file:",e.path);let n=new Mde(r),o=await n.load(e);return n.buildPrompt(o)}catch(n){return ie(`Error parsing Canvas file ${e.path}:`,n),`[Error: Could not parse Canvas file ${e.basename}]`}}},d4=class d4{constructor(e,r=null){this.supportedExtensions=["pdf","602","abw","cgm","cwk","doc","docx","docm","dot","dotm","hwp","key","lwp","mw","mcw","pages","pbd","ppt","pptm","pptx","pot","potm","potx","rtf","sda","sdd","sdp","sdw","sgl","sti","sxi","sxw","stw","sxg","txt","uof","uop","uot","vor","wpd","wps","xml","zabw","epub","jpg","jpeg","png","gif","bmp","svg","tiff","webp","web","htm","html","xlsx","xls","xlsm","xlsb","xlw","csv","dif","sylk","slk","prn","numbers","et","ods","fods","uos1","uos2","dbf","wk1","wk2","wk3","wk4","wks","123","wq1","wq2","wb1","wb2","wb3","qpw","xlr","eth","tsv","mp3","mp4","mpeg","mpga","m4a","wav","webm"];this.brevilabsClient=e,this.projectContextCache=h_.getInstance(),this.currentProject=r}static resetRateLimitNoticeTimer(){d4.lastRateLimitNoticeTime=0}async parseFile(e,r){try{if(B(`[Docs4LLMParser] Project ${this.currentProject?.name}: Parsing ${e.extension} file: ${e.path}`),!this.currentProject)throw ie("[Docs4LLMParser] No project context for parsing file: ",e.path),new Error("No project context provided for file parsing");let n=await this.projectContextCache.getOrReuseFileContext(this.currentProject,e.path);if(n)return B(`[Docs4LLMParser] Project ${this.currentProject.name}: Using cached content for: ${e.path}`),n;B(`[Docs4LLMParser] Project ${this.currentProject.name}: Cache miss for: ${e.path}. Proceeding to API call.`);let o=await r.readBinary(e);B(`[Docs4LLMParser] Project ${this.currentProject.name}: Calling docs4llm API for: ${e.path}`);let i=await this.brevilabsClient.docs4llm(o,e.extension);if(!i||!i.response)throw new Error("Empty response from docs4llm API");let a="";if(typeof i.response=="string")a=i.response;else if(Array.isArray(i.response)){let s=[];for(let u of i.response)u.content&&(u.content.md?s.push(u.content.md):u.content.text&&s.push(u.content.text));a=s.join(`
`)}else typeof i.response=="object"?i.response.md?a=i.response.md:i.response.text?a=i.response.text:i.response.content?a=i.response.content:a=JSON.stringify(i.response,null,2):a=String(i.response);return await this.projectContextCache.setFileContext(this.currentProject,e.path,a),B(`[Docs4LLMParser] Project ${this.currentProject.name}: Successfully processed and cached: ${e.path}`),a}catch(n){throw ie(`[Docs4LLMParser] Project ${this.currentProject?.name}: Error processing file ${e.path}:`,n),$P(n)&&this.showRateLimitNotice(n),n}}showRateLimitNotice(e){let r=Date.now();if(r-d4.lastRateLimitNoticeTime<6e4)return;d4.lastRateLimitNoticeTime=r;let n=Q3t(e);new nHt.Notice(`\u26A0\uFE0F Rate limit exceeded for document processing. Please try again in ${n}. Having fewer non-markdown files in the project will help.`,1e4)}async clearCache(){B("Cache clearing is now handled at the project level")}};d4.lastRateLimitNoticeTime=0;nG=d4,uR=class{constructor(e,r,n=!1,o=null){this.parsers=new Map;this.isProjectMode=n,this.currentProject=o,this.registerParser(new mze),this.registerParser(new nG(e,o)),n||this.registerParser(new Nde(e)),this.registerParser(new hze)}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 Nde&&await e.clearCache()}}});var Lde={};ns(Lde,{createToolCallMarker:()=>Dde,decodeResultFromMarker:()=>yze,decodeToolCallMarkerResults:()=>Xmn,ensureEncodedToolCallMarkerResults:()=>Qmn,parseToolCallMarkers:()=>bze,updateToolCallMarker:()=>_ze});function gze(t){try{return`ENC:${encodeURIComponent(t)}`}catch{return t}}function yze(t){if(typeof t!="string"||!t.startsWith("ENC:"))return t;try{return decodeURIComponent(t.slice(4))}catch{return t}}function Xmn(t){return!t||typeof t!="string"?t:t.replace(/<!--TOOL_CALL_END:([^:]+):(ENC:[\s\S]*?)-->/g,(e,r,n)=>{let o=yze(n)||n;return`<!--TOOL_CALL_END:${r}:${o}-->`})}function Qmn(t){return!t||typeof t!="string"?t:t.replace(/<!--TOOL_CALL_END:([^:]+):([\s\S]*?)-->/g,(e,r,n)=>{if(n.startsWith("ENC:"))return e;let o=gze(n);return`<!--TOOL_CALL_END:${r}:${o}-->`})}function bze(t){let e=[],r=/<!--TOOL_CALL_START:([^:]+):([^:]+):([^:]+):([^:]+):([^:]*):([^:]+)-->([\s\S]*?)<!--TOOL_CALL_END:\1:([\s\S]*?)-->/g,n=0,o;for(;(o=r.exec(t))!==null;){o.index>n&&e.push({type:"text",content:t.slice(n,o.index)});let[i,a,s,u,l,c,d,f,p]=o;e.push({type:"toolCall",content:f,toolCall:{id:a,toolName:s,displayName:u,emoji:l,confirmationMessage:c||void 0,isExecuting:d==="true",result:yze(p)||void 0,startIndex:o.index,endIndex:o.index+i.length}}),n=o.index+i.length}return n<t.length&&e.push({type:"text",content:t.slice(n)}),e.length===0&&e.push({type:"text",content:t}),{segments:e}}function Dde(t,e,r,n,o="",i=!0,a="",s=""){let u=s&&gze(s);return`<!--TOOL_CALL_START:${t}:${e}:${r}:${n}:${o}:${i}-->${a}<!--TOOL_CALL_END:${t}:${u}-->`}function _ze(t,e,r){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(<!--TOOL_CALL_START:${n}:[^:]+:[^:]+:[^:]+:[^:]*:)true(-->[\\s\\S]*?<!--TOOL_CALL_END:${n}:)[\\s\\S]*?-->`,"g"),i=gze(r);return t.replace(o,`$1false$2${i}-->`)}var f4=b(()=>{});var oHt,BP,iG=b(()=>{nr();Kt();fr();oHt=require("obsidian"),BP=class{constructor(e){this.chainManager=e}async handleResponse(e,r,n,o,i,a,s){e&&!(n.signal.aborted&&n.signal.reason==="new-chat")?(await this.chainManager.memoryManager.getMemory().saveContext({input:r.message},{output:s||e}),o({message:e,sender:Vg,isVisible:!0,timestamp:Qs(new Date),sources:a}),i("")):n.signal.reason==="new-chat"&&i(""),B(`==== Chat Memory ====
`,this.chainManager.memoryManager.getMemory().chatHistory.messages.map(u=>u.content));try{let{decodeToolCallMarkerResults:u}=await Promise.resolve().then(()=>(f4(),Lde)),l=u(e);B(`==== Final AI Response ====
`,l)}catch{B(`==== Final AI Response ====
`,e)}return e}async handleError(e,r,n){let o=Xn(e);ie("Error during LLM invocation:",o);let i=e?.response?.data?.error||o,a=i?.code||o,s="";if(e?.message?.includes("Invalid license key")?s="Invalid Copilot Plus license key. Please check your license key in settings.":a==="model_not_found"?s="You do not have access to this model or the model does not exist, please check with your API provider.":s=`${a}`,ie(i),r&&n){n("");let u=s.search("Troubleshooting URL");s=u!==-1?s.slice(0,u):s,o.search(/401|invalid|not valid/gi)!==-1&&(s=`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: `+s),r({message:s,isErrorMessage:!0,sender:Vg,isVisible:!0,timestamp:Qs(new Date)})}else new oHt.Notice(s),ie(i)}}});var g_,p4=b(()=>{g_=class{constructor(e,r){this.updateCurrentAiMessage=e;this.modelAdapter=r;this.hasOpenThinkBlock=!1;this.fullResponse="";this.shouldTruncate=!1}handleClaude37Chunk(e){let r="";for(let n of e)switch(n.type){case"text":r+=n.text;break;case"thinking":return this.hasOpenThinkBlock||(this.fullResponse+=`
<think>`,this.hasOpenThinkBlock=!0),n.thinking!==void 0&&(this.fullResponse+=n.thinking),this.updateCurrentAiMessage(this.fullResponse),!0}return r&&(this.fullResponse+=r),!1}handleDeepseekChunk(e){return typeof e.content=="string"&&(this.fullResponse+=e.content),e.additional_kwargs?.reasoning_content?(this.hasOpenThinkBlock||(this.fullResponse+=`
<think>`,this.hasOpenThinkBlock=!0),e.additional_kwargs.reasoning_content!==void 0&&(this.fullResponse+=e.additional_kwargs.reasoning_content),!0):!1}processChunk(e){if(this.shouldTruncate)return;let r=!1;Array.isArray(e.content)?r=this.handleClaude37Chunk(e.content):r=this.handleDeepseekChunk(e),this.hasOpenThinkBlock&&!r&&(this.fullResponse+="</think>",this.hasOpenThinkBlock=!1),this.modelAdapter?.shouldTruncateStreaming?.(this.fullResponse)&&(this.shouldTruncate=!0,this.fullResponse=this.truncateToLastCompleteToolCall(this.fullResponse)),this.updateCurrentAiMessage(this.fullResponse)}truncateToLastCompleteToolCall(e){let r=e.lastIndexOf("</use_tool>");if(r===-1)return e;let n=e.substring(0,r+11);return this.modelAdapter?.sanitizeResponse?this.modelAdapter.sanitizeResponse(n,1):n}close(){return this.hasOpenThinkBlock&&(this.fullResponse+="</think>",this.updateCurrentAiMessage(this.fullResponse)),this.fullResponse}}});var aG,iHt=b(()=>{nr();Kt();bt();fr();iG();p4();aG=class extends BP{async run(e,r,n,o,i){let a=new g_(n);try{let l=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),c=YB(l),d=[],f=If(),p=this.chainManager.chatModelManager.getChatModel();f&&d.push({role:JA(p),content:f});for(let m of c)d.push({role:m.role,content:m.content});if(e.content&&Array.isArray(e.content)){let m=e.content.map(g=>g.type==="text"?{...g,text:e.message}:g);d.push({role:"user",content:m})}else d.push({role:"user",content:e.message});B(`==== Final Request to AI ====
`,d);let h=await Sd(()=>this.chainManager.chatModelManager.getChatModel().stream(d,{signal:r.signal}));for await(let m of h){if(r.signal.aborted){B("Stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(m)}}catch(u){u.name==="AbortError"||r.signal.aborted?B("Stream aborted by user",{reason:r.signal.reason}):await this.handleError(u,o,n)}let s=a.close();return r.signal.aborted&&r.signal.reason==="new-chat"?(n(""),""):this.handleResponse(s,e,r,o,n)}}});var m4,aHt=b(()=>{FA();Pf();bv();m4=class extends zn{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,An(r))}async getRelevantDocuments(e,r){let n=An(O6(r)),i=await(await mu.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 vze=b(()=>{aHt()});var Fde={};ns(Fde,{HybridRetriever:()=>sG});var sG,uG=b(()=>{Ey();tF();lR();Kt();Kc();nr();bt();fr();QK();VA();vze();kce();Cde();sG=class extends m4{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"];this.queryRewritePrompt=Cm.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){return Sd(async()=>{let o=Hg(r,app.vault),i=o.map(m=>m.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 oe().debug&&console.log("No chunks found for query:",r),d;let f=c.reduce((m,g)=>{let y=g.metadata.score;return typeof y=="number"&&!isNaN(y)?Math.max(m,y):m},0),p=c.every(m=>typeof m.metadata.score!="number"||isNaN(m.metadata.score)),h=this.options.useRerankerThreshold&&(f<this.options.useRerankerThreshold||p);return h&&(d=(await Gi.getInstance().rerank(r,c.map(g=>g.pageContent.slice(0,3e3)))).response.data.map(g=>({...c[g.index],metadata:{...c[g.index].metadata,rerank_score:g.relevance_score}}))),oe().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),h?console.log("Reranked Chunks: ",d):console.log("No reranking applied.")),d})}async rewriteQuery(r){try{return await xee(async()=>{let n=await this.queryRewritePrompt.format({question:r}),o=await Sd(()=>Hd.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke(n));return o&&"content"in o?Cj(o.content):(console.warn("Unexpected rewrittenQuery format. Falling back to original query."),r)},rz)}catch(n){return console.error("Error in rewriteQuery:",n),r}}async getExplicitChunks(r){let n=[];for(let o of r){let i=await kP.getInstance().getDb(),a=await FP.getDocsByPath(i,o.path);if(a){let s=a.map(u=>new rh({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 kP.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&&(oe().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);B("==== Daily note date range: ====",d[0],d[d.length-1]);let f=Hg(d.join(", "),app.vault),h=(await this.getExplicitChunks(f)).map(w=>({...w,metadata:{...w.metadata,includeInContext:!0}}));B("==== Modified time range: ====",l,c),s.where={mtime:{between:[l,c]}};let g=(await Vp(a,s)).hits.map(w=>new rh({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}})),y=[...h,...g];return Array.from(new Set(y.map(w=>w.metadata.id))).map(w=>y.find(S=>S.metadata.id===w)).filter(w=>w!==void 0)}oe().debug&&console.log(`==== Orama Search Params: ====
`,s);let u=await Vp(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 rh({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 Pu.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}}))}}});var xze,wze,cR,kde=b(()=>{Kt();nr();xze=require("obsidian");nze();wze={maxChars:Ej,overlap:0,maxBytesTotal:10*1024*1024},cR=class{constructor(e){this.app=e;this.cache=new Map;this.memoryUsage=0;this.splitter=u4.fromLanguage("markdown",{chunkSize:Ej,chunkOverlap:0,separators:[`
`,`
`,". "," ",""],keepSeparator:!1})}async getChunks(e,r={}){try{if(!Array.isArray(e))return $t("ChunkManager: Invalid notePaths provided"),[];if(e.length===0)return[];e.length>1e3&&($t("ChunkManager: Too many note paths, limiting to 1000"),e=e.slice(0,1e3));let n=e.filter(a=>!(!a||typeof a!="string"||a.includes("..")||a.startsWith("/")));if(n.length===0)return $t("ChunkManager: No valid note paths provided"),[];let o={...wze,...r},i=[];for(let a of n){let s=this.cache.get(a);if(!s&&(s=await this.generateChunksForNote(a,o),s.length>0)){let u=this.calculateChunkBytes(s);this.memoryUsage+u<=o.maxBytesTotal?(this.cache.set(a,s),this.memoryUsage+=u):$t(`ChunkManager: Skipping cache for ${a}, would exceed memory budget`)}i.push(...s)}return B(`ChunkManager: Retrieved ${i.length} chunks from ${n.length} notes (${this.formatMemoryUsage()})`),i}catch(n){return $t("ChunkManager: Failed to get chunks",n),[]}}async getChunkText(e){return(await this.ensureChunkExists(e))?.content||""}async ensureChunkExists(e){let[r]=e.split("#"),o=(await this.getValidatedChunks(r)).find(i=>i.id===e);return o||$t(`ChunkManager: Chunk ${e} not found after regeneration`),o||null}async getValidatedChunks(e){let r=this.cache.get(e);if(!r&&(B(`ChunkManager: Cache miss for ${e}, regenerating...`),r=await this.regenerateChunks(e),!r||r.length===0))return $t(`ChunkManager: Failed to regenerate chunks for ${e}`),[];let n=this.app.vault.getAbstractFileByPath(e);return n&&n instanceof xze.TFile&&r.length>0&&n.stat.mtime>r[0].mtime&&(B(`ChunkManager: File ${e} modified, regenerating chunks`),r=await this.regenerateChunks(e),!r||r.length===0)?($t(`ChunkManager: Failed to regenerate chunks after modification for ${e}`),[]):r}getChunkTextSync(e){let[r]=e.split("#"),n=this.cache.get(r);return n?n.find(i=>i.id===e)?.content||"":($t(`ChunkManager: Chunk not in cache: ${e} (use async getChunkText for auto-regeneration)`),"")}async regenerateChunks(e){try{let r=await this.generateChunksForNote(e,wze);if(r.length>0){let n=this.calculateChunkBytes(r);if(this.memoryUsage+n<=wze.maxBytesTotal){let o=this.cache.get(e);o&&(this.memoryUsage-=this.calculateChunkBytes(o)),this.cache.set(e,r),this.memoryUsage+=n}else $t(`ChunkManager: Cannot cache regenerated chunks for ${e}, would exceed memory budget`)}return r}catch(r){return $t(`ChunkManager: Failed to regenerate chunks for ${e}`,r),[]}}clearCache(){this.cache.clear(),this.memoryUsage=0,B("ChunkManager: Cache cleared")}async generateChunksForNote(e,r){try{let n=this.app.vault.getAbstractFileByPath(e);if(!n||!(n instanceof xze.TFile))return[];let o=await this.safeReadFile(n);if(!o?.trim())return[];let a=(this.app.metadataCache.getFileCache(n)?.headings||[]).slice().sort((l,c)=>l.position.start.offset-c.position.start.offset),s=[],u=0;if(a.length===0){let l=await this.processContentSection(o,"",n,u,r);return s.push(...l),s}for(let l=0;l<a.length;l++){let c=a[l],d=a[l+1],f=c.position.start.offset,p=d?.position.start.offset||o.length,h=o.substring(f,p),m=await this.processContentSection(h,c.heading,n,u,r);s.push(...m),u+=m.length}return s}catch(n){return $t(`ChunkManager: Failed to chunk note ${e}`,n),[]}}async processContentSection(e,r,n,o,i){let a=n.basename,s=[],u=`
NOTE TITLE: [[${a}]]
NOTE BLOCK CONTENT:
`,l=u+e;if(l.length<=i.maxChars){let c=this.generateChunkId(n.path,o),d=this.calculateContentHash(l);s.push({id:c,notePath:n.path,chunkIndex:o,content:l,contentHash:d,title:a,heading:r,mtime:n.stat.mtime})}else try{(await this.splitter.createDocuments([e],[],{chunkHeader:u,appendChunkOverlapHeader:i.overlap>0})).forEach((d,f)=>{let p=o+f,h=this.generateChunkId(n.path,p),m=this.calculateContentHash(d.pageContent);s.push({id:h,notePath:n.path,chunkIndex:p,content:d.pageContent,contentHash:m,title:a,heading:r,mtime:n.stat.mtime})})}catch(c){$t(`ChunkManager: Failed to split section in ${n.path}`,c);let d=this.generateChunkId(n.path,o),f=this.calculateContentHash(l);s.push({id:d,notePath:n.path,chunkIndex:o,content:l,contentHash:f,title:a,heading:r,mtime:n.stat.mtime})}return s}calculateChunkBytes(e){return e.reduce((r,n)=>r+Buffer.byteLength(n.content,"utf8"),0)}async safeReadFile(e){try{return(await this.app.vault.cachedRead(e))?.trim()||""}catch(r){return $t(`ChunkManager: Failed to read ${e.path}`,r),""}}generateChunkId(e,r){return`${e}#${r}`}calculateContentHash(e){let r=e.length.toString(16),n=e.slice(0,32).replace(/\s/g,"").substring(0,8);return r+n}formatMemoryUsage(){return`${(this.memoryUsage/1024/1024).toFixed(1)}MB`}}});var Sze=x(()=>{});function Vd(t,e,r){let n=typeof r,o=typeof t;if(n!=="undefined"){if(o!=="undefined"){if(r){if(o==="function"&&n===o)return function(s){return t(r(s))};if(e=t.constructor,e===r.constructor){if(e===Array)return r.concat(t);if(e===Map){var i=new Map(r);for(var a of t)i.set(a[0],a[1]);return i}if(e===Set){a=new Set(r);for(i of t.values())a.add(i);return a}}}return t}return r}return o==="undefined"?e:t}function h4(t,e){return typeof t>"u"?e:t}function $s(){return Object.create(null)}function y_(t){return typeof t=="string"}function cG(t){return typeof t=="object"}function dG(t,e){if(y_(e))t=t[e];else for(let r=0;t&&r<e.length;r++)t=t[e[r]];return t}function _4(t={}){if(!this||this.constructor!==_4)return new _4(...arguments);if(arguments.length)for(t=0;t<arguments.length;t++)this.assign(arguments[t]);else this.assign(t)}function fF(t){t.F=null,t.B.clear(),t.D.clear()}function Ize(t,e,r){r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):r=t),r&&(t=r.query||t,e=r.limit||e);let n=""+(e||0);r&&(n+=(r.offset||0)+!!r.context+!!r.suggest+(r.resolve!==!1)+(r.resolution||this.resolution)+(r.boost||0)),t=(""+t).toLowerCase(),this.cache||(this.cache=new hF);let o=this.cache.get(t+n);if(!o){let i=r&&r.cache;i&&(r.cache=!1),o=this.search(t,e,r),i&&(r.cache=i),this.cache.set(t+n,o)}return o}function hF(t){this.limit=t&&t!==!0?t:1e3,this.cache=new Map,this.h=""}function fHt(t,e,r,n){let o=[];for(let i=0,a;i<t.index.length;i++)if(a=t.index[i],e>=a.length)e-=a.length;else{e=a[n?"splice":"slice"](e,r);let s=e.length;if(s&&(o=o.length?o.concat(e):e,r-=s,n&&(t.length-=s),!r))break;e=0}return o}function v4(t){if(!this||this.constructor!==v4)return new v4(t);this.index=t?[t]:[],this.length=t?t.length:0;let e=this;return new Proxy([],{get(r,n){if(n==="length")return e.length;if(n==="push")return function(o){e.index[e.index.length-1].push(o),e.length++};if(n==="pop")return function(){if(e.length)return e.length--,e.index[e.index.length-1].pop()};if(n==="indexOf")return function(o){let i=0;for(let a=0,s,u;a<e.index.length;a++){if(s=e.index[a],u=s.indexOf(o),u>=0)return i+u;i+=s.length}return-1};if(n==="includes")return function(o){for(let i=0;i<e.index.length;i++)if(e.index[i].includes(o))return!0;return!1};if(n==="slice")return function(o,i){return fHt(e,o||0,i||e.length,!1)};if(n==="splice")return function(o,i){return fHt(e,o||0,i||e.length,!0)};if(n==="constructor")return Array;if(typeof n!="symbol")return(r=e.index[n/2**31|0])&&r[n]},set(r,n,o){return r=n/2**31|0,(e.index[r]||(e.index[r]=[]))[n]=o,e.length++,!0}})}function b_(t=8){if(!this||this.constructor!==b_)return new b_(t);this.index=$s(),this.h=[],this.size=0,t>32?(this.B=wHt,this.A=BigInt(t)):(this.B=vHt,this.A=t)}function __(t=8){if(!this||this.constructor!==__)return new __(t);this.index=$s(),this.h=[],this.size=0,t>32?(this.B=wHt,this.A=BigInt(t)):(this.B=vHt,this.A=t)}function vHt(t){let e=2**this.A-1;if(typeof t=="number")return t&e;let r=0,n=this.A+1;for(let o=0;o<t.length;o++)r=(r*n^t.charCodeAt(o))&e;return this.A===32?r+2**31:r}function wHt(t){let e=BigInt(2)**this.A-BigInt(1);var r=typeof t;if(r==="bigint")return t&e;if(r==="number")return BigInt(t)&e;r=BigInt(0);let n=this.A+BigInt(1);for(let o=0;o<t.length;o++)r=(r*n^BigInt(t.charCodeAt(o)))&e;return r}async function ohn(t){t=t.data;var e=t.task;let r=t.id,n=t.args;switch(e){case"init":lG=t.options||{},(e=t.factory)?(Function("return "+e)()(self),g4=new self.FlexSearch.Index(lG),delete self.FlexSearch):g4=new v_(lG),postMessage({id:r});break;default:let o;e==="export"&&(n[1]?(n[0]=lG.export,n[2]=0,n[3]=1):n=null),e==="import"?n[0]&&(t=await lG.import.call(g4,n[0]),g4.import(n[0],t)):((o=n&&g4[e].apply(g4,n))&&o.then&&(o=await o),o&&o.await&&(o=await o.await),e==="search"&&o.result&&(o=o.result)),postMessage(e==="search"?{id:r,msg:o}:{id:r})}}function Rze(t){y4.call(t,"add"),y4.call(t,"append"),y4.call(t,"search"),y4.call(t,"update"),y4.call(t,"remove"),y4.call(t,"searchCache")}function ihn(){Eze=Ude=0}function y4(t){this[t+"Async"]=function(){let e=arguments;var r=e[e.length-1];let n;if(typeof r=="function"&&(n=r,delete e[e.length-1]),Eze?Ude||(Ude=Date.now()-pHt>=this.priority*this.priority*3):(Eze=setTimeout(ihn,0),pHt=Date.now()),Ude){let i=this;return new Promise(a=>{setTimeout(function(){a(i[t+"Async"].apply(i,e))},0)})}let o=this[t].apply(this,e);return r=o.then?o:new Promise(i=>i(o)),n&&r.then(n),r}}function pF(t={},e){function r(s){function u(l){l=l.data||l;let c=l.id,d=c&&i.h[c];d&&(d(l.msg),delete i.h[c])}if(this.worker=s,this.h=$s(),this.worker)return o?this.worker.on("message",u):this.worker.onmessage=u,t.config?new Promise(function(l){dR>1e9&&(dR=0),i.h[++dR]=function(){l(i)},i.worker.postMessage({id:dR,task:"init",factory:n,options:t})}):(this.priority=t.priority||4,this.encoder=e||null,this.worker.postMessage({task:"init",factory:n,options:t}),this)}if(!this||this.constructor!==pF)return new pF(t);let n=typeof self<"u"?self._factory:typeof window<"u"?window._factory:null;n&&(n=n.toString());let o=typeof window>"u",i=this,a=ahn(n,o,t.worker);return a.then?a.then(function(s){return r.call(i,s)}):r.call(this,a)}function fR(t){pF.prototype[t]=function(){let e=this,r=[].slice.call(arguments);var n=r[r.length-1];let o;return typeof n=="function"&&(o=n,r.pop()),n=new Promise(function(i){t==="export"&&typeof r[0]=="function"&&(r[0]=null),dR>1e9&&(dR=0),e.h[++dR]=i,e.worker.postMessage({task:t,id:dR,args:r})}),o?(n.then(o),this):n}}function ahn(t,e,r){return e?typeof module<"u"?new(Sze()).Worker(__dirname+"/worker/node.js"):Promise.resolve().then(()=>j(Sze())).then(function(n){return new n.Worker(_Ht.dirname+"/node/node.mjs")}):t?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ohn.toString()],{type:"text/javascript"}))):new window.Worker(typeof r=="string"?r:_Ht.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js"),{type:"module"})}function Pze(t,e,r,n,o,i){if(t=t[o],n===r.length-1)e[o]=i||t;else if(t)if(t.constructor===Array)for(e=e[o]=Array(t.length),o=0;o<t.length;o++)Pze(t,e,r,n,o);else e=e[o]||(e[o]=$s()),o=r[++n],Pze(t,e,r,n,o)}function Tze(t,e,r,n,o,i,a,s){if(t=t[a])if(n===e.length-1){if(t.constructor===Array){if(r[n]){for(e=0;e<t.length;e++)o.add(i,t[e],!0,!0);return}t=t.join(" ")}o.add(i,t,s,!0)}else if(t.constructor===Array)for(a=0;a<t.length;a++)Tze(t,e,r,n,o,i,a,s);else a=e[++n],Tze(t,e,r,n,o,i,a,s)}function Nze(t,e,r,n){if(!t.length)return t;if(t.length===1)return t=t[0],t=r||t.length>e?t.slice(r,r+e):t,n?b4.call(this,t):t;let o=[];for(let i=0,a,s;i<t.length;i++)if((a=t[i])&&(s=a.length)){if(r){if(r>=s){r-=s;continue}a=a.slice(r,r+e),s=a.length,r=0}if(s>e&&(a=a.slice(0,e),s=e),!o.length&&s>=e)return n?b4.call(this,a):a;if(o.push(a),e-=s,!e)break}return o=o.length>1?[].concat.apply([],o):o[0],n?b4.call(this,o):o}function Jde(t,e,r,n){var o=n[0];if(o[0]&&o[0].query)return t[e].apply(t,o);if(!(e!=="and"&&e!=="not"||t.result.length||t.await||o.suggest))return n.length>1&&(o=n[n.length-1]),(n=o.resolve)?t.await||t.result:t;let i=[],a=0,s=0,u,l,c,d,f;for(e=0;e<n.length;e++)if(o=n[e]){var p=void 0;if(o.constructor===da)p=o.await||o.result;else if(o.then||o.constructor===Array)p=o;else{a=o.limit||0,s=o.offset||0,c=o.suggest,l=o.resolve,u=((d=o.highlight||t.highlight)||o.enrich)&&l,p=o.queue;let h=o.async||p,m=o.index,g=o.query;if(m?t.index||(t.index=m):m=t.index,g||o.tag){let y=o.field||o.pluck;if(y&&(!g||t.query&&!d||(t.query=g,t.field=y,t.highlight=d),m=m.index.get(y)),p&&(f||t.await)){f=1;let _,w=t.C.length,S=new Promise(function(C){_=C});(function(C,E){S.h=function(){E.index=null,E.resolve=!1;let P=h?C.searchAsync(E):C.search(E);return P.then?P.then(function(T){return t.C[w]=T=T.result||T,_(T),T}):(P=P.result||P,_(P),P)}})(m,Object.assign({},o)),t.C.push(S),i[e]=S;continue}else o.resolve=!1,o.index=null,p=h?m.searchAsync(o):m.search(o),o.resolve=l,o.index=m}else if(o.and)p=Bde(o,"and",m);else if(o.or)p=Bde(o,"or",m);else if(o.not)p=Bde(o,"not",m);else if(o.xor)p=Bde(o,"xor",m);else continue}p.await?(f=1,p=p.await):p.then?(f=1,p=p.then(function(h){return h.result||h})):p=p.result||p,i[e]=p}if(f&&!t.await&&(t.await=new Promise(function(h){t.return=h})),f){let h=Promise.all(i).then(function(m){for(let g=0;g<t.C.length;g++)if(t.C[g]===h){t.C[g]=function(){return r.call(t,m,a,s,u,l,c,d)};break}jze(t)});t.C.push(h)}else if(t.await)t.C.push(function(){return r.call(t,i,a,s,u,l,c,d)});else return r.call(t,i,a,s,u,l,c,d);return l?t.await||t.result:t}function Bde(t,e,r){t=t[e];let n=t[0]||t;return n.index||(n.index=r),r=new da(n),t.length>1&&(r=r[e].apply(r,t.slice(1))),r}function shn(t,e,r,n,o,i,a){return t.length&&(this.result.length&&t.push(this.result),t.length<2?this.result=t[0]:(this.result=xHt(t,e,r,!1,this.h),r=0)),o&&(this.await=null),o?this.resolve(e,r,n,a):this}function uhn(t,e,r,n,o,i,a){if(!i&&!this.result.length)return o?this.result:this;let s;if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{let u=0;for(let l=0,c,d;l<t.length;l++)if((c=t[l])&&(d=c.length))u<d&&(u=d);else if(!i){u=0;break}u?(this.result=Hde(t,u,e,r,i,this.h,o),s=!0):this.result=[]}else i||(this.result=t);return o&&(this.await=null),o?this.resolve(e,r,n,a,s):this}function lhn(t,e,r,n,o,i,a){if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{e:{i=r;var s=this.h;let u=[],l=$s(),c=0;for(let d=0,f;d<t.length;d++)if(f=t[d]){c<f.length&&(c=f.length);for(let p=0,h;p<f.length;p++)if(h=f[p])for(let m=0,g;m<h.length;m++)g=h[m],l[g]=l[g]?2:1}for(let d=0,f,p=0;d<c;d++)for(let h=0,m;h<t.length;h++)if((m=t[h])&&(f=m[d])){for(let g=0,y;g<f.length;g++)if(y=f[g],l[y]===1)if(i)i--;else if(o){if(u.push(y),u.length===e){t=u;break e}}else{let _=d+(h?s:0);if(u[_]||(u[_]=[]),u[_].push(y),++p===e){t=u;break e}}}t=u}this.result=t,s=!0}else i||(this.result=t);return o&&(this.await=null),o?this.resolve(e,r,n,a,s):this}function chn(t,e,r,n,o,i,a){if(!i&&!this.result.length)return o?this.result:this;if(t.length&&this.result.length){e:{i=r;var s=[];t=new Set(t.flat().flat());for(let u=0,l,c=0;u<this.result.length;u++)if(l=this.result[u]){for(let d=0,f;d<l.length;d++)if(f=l[d],!t.has(f)){if(i)i--;else if(o){if(s.push(f),s.length===e){t=s;break e}}else if(s[u]||(s[u]=[]),s[u].push(f),++c===e){t=s;break e}}}t=s}this.result=t,s=!0}return o&&(this.await=null),o?this.resolve(e,r,n,a,s):this}function qde(t,e,r,n,o){let i,a,s;typeof o=="string"?(i=o,o=""):i=o.template,a=i.indexOf("$1"),s=i.substring(a+2),a=i.substring(0,a);let u=o&&o.boundary,l=!o||o.clip!==!1,c=o&&o.merge&&s&&a&&new RegExp(s+" "+a,"g");o=o&&o.ellipsis;var d=0;if(typeof o=="object"){var f=o.template;d=f.length-2,o=o.pattern}typeof o!="string"&&(o=o===!1?"":"..."),d&&(o=f.replace("$1",o)),f=o.length-d;let p,h;typeof u=="object"&&(p=u.before,p===0&&(p=-1),h=u.after,h===0&&(h=-1),u=u.total||9e5),d=new Map;for(let Y=0,ee,L,Q;Y<e.length;Y++){let z;if(n)z=e,Q=n;else{var m=e[Y];if(Q=m.field,!Q)continue;z=m.result}L=r.get(Q),ee=L.encoder,m=d.get(ee),typeof m!="string"&&(m=ee.encode(t),d.set(ee,m));for(let W=0;W<z.length;W++){var g=z[W].doc;if(!g||(g=dG(g,Q),!g))continue;var y=g.trim().split(/\s+/);if(!y.length)continue;g="";var _=[];let V=[];for(var w=-1,S=-1,C=0,E=0;E<y.length;E++){var P=y[E],T=ee.encode(P);T=T.length>1?T.join(" "):T[0];let q;if(T&&P){for(var I=P.length,N=(ee.split?P.replace(ee.split,""):P).length-T.length,M="",D=0,k=0;k<m.length;k++){var F=m[k];if(F){var K=F.length;K+=N,D&&K<=D||(F=T.indexOf(F),F>-1&&(M=(F?P.substring(0,F):"")+a+P.substring(F,F+K)+s+(F+K<I?P.substring(F+K):""),D=K,q=!0))}}M&&(u&&(w<0&&(w=g.length+(g?1:0)),S=g.length+(g?1:0)+M.length,C+=I,V.push(_.length),_.push({match:M})),g+=(g?" ":"")+M)}if(!q)P=y[E],g+=(g?" ":"")+P,u&&_.push({text:P});else if(u&&C>=u)break}if(C=V.length*(i.length-2),p||h||u&&g.length-C>u)if(C=u+C-f*2,E=S-w,p>0&&(E+=p),h>0&&(E+=h),E<=C)y=p?w-(p>0?p:0):w-((C-E)/2|0),_=h?S+(h>0?h:0):y+C,l||(y>0&&g.charAt(y)!==" "&&g.charAt(y-1)!==" "&&(y=g.indexOf(" ",y),y<0&&(y=0)),_<g.length&&g.charAt(_-1)!==" "&&g.charAt(_)!==" "&&(_=g.lastIndexOf(" ",_),_<S?_=S:++_)),g=(y?o:"")+g.substring(y,_)+(_<g.length?o:"");else{for(S=[],w={},C={},E={},P={},T={},M=N=I=0,k=D=1;;){var U=void 0;for(let q=0,H;q<V.length;q++){if(H=V[q],M)if(N!==M){if(E[q+1])continue;if(H+=M,w[H]){I-=f,C[q+1]=1,E[q+1]=1;continue}if(H>=_.length-1){if(H>=_.length){E[q+1]=1,H>=y.length&&(C[q+1]=1);continue}I-=f}if(g=_[H].text,K=h&&T[q])if(K>0){if(g.length>K)if(E[q+1]=1,l)g=g.substring(0,K);else continue;(K-=g.length)||(K=-1),T[q]=K}else{E[q+1]=1;continue}if(I+g.length+1<=u)g=" "+g,S[q]+=g;else if(l)U=u-I-1,U>0&&(g=" "+g.substring(0,U),S[q]+=g),E[q+1]=1;else{E[q+1]=1;continue}}else{if(E[q])continue;if(H-=N,w[H]){I-=f,E[q]=1,C[q]=1;continue}if(H<=0){if(H<0){E[q]=1,C[q]=1;continue}I-=f}if(g=_[H].text,K=p&&P[q])if(K>0){if(g.length>K)if(E[q]=1,l)g=g.substring(g.length-K);else continue;(K-=g.length)||(K=-1),P[q]=K}else{E[q]=1;continue}if(I+g.length+1<=u)g+=" ",S[q]=g+S[q];else if(l)U=g.length+1-(u-I),U>=0&&U<g.length&&(g=g.substring(U)+" ",S[q]=g+S[q]),E[q]=1;else{E[q]=1;continue}}else{g=_[H].match,p&&(P[q]=p),h&&(T[q]=h),q&&I++;let G;if(H?!q&&f&&(I+=f):(C[q]=1,E[q]=1),H>=y.length-1||H<_.length-1&&_[H+1].match?G=1:f&&(I+=f),I-=i.length-2,!q||I+g.length<=u)S[q]=g;else{U=D=k=C[q]=0;break}G&&(C[q+1]=1,E[q+1]=1)}I+=g.length,U=w[H]=1}if(U)N===M?M++:N++;else{if(N===M?D=0:k=0,!D&&!k)break;D?(N++,M=N):M++}}g="";for(let q=0,H;q<S.length;q++)H=(q&&C[q]?" ":(q&&!o?" ":"")+o)+S[q],g+=H;o&&!C[S.length]&&(g+=o)}c&&(g=g.replace(c," ")),z[W].highlight=g}if(n)break}return e}function da(t,e){if(!this||this.constructor!==da)return new da(t,e);let r=0,n,o,i,a,s,u;if(t&&t.index){let l=t;if(e=l.index,r=l.boost||0,o=l.query){i=l.field||l.pluck,a=l.highlight;let c=l.resolve;t=l.async||l.queue,l.resolve=!1,l.index=null,t=t?e.searchAsync(l):e.search(l),l.resolve=c,l.index=e,t=t.result||t}else t=[]}if(t&&t.then){let l=this;t=t.then(function(c){l.C[0]=l.result=c.result||c,jze(l)}),n=[t],t=[],s=new Promise(function(c){u=c})}this.index=e||null,this.result=t||[],this.h=r,this.C=n||[],this.await=s||null,this.return=u||null,this.highlight=a||null,this.query=o||"",this.field=i||""}function jze(t,e){let r=t.result;var n=t.await;t.await=null;for(let o=0,i;o<t.C.length;o++)if(i=t.C[o]){if(typeof i=="function")r=i(),t.C[o]=r=r.result||r,o--;else if(i.h)r=i.h(),t.C[o]=r=r.result||r,o--;else if(i.then)return t.await=n}return n=t.return,t.C=[],t.return=null,e||n(r),r}function Hde(t,e,r,n,o,i,a){let s=t.length,u=[],l,c;l=$s();for(let d=0,f,p,h,m;d<e;d++)for(let g=0;g<s;g++)if(h=t[g],d<h.length&&(f=h[d]))for(let y=0;y<f.length;y++){if(p=f[y],(c=l[p])?l[p]++:(c=0,l[p]=1),m=u[c]||(u[c]=[]),!a){let _=d+(g||!o?0:i||0);m=m[_]||(m[_]=[])}if(m.push(p),a&&r&&c===s-1&&m.length-n===r)return n?m.slice(n):m}if(t=u.length)if(o)u=u.length>1?xHt(u,r,n,a,i):(u=u[0])&&r&&u.length>r||n?u.slice(n,r+n):u;else{if(t<s)return[];if(u=u[t-1],r||n)if(a)(u.length>r||n)&&(u=u.slice(n,r+n));else{o=[];for(let d=0,f;d<u.length;d++)if(f=u[d]){if(n&&f.length>n)n-=f.length;else if((r&&f.length>r||n)&&(f=f.slice(n,r+n),r-=f.length,n&&(n-=f.length)),o.push(f),!r)break}u=o}}return u}function xHt(t,e,r,n,o){let i=[],a=$s(),s;var u=t.length;let l;if(n){for(o=u-1;o>=0;o--)if(l=(n=t[o])&&n.length){for(u=0;u<l;u++)if(s=n[u],!a[s]){if(a[s]=1,r)r--;else if(i.push(s),i.length===e)return i}}}else for(let c=u-1,d,f=0;c>=0;c--){d=t[c];for(let p=0;p<d.length;p++)if(l=(n=d[p])&&n.length){for(let h=0;h<l;h++)if(s=n[h],!a[s])if(a[s]=1,r)r--;else{let m=(p+(c<u-1&&o||0))/(c+1)|0;if((i[m]||(i[m]=[])).push(s),++f===e)return i}}}return i}function dhn(t,e,r){let n=$s(),o=[];for(let i=0,a;i<e.length;i++){a=e[i];for(let s=0;s<a.length;s++)n[a[s]]=1}if(r)for(let i=0,a;i<t.length;i++)a=t[i],n[a]&&(o.push(a),n[a]=0);else for(let i=0,a,s;i<t.result.length;i++)for(a=t.result[i],e=0;e<a.length;e++)s=a[e],n[s]&&((o[i]||(o[i]=[])).push(s),n[s]=0);return o}function mHt(t){let e=[],r=$s(),n=$s();for(let o=0,i,a,s,u,l,c,d;o<t.length;o++){i=t[o],a=i.field,s=i.result;for(let f=0;f<s.length;f++)l=s[f],typeof l!="object"?l={id:u=l}:u=l.id,(c=r[u])?c.push(a):(l.field=r[u]=[a],e.push(l)),(d=l.highlight)&&(c=n[u],c||(n[u]=c={},l.highlight=c),c[a]=d)}return e}function fhn(t,e,r,n,o){return t=this.tag.get(t),t?(t=t.get(e),t?(e=t.length-n,e>0&&((r&&e>r||n)&&(t=t.slice(n,n+r)),o&&(t=b4.call(this,t))),t):[]):[]}function b4(t){if(!this||!this.store)return t;if(this.db)return this.index.get(this.field[0]).db.enrich(t);let e=Array(t.length);for(let r=0,n;r<t.length;r++)n=t[r],e[r]={id:n,doc:this.store.get(n)};return e}function mF(t){if(!this||this.constructor!==mF)return new mF(t);let e=t.document||t.doc||t,r,n;if(this.B=[],this.field=[],this.D=[],this.key=(r=e.key||e.id)&&Vde(r,this.D)||"id",(n=t.keystore||0)&&(this.keystore=n),this.fastupdate=!!t.fastupdate,this.reg=!this.fastupdate||t.worker||t.db?n?new __(n):new Set:n?new b_(n):new Map,this.h=(r=e.store||null)&&r&&r!==!0&&[],this.store=r?n?new b_(n):new Map:null,this.cache=(r=t.cache||null)&&new hF(r),t.cache=!1,this.worker=t.worker||!1,this.priority=t.priority||4,this.index=phn.call(this,t,e),this.tag=null,(r=e.tag)&&(typeof r=="string"&&(r=[r]),r.length)){this.tag=new Map,this.A=[],this.F=[];for(let o=0,i,a;o<r.length;o++){if(i=r[o],a=i.field||i,!a)throw Error("The tag field from the document descriptor is undefined.");i.custom?this.A[o]=i.custom:(this.A[o]=Vde(a,this.D),i.filter&&(typeof this.A[o]=="string"&&(this.A[o]=new String(this.A[o])),this.A[o].G=i.filter)),this.F[o]=a,this.tag.set(a,new Map)}}if(this.worker){this.fastupdate=!1,t=[];for(let o of this.index.values())o.then&&t.push(o);if(t.length){let o=this;return Promise.all(t).then(function(i){let a=0;for(let s of o.index.entries()){let u=s[0],l=s[1];l.then&&(l=i[a],o.index.set(u,l),a++)}return o})}}else t.db&&(this.fastupdate=!1,this.mount(t.db))}function phn(t,e){let r=new Map,n=e.index||e.field||e;y_(n)&&(n=[n]);for(let i=0,a,s;i<n.length;i++){if(a=n[i],y_(a)||(s=a,a=a.field),s=cG(s)?Object.assign({},t,s):t,this.worker){var o=void 0;o=(o=s.encoder)&&o.encode?o:new _4(typeof o=="string"?Mze[o]:o||{}),o=new pF(s,o),r.set(a,o)}this.worker||r.set(a,new v_(s,this.reg)),s.custom?this.B[i]=s.custom:(this.B[i]=Vde(a,this.D),s.filter&&(typeof this.B[i]=="string"&&(this.B[i]=new String(this.B[i])),this.B[i].G=s.filter)),this.field[i]=a}if(this.h){t=e.store,y_(t)&&(t=[t]);for(let i=0,a,s;i<t.length;i++)a=t[i],s=a.field||a,a.custom?(this.h[i]=a.custom,a.custom.O=s):(this.h[i]=Vde(s,this.D),a.filter&&(typeof this.h[i]=="string"&&(this.h[i]=new String(this.h[i])),this.h[i].G=a.filter))}return r}function Vde(t,e){let r=t.split(":"),n=0;for(let o=0;o<r.length;o++)t=r[o],t[t.length-1]==="]"&&(t=t.substring(0,t.length-2))&&(e[n]=!0),t&&(r[n++]=t);return n<r.length&&(r.length=n),n>1?r:r[0]}function Dze(t,e=0){let r=[],n=[];e&&(e=25e4/e*5e3|0);for(let o of t.entries())n.push(o),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function Lze(t,e){e||(e=new Map);for(let r=0,n;r<t.length;r++)n=t[r],e.set(n[0],n[1]);return e}function SHt(t,e=0){let r=[],n=[];e&&(e=25e4/e*1e3|0);for(let o of t.entries())n.push([o[0],Dze(o[1])[0]]),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function CHt(t,e){e||(e=new Map);for(let r=0,n,o;r<t.length;r++)n=t[r],o=e.get(n[0]),e.set(n[0],Lze(n[1],o));return e}function OHt(t){let e=[],r=[];for(let n of t.keys())r.push(n),r.length===25e4&&(e.push(r),r=[]);return r.length&&e.push(r),e}function EHt(t,e){e||(e=new Set);for(let r=0;r<t.length;r++)e.add(t[r]);return e}function Wde(t,e,r,n,o,i,a=0){let s=n&&n.constructor===Array;var u=s?n.shift():n;if(!u)return this.export(t,e,o,i+1);if((u=t((e?e+".":"")+(a+1)+"."+r,JSON.stringify(u)))&&u.then){let l=this;return u.then(function(){return Wde.call(l,t,e,r,s?n:null,o,i,a+1)})}return Wde.call(this,t,e,r,s?n:null,o,i,a+1)}function mhn(t,e,r=0,n=0){if(r<this.field.length){let a=this.field[r];if((e=this.index.get(a).export(t,a,r,n=1))&&e.then){let s=this;return e.then(function(){return s.export(t,a,r+1)})}return this.export(t,a,r+1)}let o,i;switch(n){case 0:o="reg",i=OHt(this.reg),e=null;break;case 1:o="tag",i=this.tag&&SHt(this.tag,this.reg.size),e=null;break;case 2:o="doc",i=this.store&&Dze(this.store),e=null;break;default:return}return Wde.call(this,t,e,o,i||null,r,n)}function hhn(t,e){var r=t.split(".");r[r.length-1]==="json"&&r.pop();let n=r.length>2?r[0]:"";if(r=r.length>2?r[2]:r[1],this.worker&&n)return this.index.get(n).import(t);if(e){if(typeof e=="string"&&(e=JSON.parse(e)),n)return this.index.get(n).import(r,e);switch(r){case"reg":this.fastupdate=!1,this.reg=EHt(e,this.reg);for(let o=0,i;o<this.field.length;o++)i=this.index.get(this.field[o]),i.fastupdate=!1,i.reg=this.reg;if(this.worker){e=[];for(let o of this.index.values())e.push(o.import(t));return Promise.all(e)}break;case"tag":this.tag=CHt(e,this.tag);break;case"doc":this.store=Lze(e,this.store)}}}function hHt(t,e){let r="";for(let n of t.entries()){t=n[0];let o=n[1],i="";for(let a=0,s;a<o.length;a++){s=o[a]||[""];let u="";for(let l=0;l<s.length;l++)u+=(u?",":"")+(e==="string"?'"'+s[l]+'"':s[l]);u="["+u+"]",i+=(i?",":"")+u}i='["'+t+'",['+i+"]]",r+=(r?",":"")+i}return r}function fG(t,e){let r=0;var n=typeof e>"u";if(t.constructor===Array){for(let o=0,i,a,s;o<t.length;o++)if((i=t[o])&&i.length){if(n)return 1;if(a=i.indexOf(e),a>=0){if(i.length>1)return i.splice(a,1),1;if(delete t[o],r)return 1;s=1}else{if(s)return 1;r++}}}else for(let o of t.entries())n=o[0],fG(o[1],e)?r++:t.delete(n);return r}function zP(t,e,r,n,o,i,a){let s,u;if(!(s=e[r])||a&&!s[a]){if(a?(e=s||(e[r]=$s()),e[a]=1,u=t.ctx,(s=u.get(a))?u=s:u.set(a,u=t.keystore?new b_(t.keystore):new Map)):(u=t.map,e[r]=1),(s=u.get(r))?u=s:u.set(r,u=s=[]),i){for(let l=0,c;l<s.length;l++)if((c=s[l])&&c.includes(o)){if(l<=n)return;c.splice(c.indexOf(o),1),t.fastupdate&&(e=t.reg.get(o))&&e.splice(e.indexOf(c),1);break}}if(u=u[n]||(u[n]=[]),u.push(o),u.length===2**31-1){if(e=new v4(u),t.fastupdate)for(let l of t.reg.values())l.includes(u)&&(l[l.indexOf(u)]=e);s[n]=u=e}t.fastupdate&&((n=t.reg.get(o))?n.push(u):t.reg.set(o,[u]))}}function zde(t,e,r,n,o){return r&&t>1?e+(n||0)<=t?r+(o||0):(t-1)/(e+(n||0))*(r+(o||0))+1|0:0}function gHt(t,e,r,n,o,i,a){let s=t.length,u=t;if(s>1)u=Hde(t,e,r,n,o,i,a);else if(s===1)return a?Nze.call(null,t[0],r,n):new da(t[0],this);return a?u:new da(u,this)}function yHt(t,e,r,n,o,i,a){return t=Aze(this,t,e,r,n,o,i,a),this.db?t.then(function(s){return o?s||[]:new da(s,this)}):t&&t.length?o?Nze.call(this,t,r,n):new da(t,this):o?[]:new da([],this)}function bHt(t,e,r,n){let o=[];if(t&&t.length){if(t.length<=n){e.push(t);return}for(let i=0,a;i<n;i++)(a=t[i])&&(o[i]=a);if(o.length){e.push(o);return}}if(!r)return o}function Aze(t,e,r,n,o,i,a,s){let u;return r&&(u=t.bidirectional&&e>r)&&(u=r,r=e,e=u),t.db?t.db.get(e,r,n,o,i,a,s):(t=r?(t=t.ctx.get(r))&&t.get(e):t.map.get(e),t)}function v_(t,e){if(!this||this.constructor!==v_)return new v_(t);if(t){var r=y_(t)?t:t.preset;r&&(t=Object.assign({},ghn[r],t))}else t={};r=t.context;let n=r===!0?{depth:1}:r||{},o=y_(t.encoder)?Mze[t.encoder]:t.encode||t.encoder||{};this.encoder=o.encode?o:typeof o=="object"?new _4(o):{encode:o},this.resolution=t.resolution||9,this.tokenize=r=(r=t.tokenize)&&r!=="default"&&r!=="exact"&&r||"strict",this.depth=r==="strict"&&n.depth||0,this.bidirectional=n.bidirectional!==!1,this.fastupdate=!!t.fastupdate,this.score=t.score||null,(r=t.keystore||0)&&(this.keystore=r),this.map=r?new b_(r):new Map,this.ctx=r?new b_(r):new Map,this.reg=e||(this.fastupdate?r?new b_(r):new Map:r?new __(r):new Set),this.N=n.resolution||3,this.rtl=o.rtl||t.rtl||!1,this.cache=(r=t.cache||null)&&new hF(r),this.resolve=t.resolve!==!1,(r=t.db)&&(this.db=this.mount(r)),this.M=t.commit!==!1,this.commit_task=[],this.commit_timer=null,this.priority=t.priority||4}function PHt(t){t.commit_timer||(t.commit_timer=setTimeout(function(){t.commit_timer=null,t.db.commit(t)},1))}function Gde(t,e={}){if(!this||this.constructor!==Gde)return new Gde(t,e);typeof t=="object"&&(e=t,t=t.name),t||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(t?":"+t.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=e.field?e.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=e.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}function Oze(t,e,r){let n=t.value,o,i=0;for(let a=0,s;a<n.length;a++){if(s=r?n:n[a]){for(let u=0,l,c;u<e.length;u++)if(c=e[u],l=s.indexOf(c),l>=0)if(o=1,s.length>1)s.splice(l,1);else{n[a]=[];break}i+=s.length}if(r)break}i?o&&t.update(n):t.delete(),t.continue()}function pR(t,e){return new Promise((r,n)=>{t.onsuccess=t.oncomplete=function(){e&&e(this.result),e=null,r(this.result)},t.onerror=t.onblocked=n,t=null})}var _Ht,kt,ehn,thn,rhn,nhn,sHt,uHt,$de,Cze,lHt,cHt,dHt,Mze,g4,lG,Eze,pHt,Ude,dR,ghn,THt,Kde,dF,AHt,IHt=b(()=>{_Ht={};ehn=/[^\p{L}\p{N}]+/u,thn=/(\d{3})/g,rhn=/(\D)(\d{3})/g,nhn=/(\d{3})(\D)/g,sHt=/[\u0300-\u036f]/g;kt=_4.prototype;kt.assign=function(t){this.normalize=Vd(t.normalize,!0,this.normalize);let e=t.include,r=e||t.exclude||t.split,n;if(r||r===""){if(typeof r=="object"&&r.constructor!==RegExp){let o="";n=!e,e||(o+="\\p{Z}"),r.letter&&(o+="\\p{L}"),r.number&&(o+="\\p{N}",n=!!e),r.symbol&&(o+="\\p{S}"),r.punctuation&&(o+="\\p{P}"),r.control&&(o+="\\p{C}"),(r=r.char)&&(o+=typeof r=="object"?r.join(""):r);try{this.split=new RegExp("["+(e?"^":"")+o+"]+","u")}catch{this.split=/\s+/}}else this.split=r,n=r===!1||"a1a".split(r).length<2;this.numeric=Vd(t.numeric,n)}else{try{this.split=Vd(this.split,ehn)}catch{this.split=/\s+/}this.numeric=Vd(t.numeric,Vd(this.numeric,!0))}if(this.prepare=Vd(t.prepare,null,this.prepare),this.finalize=Vd(t.finalize,null,this.finalize),r=t.filter,this.filter=typeof r=="function"?r:Vd(r&&new Set(r),null,this.filter),this.dedupe=Vd(t.dedupe,!0,this.dedupe),this.matcher=Vd((r=t.matcher)&&new Map(r),null,this.matcher),this.mapper=Vd((r=t.mapper)&&new Map(r),null,this.mapper),this.stemmer=Vd((r=t.stemmer)&&new Map(r),null,this.stemmer),this.replacer=Vd(t.replacer,null,this.replacer),this.minlength=Vd(t.minlength,1,this.minlength),this.maxlength=Vd(t.maxlength,1024,this.maxlength),this.rtl=Vd(t.rtl,!1,this.rtl),(this.cache=r=Vd(t.cache,!0,this.cache))&&(this.F=null,this.L=typeof r=="number"?r:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(let o of this.matcher.keys())this.h+=(this.h?"|":"")+o;if(this.stemmer)for(let o of this.stemmer.keys())this.A+=(this.A?"|":"")+o;return this};kt.addStemmer=function(t,e){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(t,e),this.A+=(this.A?"|":"")+t,this.K=null,this.cache&&fF(this),this};kt.addFilter=function(t){return typeof t=="function"?this.filter=t:(this.filter||(this.filter=new Set),this.filter.add(t)),this.cache&&fF(this),this};kt.addMapper=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length>1?this.addMatcher(t,e):(this.mapper||(this.mapper=new Map),this.mapper.set(t,e),this.cache&&fF(this),this)};kt.addMatcher=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length<2&&(this.dedupe||this.mapper)?this.addMapper(t,e):(this.matcher||(this.matcher=new Map),this.matcher.set(t,e),this.h+=(this.h?"|":"")+t,this.J=null,this.cache&&fF(this),this)};kt.addReplacer=function(t,e){return typeof t=="string"?this.addMatcher(t,e):(this.replacer||(this.replacer=[]),this.replacer.push(t,e),this.cache&&fF(this),this)};kt.encode=function(t,e){if(this.cache&&t.length<=this.H)if(this.F){if(this.B.has(t))return this.B.get(t)}else this.F=setTimeout(fF,50,this);this.normalize&&(typeof this.normalize=="function"?t=this.normalize(t):t=sHt?t.normalize("NFKD").replace(sHt,"").toLowerCase():t.toLowerCase()),this.prepare&&(t=this.prepare(t)),this.numeric&&t.length>3&&(t=t.replace(rhn,"$1 $2").replace(nhn,"$1 $2").replace(thn,"$1 "));let r=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer),n=[],o=$s(),i,a,s=this.split||this.split===""?t.split(this.split):[t];for(let l=0,c,d;l<s.length;l++)if((c=d=s[l])&&!(c.length<this.minlength||c.length>this.maxlength)){if(e){if(o[c])continue;o[c]=1}else{if(i===c)continue;i=c}if(r)n.push(c);else if(!this.filter||(typeof this.filter=="function"?this.filter(c):!this.filter.has(c))){if(this.cache&&c.length<=this.I)if(this.F){var u=this.D.get(c);if(u||u===""){u&&n.push(u);continue}}else this.F=setTimeout(fF,50,this);if(this.stemmer){this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));let f;for(;f!==c&&c.length>2;)f=c,c=c.replace(this.K,p=>this.stemmer.get(p))}if(c&&(this.mapper||this.dedupe&&c.length>1)){u="";for(let f=0,p="",h,m;f<c.length;f++)h=c.charAt(f),h===p&&this.dedupe||((m=this.mapper&&this.mapper.get(h))||m===""?m===p&&this.dedupe||!(p=m)||(u+=m):u+=p=h);c=u}if(this.matcher&&c.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),c=c.replace(this.J,f=>this.matcher.get(f))),c&&this.replacer)for(u=0;c&&u<this.replacer.length;u+=2)c=c.replace(this.replacer[u],this.replacer[u+1]);if(this.cache&&d.length<=this.I&&(this.D.set(d,c),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),c){if(c!==d)if(e){if(o[c])continue;o[c]=1}else{if(a===c)continue;a=c}n.push(c)}}}return this.finalize&&(n=this.finalize(n)||n),this.cache&&t.length<=this.H&&(this.B.set(t,n),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),n};hF.prototype.set=function(t,e){this.cache.set(this.h=t,e),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};hF.prototype.get=function(t){let e=this.cache.get(t);return e&&this.h!==t&&(this.cache.delete(t),this.cache.set(this.h=t,e)),e};hF.prototype.remove=function(t){for(let e of this.cache){let r=e[0];e[1].includes(t)&&this.cache.delete(r)}};hF.prototype.clear=function(){this.cache.clear(),this.h=""};uHt={normalize:!1,numeric:!1,dedupe:!1},$de={},Cze=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),lHt=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),cHt=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],dHt={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,\u00DF:2,d:3,t:3,l:4,m:5,n:5,r:6},Mze={Exact:uHt,Default:$de,Normalize:$de,LatinBalance:{mapper:Cze},LatinAdvanced:{mapper:Cze,matcher:lHt,replacer:cHt},LatinExtra:{mapper:Cze,replacer:cHt.concat([/(?!^)[aeo]/g,""]),matcher:lHt},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(t){for(let r=0;r<t.length;r++){var e=t[r];let n=e.charAt(0),o=dHt[n];for(let i=1,a;i<e.length&&(a=e.charAt(i),a==="h"||a==="w"||!(a=dHt[a])||a===o||(n+=a,o=a,n.length!==4));i++);t[r]=n}}},CJK:{split:""},LatinExact:uHt,LatinDefault:$de,LatinSimple:$de};v4.prototype.clear=function(){this.index.length=0};v4.prototype.push=function(){};b_.prototype.get=function(t){let e=this.index[this.B(t)];return e&&e.get(t)};b_.prototype.set=function(t,e){var r=this.B(t);let n=this.index[r];n?(r=n.size,n.set(t,e),(r-=n.size)&&this.size++):(this.index[r]=n=new Map([[t,e]]),this.h.push(n),this.size++)};__.prototype.add=function(t){var e=this.B(t);let r=this.index[e];r?(e=r.size,r.add(t),(e-=r.size)&&this.size++):(this.index[e]=r=new Set([t]),this.h.push(r),this.size++)};kt=b_.prototype;kt.has=__.prototype.has=function(t){let e=this.index[this.B(t)];return e&&e.has(t)};kt.delete=__.prototype.delete=function(t){let e=this.index[this.B(t)];e&&e.delete(t)&&this.size--};kt.clear=__.prototype.clear=function(){this.index=$s(),this.h=[],this.size=0};kt.values=__.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].values())yield e};kt.keys=__.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].keys())yield e};kt.entries=__.prototype.entries=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].entries())yield e};dR=0;fR("add");fR("append");fR("search");fR("update");fR("remove");fR("clear");fR("export");fR("import");pF.prototype.searchCache=Ize;Rze(pF.prototype);mF.prototype.add=function(t,e,r){if(cG(t)&&(e=t,t=dG(e,this.key)),e&&(t||t===0)){if(!r&&this.reg.has(t))return this.update(t,e);for(let s=0,u;s<this.field.length;s++){u=this.B[s];var n=this.index.get(this.field[s]);if(typeof u=="function"){var o=u(e);o&&n.add(t,o,r,!0)}else o=u.G,(!o||o(e))&&(u.constructor===String?u=[""+u]:y_(u)&&(u=[u]),Tze(e,u,this.D,0,n,t,u[0],r))}if(this.tag)for(n=0;n<this.A.length;n++){var i=this.A[n];o=this.tag.get(this.F[n]);let s=$s();if(typeof i=="function"){if(i=i(e),!i)continue}else{var a=i.G;if(a&&!a(e))continue;i.constructor===String&&(i=""+i),i=dG(e,i)}if(o&&i){y_(i)&&(i=[i]);for(let u=0,l,c;u<i.length;u++)if(l=i[u],!s[l]&&(s[l]=1,(a=o.get(l))?c=a:o.set(l,c=[]),!r||!c.includes(t))){if(c.length===2**31-1){if(a=new v4(c),this.fastupdate)for(let d of this.reg.values())d.includes(c)&&(d[d.indexOf(c)]=a);o.set(l,c=a)}c.push(t),this.fastupdate&&((a=this.reg.get(t))?a.push(c):this.reg.set(t,[c]))}}}if(this.store&&(!r||!this.store.has(t))){let s;if(this.h){s=$s();for(let u=0,l;u<this.h.length;u++){if(l=this.h[u],(r=l.G)&&!r(e))continue;let c;if(typeof l=="function"){if(c=l(e),!c)continue;l=[l.O]}else if(y_(l)||l.constructor===String){s[l]=e[l];continue}Pze(e,s,l,0,l[0],c)}}this.store.set(t,s||e)}this.worker&&(this.fastupdate||this.reg.add(t))}return this};da.prototype.or=function(){return Jde(this,"or",shn,arguments)};da.prototype.and=function(){return Jde(this,"and",uhn,arguments)};da.prototype.xor=function(){return Jde(this,"xor",lhn,arguments)};da.prototype.not=function(){return Jde(this,"not",chn,arguments)};kt=da.prototype;kt.limit=function(t){if(this.await){let e=this;this.C.push(function(){return e.limit(t).result})}else if(this.result.length){let e=[];for(let r=0,n;r<this.result.length;r++)if(n=this.result[r])if(n.length<=t){if(e[r]=n,t-=n.length,!t)break}else{e[r]=n.slice(0,t);break}this.result=e}return this};kt.offset=function(t){if(this.await){let e=this;this.C.push(function(){return e.offset(t).result})}else if(this.result.length){let e=[];for(let r=0,n;r<this.result.length;r++)(n=this.result[r])&&(n.length<=t?t-=n.length:(e[r]=n.slice(t),t=0));this.result=e}return this};kt.boost=function(t){if(this.await){let e=this;this.C.push(function(){return e.boost(t).result})}else this.h+=t;return this};kt.resolve=function(t,e,r,n,o){let i=this.await?jze(this,!0):this.result;if(i.then){let a=this;return i.then(function(){return a.resolve(t,e,r,n,o)})}return i.length&&(typeof t=="object"?(n=t.highlight||this.highlight,r=!!n||t.enrich,e=t.offset,t=t.limit):(n=n||this.highlight,r=!!n||r),i=o?r?b4.call(this.index,i):i:Nze.call(this.index,i,t||100,e,r)),this.finalize(i,n)};kt.finalize=function(t,e){if(t.then){let n=this;return t.then(function(o){return n.finalize(o,e)})}e&&t.length&&this.query&&(t=qde(this.query,t,this.index.index,this.field,e));let r=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",r&&r(t),t};$s();mF.prototype.search=function(t,e,r,n){r||(!e&&cG(t)?(r=t,t=""):cG(e)&&(r=e,e=0));let o=[];var i=[];let a,s,u,l,c,d,f=0,p=!0,h;if(r){r.constructor===Array&&(r={index:r}),t=r.query||t,a=r.pluck,s=r.merge,l=r.boost,d=a||r.field||(d=r.index)&&(d.index?null:d);var m=this.tag&&r.tag;u=r.suggest,p=r.resolve!==!1,c=r.cache,h=p&&this.store&&r.highlight;var g=!!h||p&&this.store&&r.enrich;e=r.limit||e;var y=r.offset||0;if(e||(e=p?100:0),m&&(!this.db||!n)){m.constructor!==Array&&(m=[m]);var _=[];for(let P=0,T;P<m.length;P++)if(T=m[P],T.field&&T.tag){var w=T.tag;if(w.constructor===Array)for(var S=0;S<w.length;S++)_.push(T.field,w[S]);else _.push(T.field,w)}else{w=Object.keys(T);for(let I=0,N,M;I<w.length;I++)if(N=w[I],M=T[N],M.constructor===Array)for(S=0;S<M.length;S++)_.push(N,M[S]);else _.push(N,M)}if(m=_,!t){if(i=[],_.length)for(m=0;m<_.length;m+=2){if(this.db){if(n=this.index.get(_[m]),!n)continue;i.push(n=n.db.tag(_[m+1],e,y,g))}else n=fhn.call(this,_[m],_[m+1],e,y,g);o.push(p?{field:_[m],tag:_[m+1],result:n}:[n])}if(i.length){let P=this;return Promise.all(i).then(function(T){for(let I=0;I<T.length;I++)p?o[I].result=T[I]:o[I]=T[I];return p?o:new da(o.length>1?Hde(o,1,0,0,u,l):o[0],P)})}return p?o:new da(o.length>1?Hde(o,1,0,0,u,l):o[0],this)}}p||a||!(d=d||this.field)||(y_(d)?a=d:(d.constructor===Array&&d.length===1&&(d=d[0]),a=d.field||d.index)),d&&d.constructor!==Array&&(d=[d])}d||(d=this.field);let C;_=(this.worker||this.db)&&!n&&[];for(let P=0,T,I,N;P<d.length;P++){if(I=d[P],this.db&&this.tag&&!this.B[P])continue;let M;if(y_(I)||(M=I,I=M.field,t=M.query||t,e=h4(M.limit,e),y=h4(M.offset,y),u=h4(M.suggest,u),h=p&&this.store&&h4(M.highlight,h),g=!!h||p&&this.store&&h4(M.enrich,g),c=h4(M.cache,c)),n)T=n[P];else{w=M||r||{},S=w.enrich;var E=this.index.get(I);if(m&&(this.db&&(w.tag=m,C=E.db.support_tag_search,w.field=d),!C&&S&&(w.enrich=!1)),T=c?E.searchCache(t,e,w):E.search(t,e,w),S&&(w.enrich=S),_){_[P]=T;continue}}if(N=(T=T.result||T)&&T.length,m&&N){if(w=[],S=0,this.db&&n){if(!C)for(E=d.length;E<n.length;E++){let D=n[E];if(D&&D.length)S++,w.push(D);else if(!u)return p?o:new da(o,this)}}else for(let D=0,k,F;D<m.length;D+=2){if(k=this.tag.get(m[D]),!k){if(u)continue;return p?o:new da(o,this)}if(F=(k=k&&k.get(m[D+1]))&&k.length)S++,w.push(k);else if(!u)return p?o:new da(o,this)}if(S){if(T=dhn(T,w,p),N=T.length,!N&&!u)return p?T:new da(T,this);S--}}if(N)i[f]=I,o.push(T),f++;else if(d.length===1)return p?o:new da(o,this)}if(_){if(this.db&&m&&m.length&&!C)for(g=0;g<m.length;g+=2){if(i=this.index.get(m[g]),!i){if(u)continue;return p?o:new da(o,this)}_.push(i.db.tag(m[g+1],e,y,!1))}let P=this;return Promise.all(_).then(function(T){return r&&(r.resolve=p),T.length&&(T=P.search(t,e,r,T)),T})}if(!f)return p?o:new da(o,this);if(a&&(!g||!this.store))return o=o[0],p?o:new da(o,this);for(_=[],y=0;y<i.length;y++){if(m=o[y],g&&m.length&&typeof m[0].doc>"u"&&(this.db?_.push(m=this.index.get(this.field[0]).db.enrich(m)):m=b4.call(this,m)),a)return p?h?qde(t,m,this.index,a,h):m:new da(m,this);o[y]={field:i[y],result:m}}if(g&&this.db&&_.length){let P=this;return Promise.all(_).then(function(T){for(let I=0;I<T.length;I++)o[I].result=T[I];return h&&(o=qde(t,o,P.index,a,h)),s?mHt(o):o})}return h&&(o=qde(t,o,this.index,a,h)),s?mHt(o):o};kt=mF.prototype;kt.mount=function(t){let e=this.field;if(this.tag)for(let i=0,a;i<this.F.length;i++){a=this.F[i];var r=void 0;this.index.set(a,r=new v_({},this.reg)),e===this.field&&(e=e.slice(0)),e.push(a),r.tag=this.tag.get(a)}r=[];let n={db:t.db,type:t.type,fastupdate:t.fastupdate};for(let i=0,a,s;i<e.length;i++){n.field=s=e[i],a=this.index.get(s);let u=new t.constructor(t.id,n);u.id=t.id,r[i]=u.mount(a),a.document=!0,i?a.bypass=!0:a.store=this.store}let o=this;return this.db=Promise.all(r).then(function(){o.db=!0})};kt.commit=async function(){let t=[];for(let e of this.index.values())t.push(e.commit());await Promise.all(t),this.reg.clear()};kt.destroy=function(){let t=[];for(let e of this.index.values())t.push(e.destroy());return Promise.all(t)};kt.append=function(t,e){return this.add(t,e,!0)};kt.update=function(t,e){return this.remove(t).add(t,e)};kt.remove=function(t){cG(t)&&(t=dG(t,this.key));for(var e of this.index.values())e.remove(t,!0);if(this.reg.has(t)){if(this.tag&&!this.fastupdate)for(let r of this.tag.values())for(let n of r){e=n[0];let o=n[1],i=o.indexOf(t);i>-1&&(o.length>1?o.splice(i,1):r.delete(e))}this.store&&this.store.delete(t),this.reg.delete(t)}return this.cache&&this.cache.remove(t),this};kt.clear=function(){let t=[];for(let e of this.index.values()){let r=e.clear();r.then&&t.push(r)}if(this.tag)for(let e of this.tag.values())e.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),t.length?Promise.all(t):this};kt.contain=function(t){return this.db?this.index.get(this.field[0]).db.has(t):this.reg.has(t)};kt.cleanup=function(){for(let t of this.index.values())t.cleanup();return this};kt.get=function(t){return this.db?this.index.get(this.field[0]).db.enrich(t).then(function(e){return e[0]&&e[0].doc||null}):this.store.get(t)||null};kt.set=function(t,e){return typeof t=="object"&&(e=t,t=dG(e,this.key)),this.store.set(t,e),this};kt.searchCache=Ize;kt.export=mhn;kt.import=hhn;Rze(mF.prototype);v_.prototype.remove=function(t,e){let r=this.reg.size&&(this.fastupdate?this.reg.get(t):this.reg.has(t));if(r){if(this.fastupdate){for(let n=0,o,i;n<r.length;n++)if((o=r[n])&&(i=o.length))if(o[i-1]===t)o.pop();else{let a=o.indexOf(t);a>=0&&o.splice(a,1)}}else fG(this.map,t),this.depth&&fG(this.ctx,t);e||this.reg.delete(t)}return this.db&&(this.commit_task.push({del:t}),this.M&&PHt(this)),this.cache&&this.cache.remove(t),this};ghn={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};v_.prototype.add=function(t,e,r,n){if(e&&(t||t===0)){if(!n&&!r&&this.reg.has(t))return this.update(t,e);n=this.depth,e=this.encoder.encode(e,!n);let l=e.length;if(l){let c=$s(),d=$s(),f=this.resolution;for(let p=0;p<l;p++){let h=e[this.rtl?l-1-p:p];var o=h.length;if(o&&(n||!d[h])){var i=this.score?this.score(e,h,p,null,0):zde(f,l,p),a="";switch(this.tokenize){case"tolerant":if(zP(this,d,h,i,t,r),o>2){for(let m=1,g,y,_,w;m<o-1;m++)g=h.charAt(m),y=h.charAt(m+1),_=h.substring(0,m)+y,w=h.substring(m+2),a=_+g+w,zP(this,d,a,i,t,r),a=_+w,zP(this,d,a,i,t,r);zP(this,d,h.substring(0,h.length-1),i,t,r)}break;case"full":if(o>2){for(let m=0,g;m<o;m++)for(i=o;i>m;i--){a=h.substring(m,i),g=this.rtl?o-1-m:m;var s=this.score?this.score(e,h,p,a,g):zde(f,l,p,o,g);zP(this,d,a,s,t,r)}break}case"bidirectional":case"reverse":if(o>1){for(s=o-1;s>0;s--){a=h[this.rtl?o-1-s:s]+a;var u=this.score?this.score(e,h,p,a,s):zde(f,l,p,o,s);zP(this,d,a,u,t,r)}a=""}case"forward":if(o>1){for(s=0;s<o;s++)a+=h[this.rtl?o-1-s:s],zP(this,d,a,i,t,r);break}default:if(zP(this,d,h,i,t,r),n&&l>1&&p<l-1)for(o=this.N,a=h,i=Math.min(n+1,this.rtl?p+1:l-p),s=1;s<i;s++){h=e[this.rtl?l-1-p-s:p+s],u=this.bidirectional&&h>a;let m=this.score?this.score(e,a,p,h,s-1):zde(o+(l/2>o?0:1),l,p,i-1,s-1);zP(this,c,u?a:h,m,t,r,u?h:a)}}}}this.fastupdate||this.reg.add(t)}}return this.db&&(this.commit_task.push(r?{ins:t}:{del:t}),this.M&&PHt(this)),this};v_.prototype.search=function(t,e,r){if(r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):(r=t,t="")),r&&r.cache)return r.cache=!1,t=this.searchCache(t,e,r),r.cache=!0,t;let n=[],o,i,a,s=0,u,l,c,d,f;r&&(t=r.query||t,e=r.limit||e,s=r.offset||0,i=r.context,a=r.suggest,f=(u=r.resolve)&&r.enrich,c=r.boost,d=r.resolution,l=this.db&&r.tag),typeof u>"u"&&(u=this.resolve),i=this.depth&&i!==!1;let p=this.encoder.encode(t,!i);if(o=p.length,e=e||(u?100:0),o===1)return yHt.call(this,p[0],"",e,s,u,f,l);if(o===2&&i&&!a)return yHt.call(this,p[1],p[0],e,s,u,f,l);let h=$s(),m=0,g;if(i&&(g=p[0],m=1),d||d===0||(d=g?this.N:this.resolution),this.db){if(this.db.search&&(r=this.db.search(this,p,e,s,a,u,f,l),r!==!1))return r;let y=this;return async function(){for(let _,w;m<o;m++){if((w=p[m])&&!h[w]){if(h[w]=1,_=await Aze(y,w,g,0,0,!1,!1),_=bHt(_,n,a,d)){n=_;break}g&&(a&&_&&n.length||(g=w))}a&&g&&m===o-1&&!n.length&&(d=y.resolution,g="",m=-1,h=$s())}return gHt(n,d,e,s,a,c,u)}()}for(let y,_;m<o;m++){if((_=p[m])&&!h[_]){if(h[_]=1,y=Aze(this,_,g,0,0,!1,!1),y=bHt(y,n,a,d)){n=y;break}g&&(a&&y&&n.length||(g=_))}a&&g&&m===o-1&&!n.length&&(d=this.resolution,g="",m=-1,h=$s())}return gHt(n,d,e,s,a,c,u)};kt=v_.prototype;kt.mount=function(t){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),t.mount(this)};kt.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)};kt.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};kt.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this};kt.append=function(t,e){return this.add(t,e,!0)};kt.contain=function(t){return this.db?this.db.has(t):this.reg.has(t)};kt.update=function(t,e){let r=this,n=this.remove(t);return n&&n.then?n.then(()=>r.add(t,e)):this.add(t,e)};kt.cleanup=function(){return this.fastupdate?(fG(this.map),this.depth&&fG(this.ctx),this):this};kt.searchCache=Ize;kt.export=function(t,e,r=0,n=0){let o,i;switch(n){case 0:o="reg",i=OHt(this.reg);break;case 1:o="cfg",i=null;break;case 2:o="map",i=Dze(this.map,this.reg.size);break;case 3:o="ctx",i=SHt(this.ctx,this.reg.size);break;default:return}return Wde.call(this,t,e,o,i,r,n)};kt.import=function(t,e){if(e)switch(typeof e=="string"&&(e=JSON.parse(e)),t=t.split("."),t[t.length-1]==="json"&&t.pop(),t.length===3&&t.shift(),t=t.length>1?t[1]:t[0],t){case"reg":this.fastupdate=!1,this.reg=EHt(e,this.reg);break;case"map":this.map=Lze(e,this.map);break;case"ctx":this.ctx=CHt(e,this.ctx)}};kt.serialize=function(t=!0){let e="",r="",n="";if(this.reg.size){let i;for(var o of this.reg.keys())i||(i=typeof o),e+=(e?",":"")+(i==="string"?'"'+o+'"':o);e="index.reg=new Set(["+e+"]);",r=hHt(this.map,i),r="index.map=new Map(["+r+"]);";for(let a of this.ctx.entries()){o=a[0];let s=hHt(a[1],i);s="new Map(["+s+"])",s='["'+o+'",'+s+"]",n+=(n?",":"")+s}n="index.ctx=new Map(["+n+"]);"}return t?"function inject(index){"+e+r+n+"}":e+r+n};Rze(v_.prototype);THt=typeof window<"u"&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Kde=["map","ctx","tag","reg","cfg"],dF=$s();kt=Gde.prototype;kt.mount=function(t){return t.index?t.mount(this):(t.db=this,this.open())};kt.open=function(){if(this.db)return this.db;let t=this;navigator.storage&&navigator.storage.persist(),dF[t.id]||(dF[t.id]=[]),dF[t.id].push(t.field);let e=THt.open(t.id,1);return e.onupgradeneeded=function(){let r=t.db=this.result;for(let n=0,o;n<Kde.length;n++){o=Kde[n];for(let i=0,a;i<dF[t.id].length;i++)a=dF[t.id][i],r.objectStoreNames.contains(o+(o!=="reg"&&a?":"+a:""))||r.createObjectStore(o+(o!=="reg"&&a?":"+a:""))}},t.db=pR(e,function(r){t.db=r,t.db.onversionchange=function(){t.close()}})};kt.close=function(){this.db&&this.db.close(),this.db=null};kt.destroy=function(){let t=THt.deleteDatabase(this.id);return pR(t)};kt.clear=function(){let t=[];for(let r=0,n;r<Kde.length;r++){n=Kde[r];for(let o=0,i;o<dF[this.id].length;o++)i=dF[this.id][o],t.push(n+(n!=="reg"&&i?":"+i:""))}let e=this.db.transaction(t,"readwrite");for(let r=0;r<t.length;r++)e.objectStore(t[r]).clear();return pR(e)};kt.get=function(t,e,r=0,n=0,o=!0,i=!1){t=this.db.transaction((e?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((e?"ctx":"map")+(this.field?":"+this.field:"")).get(e?e+":"+t:t);let a=this;return pR(t).then(function(s){let u=[];if(!s||!s.length)return u;if(o){if(!r&&!n&&s.length===1)return s[0];for(let l=0,c;l<s.length;l++)if((c=s[l])&&c.length){if(n>=c.length){n-=c.length;continue}let d=r?n+Math.min(c.length-n,r):c.length;for(let f=n;f<d;f++)u.push(c[f]);if(n=0,u.length===r)break}return i?a.enrich(u):u}return s})};kt.tag=function(t,e=0,r=0,n=!1){t=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(t);let o=this;return pR(t).then(function(i){return!i||!i.length||r>=i.length?[]:!e&&!r?i:(i=i.slice(r,r+e),n?o.enrich(i):i)})};kt.enrich=function(t){typeof t!="object"&&(t=[t]);let e=this.db.transaction("reg","readonly").objectStore("reg"),r=[];for(let n=0;n<t.length;n++)r[n]=pR(e.get(t[n]));return Promise.all(r).then(function(n){for(let o=0;o<n.length;o++)n[o]={id:t[o],doc:n[o]?JSON.parse(n[o]):null};return n})};kt.has=function(t){return t=this.db.transaction("reg","readonly").objectStore("reg").getKey(t),pR(t).then(function(e){return!!e})};kt.search=null;kt.info=function(){};kt.transaction=function(t,e,r){t+=t!=="reg"&&this.field?":"+this.field:"";let n=this.h[t+":"+e];if(n)return r.call(this,n);let o=this.db.transaction(t,e);this.h[t+":"+e]=n=o.objectStore(t);let i=r.call(this,n);return this.h[t+":"+e]=null,pR(o).finally(function(){return o=n=null,i})};kt.commit=async function(t){let e=t.commit_task,r=[];t.commit_task=[];for(let n=0,o;n<e.length;n++)o=e[n],o.del&&r.push(o.del);r.length&&await this.remove(r),t.reg.size&&(await this.transaction("map","readwrite",function(n){for(let o of t.map){let i=o[0],a=o[1];a.length&&(n.get(i).onsuccess=function(){let s=this.result;var u;if(s&&s.length){let l=Math.max(s.length,a.length);for(let c=0,d,f;c<l;c++)if((f=a[c])&&f.length){if((d=s[c])&&d.length)for(u=0;u<f.length;u++)d.push(f[u]);else s[c]=f;u=1}}else s=a,u=1;u&&n.put(s,i)})}}),await this.transaction("ctx","readwrite",function(n){for(let o of t.ctx){let i=o[0],a=o[1];for(let s of a){let u=s[0],l=s[1];l.length&&(n.get(i+":"+u).onsuccess=function(){let c=this.result;var d;if(c&&c.length){let f=Math.max(c.length,l.length);for(let p=0,h,m;p<f;p++)if((m=l[p])&&m.length){if((h=c[p])&&h.length)for(d=0;d<m.length;d++)h.push(m[d]);else c[p]=m;d=1}}else c=l,d=1;d&&n.put(c,i+":"+u)})}}}),t.store?await this.transaction("reg","readwrite",function(n){for(let o of t.store){let i=o[0],a=o[1];n.put(typeof a=="object"?JSON.stringify(a):1,i)}}):t.bypass||await this.transaction("reg","readwrite",function(n){for(let o of t.reg.keys())n.put(1,o)}),t.tag&&await this.transaction("tag","readwrite",function(n){for(let o of t.tag){let i=o[0],a=o[1];a.length&&(n.get(i).onsuccess=function(){let s=this.result;s=s&&s.length?s.concat(a):a,n.put(s,i)})}}),t.map.clear(),t.ctx.clear(),t.tag&&t.tag.clear(),t.store&&t.store.clear(),t.document||t.reg.clear())};kt.remove=function(t){return typeof t!="object"&&(t=[t]),Promise.all([this.transaction("map","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&Oze(r,t)}}),this.transaction("ctx","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&Oze(r,t)}}),this.transaction("tag","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&Oze(r,t,!0)}}),this.transaction("reg","readwrite",function(e){for(let r=0;r<t.length;r++)e.delete(t[r])})])};AHt={Index:v_,Charset:Mze,Encoder:_4,Document:mF,Worker:pF,Resolver:da,IndexedDB:Gde,Language:{}}});var w4,Zde,MHt=b(()=>{Kt();bt();w4=class w4{constructor(){this.bytesUsed=0;let e=oe(),r=Math.min(1e3,Math.max(20,e.lexicalSearchRamLimit||100));this.maxBytes=r*w4.MB_TO_BYTES,this.candidateLimit=Math.min(w4.DEFAULT_CANDIDATE_LIMIT,Math.floor(r*5))}getMaxBytes(){return this.maxBytes}getCandidateLimit(){return this.candidateLimit}getBytesUsed(){return this.bytesUsed}canAddContent(e){return this.bytesUsed+e<=this.maxBytes}addBytes(e){this.bytesUsed+=e}reset(){let e=this.bytesUsed;this.bytesUsed=0,B(`MemoryManager: Reset memory tracking (was using ${e} bytes, max: ${this.maxBytes} bytes)`)}getUsagePercent(){return Math.round(this.bytesUsed/this.maxBytes*100)}static getByteSize(e){return new TextEncoder().encode(e).length}};w4.DEFAULT_CANDIDATE_LIMIT=500,w4.MB_TO_BYTES=1024*1024;Zde=w4});var pG,Wp,Yde,RHt=b(()=>{Kt();nr();IHt();pG=require("obsidian");kde();MHt();Wp=class Wp{constructor(e,r){this.app=e;this.indexedChunks=new Set;this.memoryManager=new Zde,this.chunkManager=r||new cR(e),this.index=null}createIndex(){let e=AHt.Document,r=this.tokenizeMixed.bind(this);return new e({encode:!1,tokenize:r,cache:!1,document:{id:"id",index:[{field:"title",tokenize:r,weight:3},{field:"heading",tokenize:r,weight:2.5},{field:"path",tokenize:r,weight:2},{field:"body",tokenize:r,weight:1}],store:["id","notePath","title","heading","chunkIndex"]}})}tokenizeMixed(e){if(!e)return[];let r=[],n=e.toLowerCase().match(/[a-z0-9_]+/g)||[];r.push(...n);let o=/[\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]+/g,i=e.match(o)||[];for(let a of i){a.length===1&&r.push(a);for(let s=0;s<a.length-1;s++)r.push(a.slice(s,s+2))}return r}async buildFromCandidates(e){if(B(`FullTextEngine: [CHUNKS] Starting with ${e.length} candidate notes`),this.indexedChunks.clear(),this.memoryManager.reset(),!this.index){await new Promise(l=>setTimeout(l,0));let s=Date.now();this.index=this.createIndex();let u=Date.now()-s;B(`FullTextEngine: FlexSearch index created in ${u}ms`)}let r={maxChars:Ej,overlap:0,maxBytesTotal:this.memoryManager.getMaxBytes()*Wp.CHUNK_MEMORY_PERCENTAGE},n=await this.chunkManager.getChunks(e,r);if(n.length===0)return B("FullTextEngine: No chunks generated"),0;B(`FullTextEngine: Generated ${n.length} chunks from ${e.length} notes`);let o=0,i=Wp.BATCH_SIZE,a=new Map;for(let s=0;s<n.length;s++){let u=n[s],l=Buffer.byteLength(u.content,"utf8");if(!this.memoryManager.canAddContent(l)){B(`FullTextEngine: Memory limit reached at ${o} chunks`);break}let c=u.notePath.replace(/\.md$/,"").split("/").join(" "),d=a.get(u.notePath);if(!d){let p=this.app.vault.getAbstractFileByPath(u.notePath);if(p instanceof pG.TFile){let h=this.app.metadataCache.getFileCache(p),m=h?(0,pG.getAllTags)(h)??[]:[],g=h?.frontmatter??{},y=this.app.metadataCache.resolvedLinks[p.path]??{},_=this.app.metadataCache.getBacklinksForFile(p)?.data??{},w=Object.keys(y),S=Object.keys(_),C=[...w,...S],E=this.extractPropertyValues(g);d={tags:m,links:C,props:E},a.set(u.notePath,d)}else d={tags:[],links:[],props:[]}}let f=[u.content,...d.props].join(" ");this.index.add({id:u.id,title:u.title,heading:u.heading,path:c,body:f,tags:d.tags,links:d.links,props:d.props.join(" "),notePath:u.notePath,chunkIndex:u.chunkIndex}),this.memoryManager.addBytes(l),this.indexedChunks.add(u.id),o++,s>0&&s%i===0&&await new Promise(p=>setTimeout(p,0))}return B(`FullTextEngine: [CHUNKS] Indexed ${o}/${n.length} chunks (${this.memoryManager.getUsagePercent()}% memory)`),o}async createNoteDoc(e){try{let r=this.app.metadataCache.getFileCache(e),n=await this.app.vault.cachedRead(e);n.length>Wp.MAX_CONTENT_SIZE&&(B(`FullText: File ${e.path} exceeds size limit (${n.length} bytes), truncating`),n=n.substring(0,Wp.MAX_CONTENT_SIZE));let o=r?(0,pG.getAllTags)(r)??[]:[],i=r?.headings?.map(p=>p.heading)??[],a=r?.frontmatter??{},s=this.app.metadataCache.resolvedLinks[e.path]??{},u=this.app.metadataCache.getBacklinksForFile(e)?.data??{},l=Object.keys(s),c=Object.keys(u),d=a,f=d?.title||d?.name||e.basename;return{id:e.path,title:f,headings:i,tags:o,props:a,linksOut:l,linksIn:c,body:n}}catch(r){return B(`FullText: Skipped ${e.path}: ${r}`),null}}extractPropertyValues(e){let r=[];if(e&&typeof e=="object")for(let n of Object.values(e))this.extractPrimitiveValues(n,r,Wp.MAX_EXTRACTION_DEPTH);return r}extractPrimitiveValues(e,r,n){if(!(n<=0||e==null))if(typeof e=="string"){let o=e.trim();o&&r.push(o)}else typeof e=="number"||typeof e=="boolean"?r.push(String(e)):e instanceof Date?r.push(e.toISOString()):Array.isArray(e)&&e.slice(0,Wp.MAX_ARRAY_ITEMS).forEach(o=>{if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){let i=typeof o=="string"?o.trim():String(o);i&&r.push(i)}})}search(e,r=30,n=[],o){if(!this.index)return[];let i=new Set;for(let u of e)try{let l=this.index.search(u,{limit:r*3,enrich:!0});if(Array.isArray(l)){for(let c of l)if(c?.result)for(let d of c.result){let f=typeof d=="string"?d:d?.id;f&&i.add(f)}}}catch(l){B(`FullText: Search failed for "${u}": ${l}`)}B(`FullText: Found ${i.size} unique documents from all queries (recall phase)`);let a=new Map,s=n.length>0?[...n]:o?[o]:[];if(s.length>0&&i.size>0){for(let u of s)this.scoreWithQuery(u,i,a,r);B(`FullText: Scored with ${s.length} terms (${n.length>0?"salient terms":"original query fallback"})`)}return this.buildFinalResults(a,r)}scoreWithQuery(e,r,n,o){try{let i=this.index.search(e,{limit:o*3,enrich:!0});if(Array.isArray(i))for(let a of i){if(!a?.result||!a?.field)continue;let s=a.field,u=this.getFieldWeight(s),c=e.trim().includes(" ")?1.5:1;for(let d=0;d<a.result.length;d++){let f=a.result[d],p=typeof f=="string"?f:f?.id;if(p&&r.has(p)){let m=1/(d+1)*u*c,g=n.get(p)||{score:0,fieldMatches:new Set,queriesMatched:new Set,lexicalMatches:[]};g.lexicalMatches.push({field:s,query:e,weight:u});let y={score:g.score+m,fieldMatches:new Set(g.fieldMatches).add(s),queriesMatched:new Set(g.queriesMatched).add(e),lexicalMatches:g.lexicalMatches};n.set(p,y)}}}}catch(i){B(`FullText: Scoring failed for query "${e}": ${i}`)}}buildFinalResults(e,r){let n=[];for(let[o,i]of e.entries()){let a=1+(i.fieldMatches.size-1)*.2,s=1+Math.max(0,i.queriesMatched.size-1)*.1,u=i.score*a*s;u=this.applyPhraseInPathBonus(o,i.queriesMatched,u);let l={lexicalMatches:i.lexicalMatches,baseScore:u,finalScore:u};n.push({id:o,score:u,engine:"fulltext",explanation:l})}return n.sort((o,i)=>i.score-o.score),n.slice(0,r)}applyPhraseInPathBonus(e,r,n){let o=e.replace(/\.md$/,"").split("/").join(" ").toLowerCase();for(let i of r)if(i.includes(" ")){let a=i.toLowerCase();if(o.includes(a))return n*1.5}return n}getFieldWeight(e){return Wp.FIELD_WEIGHTS[e]||1}clear(){try{if(this.index){try{let e=this.index;if(e!=null&&typeof e=="object")try{"destroy"in e&&typeof e.destroy=="function"?e.destroy():"clear"in e&&typeof e.clear=="function"&&e.clear()}catch(r){$t(`FullTextEngine: Index method call error: ${r}`)}}catch(e){$t(`FullTextEngine: Index cleanup error (type: ${typeof this.index}): ${e}`)}this.index=null}this.indexedChunks.clear(),this.memoryManager.reset(),B("FullTextEngine: Cleanup completed successfully")}catch(e){$t(`FullTextEngine: Cleanup error: ${e}`)}}getStats(){return{documentsIndexed:this.indexedChunks.size,memoryUsed:this.memoryManager.getBytesUsed(),memoryPercent:this.memoryManager.getUsagePercent()}}};Wp.MAX_CONTENT_SIZE=10*1024*1024,Wp.BATCH_SIZE=10,Wp.CHUNK_MEMORY_PERCENTAGE=.35,Wp.MAX_ARRAY_ITEMS=10,Wp.MAX_EXTRACTION_DEPTH=2,Wp.FIELD_WEIGHTS={title:3,path:1.5,headings:1.5,tags:1.5,props:1.5,links:1.5,body:1};Yde=Wp});var Xde,NHt=b(()=>{Xde=class{static levenshteinDistance(e,r){let n=e.length,o=r.length;if(n===0)return o;if(o===0)return n;let i=Array(n+1).fill(null).map(()=>Array(o+1).fill(0));for(let a=0;a<=n;a++)i[a][0]=a;for(let a=0;a<=o;a++)i[0][a]=a;for(let a=1;a<=n;a++)for(let s=1;s<=o;s++)e[a-1]===r[s-1]?i[a][s]=i[a-1][s-1]:i[a][s]=1+Math.min(i[a-1][s],i[a][s-1],i[a-1][s-1]);return i[n][o]}static similarity(e,r){let n=e.toLowerCase(),o=r.toLowerCase(),i=Math.max(n.length,o.length);return i===0?1:1-this.levenshteinDistance(n,o)/i}static generateVariants(e){let r=new Set,n=e.toLowerCase();if(r.add(e),r.add(n),r.add(e.toUpperCase()),n.length>0&&r.add(n[0].toUpperCase()+n.slice(1)),n.includes(" ")||n.includes("-")||n.includes("_")){let i=n.split(/[\s\-_]+/);if(i.length>1){let a=i[0]+i.slice(1).map(u=>u[0]?.toUpperCase()+u.slice(1)).join("");r.add(a);let s=i.map(u=>u[0]?.toUpperCase()+u.slice(1)).join("");r.add(s)}}n.endsWith("s")?r.add(n.slice(0,-1)):n.endsWith("es")?r.add(n.slice(0,-2)):(r.add(n+"s"),n.endsWith("y")&&r.add(n.slice(0,-1)+"ies"));let o={a:["s","q","w","z"],b:["v","g","h","n"],c:["x","d","f","v"],d:["s","e","r","f","c","x"],e:["w","r","d","s"],f:["d","r","t","g","v","c"],g:["f","t","y","h","b","v"],h:["g","y","u","j","n","b"],i:["u","o","k","j"],j:["h","u","i","k","m","n"],k:["j","i","o","l","m"],l:["k","o","p"],m:["n","j","k"],n:["b","h","j","m"],o:["i","p","l","k"],p:["o","l"],q:["w","a"],r:["e","t","f","d"],s:["a","w","e","d","x","z"],t:["r","y","g","f"],u:["y","i","j","h"],v:["c","f","g","b"],w:["q","e","s","a"],x:["z","s","d","c"],y:["t","u","h","g"],z:["a","s","x"]};for(let i=0;i<n.length&&r.size<10;i++){let a=n[i],s=o[a]||[];for(let u of s){if(r.size>=10)break;let l=n.slice(0,i)+u+n.slice(i+1);r.add(l)}}return Array.from(r)}static isFuzzyMatch(e,r,n=.8){if(this.similarity(e,r)>=n)return!0;let i=l=>{let c=l.toLowerCase();return c.endsWith("ies")&&c.length>3?c.slice(0,-3)+"y":c.endsWith("es")&&c.length>2?c.slice(0,-2):c.endsWith("s")&&!c.endsWith("ss")&&c.length>1?c.slice(0,-1):c},a=i(e),s=i(r);return a===s?!0:this.similarity(a,s)>=n}}});var efe,Qde,jHt=b(()=>{nr();vE();Kt();fr();NHt();efe=class efe{constructor(e={}){this.options=e;this.cache=new Map;this.config={maxVariants:e.maxVariants??2,timeout:e.timeout??rz,cacheSize:e.cacheSize??100,minTermLength:2}}async expand(e){if(!e?.trim())return{queries:[],salientTerms:[],originalQuery:"",expandedQueries:[],expandedTerms:[]};let r=this.cache.get(e);if(r)return this.cache.delete(e),this.cache.set(e,r),B(`QueryExpander: Using cached expansion for "${e}"`),r;try{let n=await this.expandWithTimeout(e);return this.cacheResult(e,n),n}catch(n){return $t(`QueryExpander: Failed to expand query "${e}":`,n),this.fallbackExpansion(e)}}async expandWithTimeout(e){try{return await xee(r=>this.expandWithLLM(e,r),this.config.timeout,"Query expansion")}catch(r){if(r instanceof n8)return B(`QueryExpander: Timeout reached for "${e}"`),this.fallbackExpansion(e);throw r}}async expandWithLLM(e,r){try{if(!this.options.getChatModel)return B("QueryExpander: No chat model getter provided"),this.fallbackExpansion(e);let n=await this.options.getChatModel();if(!n)return B("QueryExpander: No chat model available"),this.fallbackExpansion(e);let o=efe.PROMPT_TEMPLATE.replace("{count}",this.config.maxVariants.toString()).replace("{query}",e),i=await Sd(async()=>await n.invoke(o,r?{signal:r}:void 0));if(!i)return this.fallbackExpansion(e);let a=this.extractContent(i);if(!a)return this.fallbackExpansion(e);let s=this.parseXMLResponse(a,e);return B(`QueryExpander: Expanded "${e}" to ${s.queries.length} queries and ${s.salientTerms.length} terms`),s}catch(n){return ie("QueryExpander: LLM expansion failed:",n),this.fallbackExpansion(e)}}extractContent(e){return typeof e=="string"?e:String(e?.content??e?.text??"").trim()||null}extractSalientTermsFromOriginal(e){return this.extractTermsFromQueries([e]).filter(r=>this.isValidTerm(r))}parseXMLResponse(e,r){let n=[r],o=new Set,i=/<query>(.*?)<\/query>/g,a;for(;(a=i.exec(e))!==null;){let d=a[1]?.trim();d&&d!==r&&n.length<=this.config.maxVariants&&n.push(d)}let s=/<term>(.*?)<\/term>/g,u;for(;(u=s.exec(e))!==null;){let d=u[1]?.trim().toLowerCase();d&&this.isValidTerm(d)&&o.add(d)}if(n.length===1&&o.size===0)return this.parseLegacyFormat(e,r);let l=this.extractSalientTermsFromOriginal(r),c=n.slice(1);return{queries:n.slice(0,this.config.maxVariants+1),salientTerms:l,originalQuery:r,expandedQueries:c.slice(0,this.config.maxVariants),expandedTerms:Array.from(o)}}parseLegacyFormat(e,r){let n=e.split(`
`).map(l=>l.trim()),o=[r],i=new Set,a=null;for(let l of n)if(!(!l||l==="")){if(l.toUpperCase().includes("QUERIES")){a="queries";continue}if(l.toUpperCase().includes("TERMS")||l.toUpperCase().includes("KEYWORDS")){a="terms";continue}if(a==="queries"&&o.length<=this.config.maxVariants){let c=l.replace(/^[-•*\d.)\s]+/,"").trim();c&&c!==r&&o.push(c)}else if(a==="terms"){let c=l.replace(/^[-•*\d.)\s]+/,"").trim().toLowerCase();c&&this.isValidTerm(c)&&i.add(c)}}if(o.length===1&&i.size===0)for(let l of n.slice(0,this.config.maxVariants))l&&!l.toUpperCase().includes("QUERY")&&o.push(l);let s=this.extractSalientTermsFromOriginal(r),u=o.slice(1);return{queries:o.slice(0,this.config.maxVariants+1),salientTerms:s,originalQuery:r,expandedQueries:u.slice(0,this.config.maxVariants),expandedTerms:Array.from(i)}}fallbackExpansion(e){let r=this.extractTermsFromQueries([e]),n=new Set([e]);for(let i of r)if(i.length>=3){let a=Xde.generateVariants(i);for(let s of a.slice(0,3))if(s!==i){let u=e.toLowerCase().replace(new RegExp(`\\b${i}\\b`,"gi"),s);u!==e.toLowerCase()&&n.add(u)}}return{queries:[e],salientTerms:r,originalQuery:e,expandedQueries:[],expandedTerms:[]}}extractTermsFromQueries(e){let r=new Set;for(let n of e){let o=n.toLowerCase().replace(/[^\w\s-]/g," ").split(/\s+/);for(let i of o)this.isValidTerm(i)&&(r.add(i),i.includes("-")&&i.split("-").forEach(a=>{this.isValidTerm(a)&&r.add(a)}))}return Array.from(r)}isValidTerm(e){return e.length>=this.config.minTermLength&&/^[\w-]+$/.test(e)}cacheResult(e,r){if(this.cache.size>=this.config.cacheSize){let n=this.cache.keys().next().value;n&&this.cache.delete(n)}this.cache.set(e,r)}clearCache(){this.cache.clear(),B("QueryExpander: Cache cleared")}getCacheSize(){return this.cache.size}async expandQueries(e){return(await this.expand(e)).queries}};efe.PROMPT_TEMPLATE=`Generate alternative search queries and semantically related terms for the following query:
"{query}"
Instructions:
1. Generate {count} alternative search queries that capture the same intent
2. Extract semantically related terms that someone might use when searching for this topic
3. Include:
- Keywords from the original query
- Synonyms and related concepts
- Domain-specific terminology
- Associated terms someone might use
4. Keep the SAME LANGUAGE as the original query
5. Focus on NOUNS and meaningful concepts
6. EXCLUDE common action verbs in ANY language (find, search, get, \u67E5\u627E, chercher, buscar, etc.)
Example: "find my piano notes"
- Queries: "piano lesson notes", "piano practice sheets"
- Terms: piano, notes, music, sheet, practice, lesson, piece, scales, exercises
Example: "typescript interfaces"
- Queries: "typescript type definitions", "typescript contracts"
- Terms: typescript, interfaces, types, definitions, contracts, typing, declarations
Example: "\u67E5\u627E\u6211\u7684\u7B14\u8BB0" (Chinese)
- Queries: "\u6211\u7684\u5B66\u4E60\u7B14\u8BB0", "\u4E2A\u4EBA\u7B14\u8BB0\u6587\u6863"
- Terms: \u7B14\u8BB0, \u6587\u6863, \u8BB0\u5F55, \u8D44\u6599, \u5B66\u4E60, \u5907\u5FD8\u5F55 (keep in Chinese)
Example: "rechercher documents projet" (French)
- Queries: "documents de projet", "fichiers projet"
- Terms: documents, projet, fichiers, dossiers, archives (keep in French)
Format your response using XML tags:
<queries>
<query>alternative query 1</query>
<query>alternative query 2</query>
</queries>
<terms>
<term>keyword1</term>
<term>keyword2</term>
<term>keyword3</term>
<term>related_term1</term>
<term>related_term2</term>
</terms>`;Qde=efe});var mG,tfe,DHt=b(()=>{Kt();th();mG=class mG{constructor(e){this.app=e}async batchCachedReadGrep(e,r){let{inclusions:n,exclusions:o}=bc(),a=this.app.vault.getMarkdownFiles().filter(d=>ys(d,n,o)),s=new Set,u=mG.CONFIG.BATCH_SIZE,l=e.map(d=>d.toLowerCase());for(let d=0;d<a.length&&s.size<r;d+=u){let f=a.slice(d,d+u);await Promise.all(f.map(async p=>{if(!(s.size>=r))try{let h=p.path.toLowerCase(),m=!1;for(let g of l)if(h.includes(g)){s.add(p.path),m=!0;break}if(!m){let y=(await this.app.vault.cachedRead(p)).toLowerCase();for(let _ of l)if(y.includes(_)){s.add(p.path);break}}}catch(h){B(`GrepScanner: Skipping file ${p.path}: ${h}`)}})),d%mG.CONFIG.YIELD_INTERVAL===0&&await new Promise(p=>setTimeout(p,0))}let c=Array.from(s).slice(0,r);return c.length>0&&B(` Grep: ${c.length} files match [${e.slice(0,3).join(", ")}${e.length>3?"...":""}]`),c}async grep(e,r=200){return this.batchCachedReadGrep([e],r)}async fileContainsAny(e,r){try{let n=e.path.toLowerCase(),o=0;for(let s of r)n.includes(s.toLowerCase())&&o++;if(o>0)return!0;let a=(await this.app.vault.cachedRead(e)).toLowerCase();return r.some(s=>a.includes(s.toLowerCase()))}catch{return!1}}};mG.CONFIG={BATCH_SIZE:30,YIELD_INTERVAL:100};tfe=mG});var yhn,rfe,LHt=b(()=>{Kt();yhn={enabled:!0,minDocsForBoost:2,maxBoostFactor:1.15,minRelevanceRatio:.4},rfe=class{constructor(e){this.config=yhn;this.app=e||null}setConfig(e){this.config={...this.config,...e}}applyBoosts(e){if(!this.config.enabled||e.length===0)return e;let r=this.calculateFolderStats(e);return this.logBoostedFolders(r),e.map(n=>{let o=this.extractFolder(n.id),i=r.get(o);if(i){let a=n.score*i.boostFactor;return{...n,score:a,explanation:n.explanation?{...n.explanation,folderBoost:{folder:i.folderPath,documentCount:i.documentCount,totalDocsInFolder:i.totalDocsInFolder,relevanceRatio:i.relevanceRatio,boostFactor:i.boostFactor},finalScore:a}:void 0}}return n})}calculateFolderStats(e){let r=new Map;for(let i of e){let a=this.extractFolder(i.id);r.set(a,(r.get(a)||0)+1)}let n=this.getTotalDocsPerFolder(),o=new Map;for(let[i,a]of r.entries()){let s=n.get(i)||a,u=a/s;if(a>=this.config.minDocsForBoost&&u>=this.config.minRelevanceRatio){let c=1+(1+Math.log2(a+1)-1)*Math.sqrt(u),d=Math.min(c,this.config.maxBoostFactor);o.set(i,{folderPath:i,documentCount:a,totalDocsInFolder:s,relevanceRatio:u,boostFactor:d})}}return o}getTotalDocsPerFolder(){let e=new Map;if(!this.app)return e;let r=this.app.vault.getMarkdownFiles();for(let n of r){let o=this.extractFolder(n.path);e.set(o,(e.get(o)||0)+1)}return e}extractFolder(e){return e.substring(0,e.lastIndexOf("/"))||""}logBoostedFolders(e){let r=Array.from(e.values()).sort((n,o)=>o.relevanceRatio-n.relevanceRatio);r.length>0&&(B(`Folder boost: Boosting ${r.length} folders with significant relevance`),r.slice(0,5).forEach(n=>{let o=(n.relevanceRatio*100).toFixed(1);B(` ${n.folderPath||"(root)"}: ${n.documentCount}/${n.totalDocsInFolder} docs (${o}% relevant, ${n.boostFactor.toFixed(2)}x boost)`)}))}getFolderBoosts(e){return this.config.enabled?this.calculateFolderStats(e):new Map}}});var bhn,nfe,FHt=b(()=>{Kt();bhn={enabled:!0,maxCandidates:10,backlinkWeight:1,coCitationWeight:.5,sharedTagWeight:.3,boostStrength:.1,maxBoostMultiplier:1.2},nfe=class{constructor(e,r={}){this.metadataCache=e.metadataCache,this.config={...bhn,...r}}applyBoost(e){if(!this.config.enabled||e.length===0)return e;let r=this.filterCandidates(e);if(r.length<2)return e;let n=new Set(r.map(s=>s.id)),o=new Map;for(let s of r){let u=this.calculateConnections(s.id,n);o.set(s.id,u)}let i=e.map(s=>{let u=o.get(s.id);return!u||u.boostMultiplier===1?s:{...s,score:s.score*u.boostMultiplier,explanation:s.explanation?{...s.explanation,graphConnections:{backlinks:u.backlinks.length,coCitations:u.coCitations.length,sharedTags:u.sharedTags.length,score:u.connectionScore,boostMultiplier:u.boostMultiplier}}:void 0}}),a=i.filter(s=>{let u=o.get(s.id);return u&&u.boostMultiplier>1});return a.length>0&&B(`GraphBoostCalculator: Boosted ${a.length} notes based on connections`),i}calculateConnections(e,r){let n=this.findBacklinks(e,r),o=this.findCoCitations(e,r),i=this.findSharedTags(e,r),a=n.length*this.config.backlinkWeight+o.length*this.config.coCitationWeight+i.length*this.config.sharedTagWeight,s=1;return a>0&&(s=1+this.config.boostStrength*Math.log(1+a),s=Math.min(s,this.config.maxBoostMultiplier)),{backlinks:n,coCitations:o,sharedTags:i,connectionScore:a,boostMultiplier:s}}resolveFile(e){let r=this.metadataCache.getFirstLinkpathDest(e,"");return r&&typeof r=="object"&&"path"in r?r:null}findBacklinks(e,r){let n=[],o=this.resolveFile(e);if(!o)return n;let i=this.metadataCache.getBacklinksForFile(o);if(!i)return n;for(let[a]of i.data)r.has(a)&&a!==e&&n.push(a);return n}findCoCitations(e,r){let n=[],o=new Set,i=this.resolveFile(e);if(!i)return n;let a=this.metadataCache.getBacklinksForFile(i);if(!a)return n;for(let[s]of a.data)o.add(s);if(o.size===0)return n;for(let s of r){if(s===e)continue;let u=this.resolveFile(s);if(!u)continue;let l=this.metadataCache.getBacklinksForFile(u);if(l){for(let[c]of l.data)if(o.has(c)){n.push(s);break}}}return n}findSharedTags(e,r){let n=[],o=this.resolveFile(e);if(!o)return n;let i=this.metadataCache.getFileCache(o);if(!i||!i.tags||i.tags.length===0)return n;let a=new Set(i.tags.map(s=>s.tag));for(let s of r){if(s===e)continue;let u=this.resolveFile(s);if(!u)continue;let l=this.metadataCache.getFileCache(u);if(!l||!l.tags)continue;l.tags.some(d=>a.has(d.tag))&&n.push(s)}return n}filterCandidates(e){let r=e,n=r.length;return r=r.slice(0,this.config.maxCandidates),n>this.config.maxCandidates&&B(`GraphBoost: Limited to top ${this.config.maxCandidates} candidates (from ${n})`),r}setConfig(e){this.config={...this.config,...e}}}});var ofe,kHt=b(()=>{ofe=class{constructor(e={}){this.config={method:"zscore-tanh",tanhScale:2.5,clipMin:.02,clipMax:.98};this.config={...this.config,...e}}updateExplanation(e,r,n){if(e)return{...e,baseScore:r,finalScore:n}}normalize(e){if(e.length===0)return e;switch(this.config.method){case"zscore-tanh":return this.normalizeZScoreTanh(e);case"minmax":return this.normalizeMinMax(e);case"percentile":return this.normalizePercentile(e);default:return e}}normalizeZScoreTanh(e){let r=e.map(l=>l.score),n=r.reduce((l,c)=>l+c,0)/r.length,o=r.reduce((l,c)=>l+Math.pow(c-n,2),0)/r.length,i=Math.sqrt(o);if(i===0)return e.map(l=>({...l,score:.5,explanation:this.updateExplanation(l.explanation,l.score,.5)}));let a=this.config.tanhScale||2.5,s=this.config.clipMin||.02,u=this.config.clipMax||.98;return e.map(l=>{let c=(l.score-n)/i,d=.5+.5*Math.tanh(c/a),f=Math.max(s,Math.min(u,d));return{...l,score:f,explanation:this.updateExplanation(l.explanation,l.score,f)}})}normalizeMinMax(e){let r=e.map(u=>u.score),n=Math.min(...r),o=Math.max(...r);if(o===n)return e.map(u=>({...u,score:.5,explanation:this.updateExplanation(u.explanation,u.score,.5)}));let i=this.config.clipMin||.02,a=this.config.clipMax||.98;return e.map(u=>{let l=(u.score-n)/(o-n),c=i+l*(a-i);return{...u,score:c,explanation:this.updateExplanation(u.explanation,u.score,c)}})}normalizePercentile(e){let r=e.length,n=this.config.clipMin||.02,o=this.config.clipMax||.98,i=[...e].sort((s,u)=>s.score-u.score),a=new Map;return i.forEach((s,u)=>{let l=u/(r-1),c=n+l*(o-n);a.set(s.id,c)}),e.map(s=>{let u=a.get(s.id)||.5;return{...s,score:u,explanation:this.updateExplanation(s.explanation,s.score,u)}})}getStatistics(e){if(e.length===0)return{mean:0,std:0,min:0,max:0,median:0};let r=e.map(c=>c.score),n=[...r].sort((c,d)=>c-d),o=r.reduce((c,d)=>c+d,0)/r.length,i=r.reduce((c,d)=>c+Math.pow(d-o,2),0)/r.length,a=Math.sqrt(i),s=n[0],u=n[n.length-1],l=n[Math.floor(n.length/2)];return{mean:o,std:a,min:s,max:u,median:l}}}});var _hn,ife,$Ht=b(()=>{nr();Kt();kde();RHt();jHt();DHt();LHt();FHt();kHt();_hn=2,ife=class{constructor(e,r){this.app=e;this.getChatModel=r;this.grepScanner=new tfe(e),this.chunkManager=new cR(e),this.fullTextEngine=new Yde(e,this.chunkManager),this.queryExpander=new Qde({getChatModel:this.getChatModel,maxVariants:3,timeout:rz}),this.folderBoostCalculator=new rfe(e),this.graphBoostCalculator=new nfe(e,{enabled:!0,maxCandidates:10,boostStrength:.1,maxBoostMultiplier:1.15}),this.scoreNormalizer=new ofe({method:"minmax",clipMin:.02,clipMax:.98})}async retrieve(e,r={}){if(!e||typeof e!="string")return $t("SearchCore: Invalid query provided"),[];let n=e.trim();if(n.length===0)return $t("SearchCore: Empty query provided"),[];n.length>1e3?($t("SearchCore: Query too long, truncating"),e=n.substring(0,1e3)):e=n;let o=Math.min(Math.max(1,r.maxResults||30),100),i=Math.min(Math.max(10,r.candidateLimit||500),1e3),a=!!(r.enableLexicalBoosts??!0);try{B(`SearchCore: Searching for "${e}"`);let s=await this.queryExpander.expand(e),u=s.queries,l=r.salientTerms?[...new Set([...s.salientTerms,...r.salientTerms])]:s.salientTerms;(u.length>1||l.length>3||s.expandedTerms.length>0)&&B(`Query expansion: ${u.length} variants, ${l.length} scoring terms (from original), ${s.expandedTerms.length} recall terms (LLM-generated)`);let c=[...u,...s.expandedTerms,...l],d=await this.grepScanner.batchCachedReadGrep(c,200),f=d.slice(0,i);B(`SearchCore: ${f.length} candidates (from ${d.length} grep hits)`);let h=await this.executeLexicalSearch(f,c,l,o,s.originalQuery);if(a&&(h=this.folderBoostCalculator.applyBoosts(h),h=this.graphBoostCalculator.applyBoost(h)),h=this.scoreNormalizer.normalize(h),this.fullTextEngine.clear(),h=h.slice(0,o),h.length>0){let m=this.app.vault.getAbstractFileByPath(h[0].id);B(`SearchCore: ${h.length} results found (top: ${m?.name||h[0].id})`)}else B("SearchCore: No results found");return h}catch(s){ie("SearchCore: Retrieval failed",s);try{return await this.fallbackSearch(e,o)}catch(u){return ie("SearchCore: Fallback search also failed",u),[]}}}async fallbackSearch(e,r){try{return(await this.grepScanner.grep(e,r)).map((o,i)=>({id:o,score:1/(i+1),engine:"grep"}))}catch(n){return ie("SearchCore: Fallback search failed",n),[]}}getStats(){return{fullTextStats:this.fullTextEngine.getStats()}}getChunkManager(){return this.chunkManager}clear(){this.fullTextEngine.clear(),this.queryExpander.clearCache(),B("SearchCore: Cleared all caches")}async executeLexicalSearch(e,r,n,o,i){try{let a=Date.now(),s=await this.fullTextEngine.buildFromCandidates(e),u=Date.now()-a,l=Date.now(),c=this.fullTextEngine.search(r,o*_hn,n,i),d=Date.now()-l;return B(`Full-text: ${s} docs indexed (${u}ms), ${c.length} results (${d}ms)`),c}catch(a){return ie("Full-text search failed",a),[]}}}});var gF,BHt=b(()=>{gF="0.39.0"});function VHt(t,e={auto:!1}){if(zHt)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${t.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(yF)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${t.kind}'\` after \`import '@anthropic-ai/sdk/shims/${yF}'\``);zHt=e.auto,yF=t.kind,Fze=t.fetch,vhn=t.Request,whn=t.Response,xhn=t.Headers,UHt=t.FormData,Shn=t.Blob,afe=t.File,kze=t.ReadableStream,qHt=t.getMultipartRequestOptions,$ze=t.getDefaultAgent,sfe=t.fileFromPath,HHt=t.isFsReadStream}var zHt,yF,Fze,vhn,whn,xhn,UHt,Shn,afe,kze,qHt,$ze,sfe,HHt,Bze=b(()=>{zHt=!1});var ufe,WHt=b(()=>{ufe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function KHt({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 ufe(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}}var GHt=b(()=>{WHt()});var JHt=b(()=>{GHt()});var hG=b(()=>{Bze();JHt();Bze();yF||VHt(KHt(),{auto:!0})});var Hr,Gc,Wd,mR,x4,gG,yG,bG,_G,vG,wG,xG,SG,w_=b(()=>{UP();Hr=class extends Error{},Gc=class t extends Hr{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||!o)return new mR({message:n,cause:lfe(r)});let i=r;return e===400?new gG(e,i,n,o):e===401?new yG(e,i,n,o):e===403?new bG(e,i,n,o):e===404?new _G(e,i,n,o):e===409?new vG(e,i,n,o):e===422?new wG(e,i,n,o):e===429?new xG(e,i,n,o):e>=500?new SG(e,i,n,o):new t(e,i,n,o)}},Wd=class extends Gc{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},mR=class extends Gc{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},x4=class extends mR{constructor({message:e}={}){super({message:e??"Request timed out."})}},gG=class extends Gc{},yG=class extends Gc{},bG=class extends Gc{},_G=class extends Gc{},vG=class extends Gc{},wG=class extends Gc{},xG=class extends Gc{},SG=class extends Gc{}});function Phn(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 ZHt(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}var cfe,bF,sg,qP,zze=b(()=>{w_();cfe=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},bF=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)},qP=class{constructor(){sg.set(this,void 0),this.buffer=new Uint8Array,cfe(this,sg,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=Phn(this.buffer,bF(this,sg,"f")))!=null;){if(i.carriage&&bF(this,sg,"f")==null){cfe(this,sg,i.index,"f");continue}if(bF(this,sg,"f")!=null&&(i.index!==bF(this,sg,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,bF(this,sg,"f")-1))),this.buffer=this.buffer.slice(bF(this,sg,"f")),cfe(this,sg,null,"f");continue}let a=bF(this,sg,"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),cfe(this,sg,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 Hr(`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 Hr(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Hr("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
`):[]}};sg=new WeakMap;qP.NEWLINE_CHARS=new Set([`
`,"\r"]);qP.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function CG(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 Uze=b(()=>{});async function*Thn(t,e){if(!t.body)throw e.abort(),new Hr("Attempted to iterate over a response with no body");let r=new qze,n=new qP,o=CG(t.body);for await(let i of Ahn(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*Ahn(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=ZHt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function Ihn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var lO,qze,dfe=b(()=>{hG();w_();zze();Uze();UP();w_();lO=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 Thn(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 Gc.generate(void 0,`SSE Error: ${a.data}`,a.data,Hze(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 qP,s=CG(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 kze({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?.()}})}};qze=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]=Ihn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function YHt(t,e,r){if(t=await t,Rhn(t))return t;if(Mhn(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=OG(o)?[await o.arrayBuffer()]:[o];return new afe(i,e,r)}let n=await Nhn(t);if(e||(e=Dhn(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new afe(n,e,r)}async function Nhn(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(OG(t))e.push(await t.arrayBuffer());else if(Lhn(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${jhn(t)}`);return e}function jhn(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function Dhn(t){return Vze(t.name)||Vze(t.filename)||Vze(t.path)?.split(/[\\/]/).pop()}var Mhn,Rhn,OG,Vze,Lhn,Wze,Kze=b(()=>{hG();hG();Mhn=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",Rhn=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&OG(t),OG=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";Vze=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},Lhn=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Wze=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody"});async function rVt(t){let{response:e}=t;if(t.options.stream)return S4("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):lO.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 S4("response",e.status,e.url,e.headers,i),nVt(i,e)}let o=await e.text();return S4("response",e.status,e.url,e.headers,o),o}function nVt(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}function Uhn(){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}function EG(t){if(!t)return!0;for(let e in t)return!1;return!0}function oVt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function tVt(t,e){for(let r in e){if(!oVt(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 S4(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Anthropic:DEBUG:${t}`,...e)}var khn,$hn,ffe,mfe,hfe,gfe,Jze,Hze,Bhn,Iy,zhn,XHt,QHt,eVt,qhn,Hhn,Vhn,Whn,Khn,Gze,lfe,yfe,Ghn,iVt,Jhn,pfe,UP=b(()=>{BHt();dfe();w_();hG();Kze();khn=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)};mfe=class t extends Promise{constructor(e,r=rVt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>nVt(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("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)}},hfe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=Gze("maxRetries",r),this.timeout=Gze("timeout",n),this.httpAgent=o,this.fetch=i??Fze}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...qhn(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${Ghn()}`}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&&OG(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}={}){e={...e};let{method:n,path:o,query:i,headers:a={}}=e,s=ArrayBuffer.isView(e.body)||e.__binaryRequest&&typeof e.body=="string"?e.body:Wze(e.body)?e.body.body:e.body?JSON.stringify(e.body,null,2):null,u=this.calculateContentLength(s),l=this.buildURL(o,i);"timeout"in e&&Gze("timeout",e.timeout),e.timeout=e.timeout??this.timeout;let c=e.httpAgent??this.httpAgent??$ze(l),d=e.timeout+1e3;typeof c?.options?.timeout=="number"&&d>(c.options.timeout??0)&&(c.options.timeout=d),this.idempotencyHeader&&n!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),a[this.idempotencyHeader]=e.idempotencyKey);let f=this.buildHeaders({options:e,headers:a,contentLength:u,retryCount:r});return{req:{method:n,...s&&{body:s},headers:f,...c&&{agent:c},signal:e.signal??null},url:l,timeout:e.timeout}}buildHeaders({options:e,headers:r,contentLength:n,retryCount:o}){let i={};n&&(i["content-length"]=n);let a=this.defaultHeaders(e);return tVt(i,a),tVt(i,r),Wze(e.body)&&yF!=="node"&&delete i["content-type"],pfe(a,"x-stainless-retry-count")===void 0&&pfe(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),pfe(a,"x-stainless-timeout")===void 0&&pfe(r,"x-stainless-timeout")===void 0&&e.timeout&&(i["x-stainless-timeout"]=String(e.timeout)),this.validateHeaders(i,r),i}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new Hr("Streaming is strongly recommended for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-python#streaming-responses for more details");return 600*1e3}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 Gc.generate(e,r,n,o)}request(e,r=null){return new mfe(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}),S4("request",a,n,i.headers),n.signal?.aborted)throw new Wd;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(lfe);if(l instanceof Error){if(n.signal?.aborted)throw new Wd;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new x4:new mR({cause:l})}let c=Hze(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let g=`retrying, ${r} attempts remaining`;return S4(`response (error; ${g})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(g=>lfe(g).message),f=Hhn(d),p=f?void 0:d;throw S4(`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 Jze(this,n,e)}buildURL(e,r){let n=Whn(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return EG(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 Hr(`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};u.method&&(u.method=u.method.toUpperCase());let l=60*1e3,c=setTimeout(()=>{if(u&&u?.agent?.sockets)for(let d of Object.values(u?.agent?.sockets).flat())d?.setKeepAlive&&d.setKeepAlive(!0,l)},l);return this.fetch.call(void 0,e,u).finally(()=>{clearTimeout(s),clearTimeout(c)})}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 Khn(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 ${gF}`}},gfe=class{constructor(e,r,n,o){ffe.set(this,void 0),khn(this,ffe,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 Hr("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 $hn(this,ffe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(ffe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Jze=class extends mfe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await rVt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},Hze=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),Bhn={method:!0,path:!0,query:!0,body:!0,headers:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__binaryRequest:!0,__binaryResponse:!0,__streamClass:!0},Iy=t=>typeof t=="object"&&t!==null&&!EG(t)&&Object.keys(t).every(e=>oVt(Bhn,e)),zhn=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gF,"X-Stainless-OS":QHt(Deno.build.os),"X-Stainless-Arch":XHt(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":gF,"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":gF,"X-Stainless-OS":QHt(process.platform),"X-Stainless-Arch":XHt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=Uhn();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gF,"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":gF,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};XHt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",QHt=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"),qhn=()=>eVt??(eVt=zhn()),Hhn=t=>{try{return JSON.parse(t)}catch{return}},Vhn=/^[a-z][a-z0-9+.-]*:/i,Whn=t=>Vhn.test(t),Khn=t=>new Promise(e=>setTimeout(e,t)),Gze=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Hr(`${t} must be an integer`);if(e<0)throw new Hr(`${t} must be a positive integer`);return e},lfe=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null)try{return new Error(JSON.stringify(t))}catch{}return new Error(String(t))},yfe=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};Ghn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),iVt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",Jhn=t=>typeof t?.get=="function",pfe=(t,e)=>{let r=e.toLowerCase();if(Jhn(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 cO,PG=b(()=>{UP();cO=class extends gfe{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1,this.first_id=n.first_id||null,this.last_id=n.last_id||null}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(){if(this.options.query?.before_id){let r=this.first_id;return r?{params:{before_id:r}}:null}let e=this.last_id;return e?{params:{after_id:e}}:null}}});var aVt=b(()=>{});var Jc,HP=b(()=>{Jc=class{constructor(e){this._client=e}}});var _F,C4,Zze=b(()=>{HP();UP();PG();_F=class extends Jc{retrieve(e,r){return this._client.get(`/v1/models/${e}?beta=true`,r)}list(e={},r){return Iy(e)?this.list({},e):this._client.getAPIList("/v1/models?beta=true",C4,{query:e,...r})}},C4=class extends cO{};_F.BetaModelInfosPage=C4});var O4,Yze=b(()=>{w_();Uze();zze();O4=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new qP;for await(let r of this.iterator)for(let n of e.decode(r))yield JSON.parse(n);for(let r of e.flush())yield JSON.parse(r)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,r){if(!e.body)throw r.abort(),new Hr("Attempted to iterate over a response with no body");return new t(CG(e.body),r)}}});var vF,E4,Xze=b(()=>{HP();UP();PG();Yze();w_();vF=class extends Jc{create(e,r){let{betas:n,...o}=e;return this._client.post("/v1/messages/batches?beta=true",{body:o,...r,headers:{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),...r?.headers}})}retrieve(e,r={},n){if(Iy(r))return this.retrieve(e,{},r);let{betas:o}=r;return this._client.get(`/v1/messages/batches/${e}?beta=true`,{...n,headers:{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),...n?.headers}})}list(e={},r){if(Iy(e))return this.list({},e);let{betas:n,...o}=e;return this._client.getAPIList("/v1/messages/batches?beta=true",E4,{query:o,...r,headers:{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),...r?.headers}})}delete(e,r={},n){if(Iy(r))return this.delete(e,{},r);let{betas:o}=r;return this._client.delete(`/v1/messages/batches/${e}?beta=true`,{...n,headers:{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),...n?.headers}})}cancel(e,r={},n){if(Iy(r))return this.cancel(e,{},r);let{betas:o}=r;return this._client.post(`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),...n?.headers}})}async results(e,r={},n){if(Iy(r))return this.results(e,{},r);let o=await this.retrieve(e);if(!o.results_url)throw new Hr(`No batch \`results_url\`; Has it finished processing? ${o.processing_status} - ${o.id}`);let{betas:i}=r;return this._client.get(o.results_url,{...n,headers:{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary",...n?.headers},__binaryResponse:!0})._thenUnwrap((a,s)=>O4.fromResponse(s.response,s.controller))}},E4=class extends cO{};vF.BetaMessageBatchesPage=E4});var Qhn,P4,egn,tgn,bfe,Qze=b(()=>{Qhn=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},P4=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),P4(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),P4(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),P4(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),P4(t);break;case"delimiter":return t=t.slice(0,t.length-1),P4(t);break}return t},egn=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},tgn=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},bfe=t=>JSON.parse(tgn(egn(P4(Qhn(t)))))});var Xf,kn,My,hR,TG,_fe,AG,IG,vfe,MG,VP,RG,wfe,xfe,T4,Sfe,Cfe,eUe,sVt,tUe,rUe,nUe,oUe,uVt,lVt,Ofe,cVt=b(()=>{w_();dfe();Qze();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},kn=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)},lVt="__json_buf",Ofe=class t{constructor(){My.add(this),this.messages=[],this.receivedMessages=[],hR.set(this,void 0),this.controller=new AbortController,TG.set(this,void 0),_fe.set(this,()=>{}),AG.set(this,()=>{}),IG.set(this,void 0),vfe.set(this,()=>{}),MG.set(this,()=>{}),VP.set(this,{}),RG.set(this,!1),wfe.set(this,!1),xfe.set(this,!1),T4.set(this,!1),Sfe.set(this,void 0),Cfe.set(this,void 0),tUe.set(this,e=>{if(Xf(this,wfe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Wd),e instanceof Wd)return Xf(this,xfe,!0,"f"),this._emit("abort",e);if(e instanceof Hr)return this._emit("error",e);if(e instanceof Error){let r=new Hr(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Hr(String(e)))}),Xf(this,TG,new Promise((e,r)=>{Xf(this,_fe,e,"f"),Xf(this,AG,r,"f")}),"f"),Xf(this,IG,new Promise((e,r)=>{Xf(this,vfe,e,"f"),Xf(this,MG,r,"f")}),"f"),kn(this,TG,"f").catch(()=>{}),kn(this,IG,"f").catch(()=>{})}get response(){return kn(this,Sfe,"f")}get request_id(){return kn(this,Cfe,"f")}async withResponse(){let e=await kn(this,TG,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}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")},kn(this,tUe,"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())),kn(this,My,"m",rUe).call(this);let{response:i,data:a}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(i);for await(let s of a)kn(this,My,"m",nUe).call(this,s);if(a.controller.signal?.aborted)throw new Wd;kn(this,My,"m",oUe).call(this)}_connected(e){this.ended||(Xf(this,Sfe,e,"f"),Xf(this,Cfe,e?.headers.get("request-id"),"f"),kn(this,_fe,"f").call(this,e),this._emit("connect"))}get ended(){return kn(this,RG,"f")}get errored(){return kn(this,wfe,"f")}get aborted(){return kn(this,xfe,"f")}abort(){this.controller.abort()}on(e,r){return(kn(this,VP,"f")[e]||(kn(this,VP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=kn(this,VP,"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(kn(this,VP,"f")[e]||(kn(this,VP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Xf(this,T4,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Xf(this,T4,!0,"f"),await kn(this,IG,"f")}get currentMessage(){return kn(this,hR,"f")}async finalMessage(){return await this.done(),kn(this,My,"m",eUe).call(this)}async finalText(){return await this.done(),kn(this,My,"m",sVt).call(this)}_emit(e,...r){if(kn(this,RG,"f"))return;e==="end"&&(Xf(this,RG,!0,"f"),kn(this,vfe,"f").call(this));let n=kn(this,VP,"f")[e];if(n&&(kn(this,VP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!kn(this,T4,"f")&&!n?.length&&Promise.reject(o),kn(this,AG,"f").call(this,o),kn(this,MG,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!kn(this,T4,"f")&&!n?.length&&Promise.reject(o),kn(this,AG,"f").call(this,o),kn(this,MG,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",kn(this,My,"m",eUe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),kn(this,My,"m",rUe).call(this),this._connected(null);let o=lO.fromReadableStream(e,this.controller);for await(let i of o)kn(this,My,"m",nUe).call(this,i);if(o.controller.signal?.aborted)throw new Wd;kn(this,My,"m",oUe).call(this)}[(hR=new WeakMap,TG=new WeakMap,_fe=new WeakMap,AG=new WeakMap,IG=new WeakMap,vfe=new WeakMap,MG=new WeakMap,VP=new WeakMap,RG=new WeakMap,wfe=new WeakMap,xfe=new WeakMap,T4=new WeakMap,Sfe=new WeakMap,Cfe=new WeakMap,tUe=new WeakMap,My=new WeakSet,eUe=function(){if(this.receivedMessages.length===0)throw new Hr("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},sVt=function(){if(this.receivedMessages.length===0)throw new Hr("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 Hr("stream ended without producing a content block with type=text");return r.join(" ")},rUe=function(){this.ended||Xf(this,hR,void 0,"f")},nUe=function(r){if(this.ended)return;let n=kn(this,My,"m",uVt).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let o=n.content.at(-1);switch(r.delta.type){case"text_delta":{o.type==="text"&&this._emit("text",r.delta.text,o.text||"");break}case"citations_delta":{o.type==="text"&&this._emit("citation",r.delta.citation,o.citations??[]);break}case"input_json_delta":{o.type==="tool_use"&&o.input&&this._emit("inputJson",r.delta.partial_json,o.input);break}case"thinking_delta":{o.type==="thinking"&&this._emit("thinking",r.delta.thinking,o.thinking);break}case"signature_delta":{o.type==="thinking"&&this._emit("signature",o.signature);break}default:r.delta}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":{Xf(this,hR,n,"f");break}case"content_block_start":case"message_delta":break}},oUe=function(){if(this.ended)throw new Hr("stream has ended, this shouldn't happen");let r=kn(this,hR,"f");if(!r)throw new Hr("request ended without sending any chunks");return Xf(this,hR,void 0,"f"),r},uVt=function(r){let n=kn(this,hR,"f");if(r.type==="message_start"){if(n)throw new Hr(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Hr(`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);switch(r.delta.type){case"text_delta":{o?.type==="text"&&(o.text+=r.delta.text);break}case"citations_delta":{o?.type==="text"&&(o.citations??(o.citations=[]),o.citations.push(r.delta.citation));break}case"input_json_delta":{if(o?.type==="tool_use"){let i=o[lVt]||"";i+=r.delta.partial_json,Object.defineProperty(o,lVt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=bfe(i))}break}case"thinking_delta":{o?.type==="thinking"&&(o.thinking+=r.delta.thinking);break}case"signature_delta":{o?.type==="thinking"&&(o.signature=r.delta.signature);break}default:r.delta}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 lO(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var dVt,gR,iUe=b(()=>{HP();Xze();Xze();cVt();dVt={"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","claude-3-sonnet-20240229":"July 21st, 2025","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025"},gR=class extends Jc{constructor(){super(...arguments),this.batches=new vF(this._client)}create(e,r){let{betas:n,...o}=e;return o.model in dVt&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${dVt[o.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?beta=true",{body:o,timeout:this._client._options.timeout??(o.stream?6e5:this._client._calculateNonstreamingTimeout(o.max_tokens)),...r,headers:{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0,...r?.headers},stream:e.stream??!1})}stream(e,r){return Ofe.createMessage(this,e,r)}countTokens(e,r){let{betas:n,...o}=e;return this._client.post("/v1/messages/count_tokens?beta=true",{body:o,...r,headers:{"anthropic-beta":[...n??[],"token-counting-2024-11-01"].toString(),...r?.headers}})}};gR.Batches=vF;gR.BetaMessageBatchesPage=E4});var dO,aUe=b(()=>{HP();Zze();Zze();iUe();iUe();dO=class extends Jc{constructor(){super(...arguments),this.models=new _F(this._client),this.messages=new gR(this._client)}};dO.Models=_F;dO.BetaModelInfosPage=C4;dO.Messages=gR});var wF,sUe=b(()=>{HP();wF=class extends Jc{create(e,r){return this._client.post("/v1/complete",{body:e,timeout:this._client._options.timeout??6e5,...r,stream:e.stream??!1})}}});var xF,A4,uUe=b(()=>{HP();UP();PG();Yze();w_();xF=class extends Jc{create(e,r){return this._client.post("/v1/messages/batches",{body:e,...r})}retrieve(e,r){return this._client.get(`/v1/messages/batches/${e}`,r)}list(e={},r){return Iy(e)?this.list({},e):this._client.getAPIList("/v1/messages/batches",A4,{query:e,...r})}delete(e,r){return this._client.delete(`/v1/messages/batches/${e}`,r)}cancel(e,r){return this._client.post(`/v1/messages/batches/${e}/cancel`,r)}async results(e,r){let n=await this.retrieve(e);if(!n.results_url)throw new Hr(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...r,headers:{Accept:"application/binary",...r?.headers},__binaryResponse:!0})._thenUnwrap((o,i)=>O4.fromResponse(i.response,i.controller))}},A4=class extends cO{};xF.MessageBatchesPage=A4});var Qf,$n,Ry,yR,NG,Efe,jG,DG,Pfe,LG,WP,FG,Tfe,Afe,I4,Ife,Mfe,lUe,fVt,cUe,dUe,fUe,pUe,pVt,mVt,Rfe,hVt=b(()=>{w_();dfe();Qze();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},$n=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)},mVt="__json_buf",Rfe=class t{constructor(){Ry.add(this),this.messages=[],this.receivedMessages=[],yR.set(this,void 0),this.controller=new AbortController,NG.set(this,void 0),Efe.set(this,()=>{}),jG.set(this,()=>{}),DG.set(this,void 0),Pfe.set(this,()=>{}),LG.set(this,()=>{}),WP.set(this,{}),FG.set(this,!1),Tfe.set(this,!1),Afe.set(this,!1),I4.set(this,!1),Ife.set(this,void 0),Mfe.set(this,void 0),cUe.set(this,e=>{if(Qf(this,Tfe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Wd),e instanceof Wd)return Qf(this,Afe,!0,"f"),this._emit("abort",e);if(e instanceof Hr)return this._emit("error",e);if(e instanceof Error){let r=new Hr(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Hr(String(e)))}),Qf(this,NG,new Promise((e,r)=>{Qf(this,Efe,e,"f"),Qf(this,jG,r,"f")}),"f"),Qf(this,DG,new Promise((e,r)=>{Qf(this,Pfe,e,"f"),Qf(this,LG,r,"f")}),"f"),$n(this,NG,"f").catch(()=>{}),$n(this,DG,"f").catch(()=>{})}get response(){return $n(this,Ife,"f")}get request_id(){return $n(this,Mfe,"f")}async withResponse(){let e=await $n(this,NG,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}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")},$n(this,cUe,"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())),$n(this,Ry,"m",dUe).call(this);let{response:i,data:a}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(i);for await(let s of a)$n(this,Ry,"m",fUe).call(this,s);if(a.controller.signal?.aborted)throw new Wd;$n(this,Ry,"m",pUe).call(this)}_connected(e){this.ended||(Qf(this,Ife,e,"f"),Qf(this,Mfe,e?.headers.get("request-id"),"f"),$n(this,Efe,"f").call(this,e),this._emit("connect"))}get ended(){return $n(this,FG,"f")}get errored(){return $n(this,Tfe,"f")}get aborted(){return $n(this,Afe,"f")}abort(){this.controller.abort()}on(e,r){return($n(this,WP,"f")[e]||($n(this,WP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=$n(this,WP,"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($n(this,WP,"f")[e]||($n(this,WP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Qf(this,I4,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Qf(this,I4,!0,"f"),await $n(this,DG,"f")}get currentMessage(){return $n(this,yR,"f")}async finalMessage(){return await this.done(),$n(this,Ry,"m",lUe).call(this)}async finalText(){return await this.done(),$n(this,Ry,"m",fVt).call(this)}_emit(e,...r){if($n(this,FG,"f"))return;e==="end"&&(Qf(this,FG,!0,"f"),$n(this,Pfe,"f").call(this));let n=$n(this,WP,"f")[e];if(n&&($n(this,WP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!$n(this,I4,"f")&&!n?.length&&Promise.reject(o),$n(this,jG,"f").call(this,o),$n(this,LG,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!$n(this,I4,"f")&&!n?.length&&Promise.reject(o),$n(this,jG,"f").call(this,o),$n(this,LG,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",$n(this,Ry,"m",lUe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),$n(this,Ry,"m",dUe).call(this),this._connected(null);let o=lO.fromReadableStream(e,this.controller);for await(let i of o)$n(this,Ry,"m",fUe).call(this,i);if(o.controller.signal?.aborted)throw new Wd;$n(this,Ry,"m",pUe).call(this)}[(yR=new WeakMap,NG=new WeakMap,Efe=new WeakMap,jG=new WeakMap,DG=new WeakMap,Pfe=new WeakMap,LG=new WeakMap,WP=new WeakMap,FG=new WeakMap,Tfe=new WeakMap,Afe=new WeakMap,I4=new WeakMap,Ife=new WeakMap,Mfe=new WeakMap,cUe=new WeakMap,Ry=new WeakSet,lUe=function(){if(this.receivedMessages.length===0)throw new Hr("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},fVt=function(){if(this.receivedMessages.length===0)throw new Hr("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 Hr("stream ended without producing a content block with type=text");return r.join(" ")},dUe=function(){this.ended||Qf(this,yR,void 0,"f")},fUe=function(r){if(this.ended)return;let n=$n(this,Ry,"m",pVt).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let o=n.content.at(-1);switch(r.delta.type){case"text_delta":{o.type==="text"&&this._emit("text",r.delta.text,o.text||"");break}case"citations_delta":{o.type==="text"&&this._emit("citation",r.delta.citation,o.citations??[]);break}case"input_json_delta":{o.type==="tool_use"&&o.input&&this._emit("inputJson",r.delta.partial_json,o.input);break}case"thinking_delta":{o.type==="thinking"&&this._emit("thinking",r.delta.thinking,o.thinking);break}case"signature_delta":{o.type==="thinking"&&this._emit("signature",o.signature);break}default:r.delta}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,yR,n,"f");break}case"content_block_start":case"message_delta":break}},pUe=function(){if(this.ended)throw new Hr("stream has ended, this shouldn't happen");let r=$n(this,yR,"f");if(!r)throw new Hr("request ended without sending any chunks");return Qf(this,yR,void 0,"f"),r},pVt=function(r){let n=$n(this,yR,"f");if(r.type==="message_start"){if(n)throw new Hr(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Hr(`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);switch(r.delta.type){case"text_delta":{o?.type==="text"&&(o.text+=r.delta.text);break}case"citations_delta":{o?.type==="text"&&(o.citations??(o.citations=[]),o.citations.push(r.delta.citation));break}case"input_json_delta":{if(o?.type==="tool_use"){let i=o[mVt]||"";i+=r.delta.partial_json,Object.defineProperty(o,mVt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=bfe(i))}break}case"thinking_delta":{o?.type==="thinking"&&(o.thinking+=r.delta.thinking);break}case"signature_delta":{o?.type==="thinking"&&(o.signature=r.delta.signature);break}default:r.delta}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 lO(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var KP,gVt,mUe=b(()=>{HP();uUe();uUe();hVt();KP=class extends Jc{constructor(){super(...arguments),this.batches=new xF(this._client)}create(e,r){return e.model in gVt&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${gVt[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??(e.stream?6e5:this._client._calculateNonstreamingTimeout(e.max_tokens)),...r,stream:e.stream??!1})}stream(e,r){return Rfe.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},gVt={"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","claude-3-sonnet-20240229":"July 21st, 2025","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025"};KP.Batches=xF;KP.MessageBatchesPage=A4});var bR,SF,hUe=b(()=>{HP();UP();PG();bR=class extends Jc{retrieve(e,r){return this._client.get(`/v1/models/${e}`,r)}list(e={},r){return Iy(e)?this.list({},e):this._client.getAPIList("/v1/models",SF,{query:e,...r})}},SF=class extends cO{};bR.ModelInfosPage=SF});var yVt=b(()=>{aVt();aUe();sUe();mUe();hUe()});var bVt,Ii,Ypi,Xpi,_Vt=b(()=>{UP();w_();Kze();yVt();sUe();hUe();aUe();mUe();Ii=class extends hfe{constructor({baseURL:e=yfe("ANTHROPIC_BASE_URL"),apiKey:r=yfe("ANTHROPIC_API_KEY")??null,authToken:n=yfe("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&iVt())throw new Hr(`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 });
`);super({baseURL:i.baseURL,timeout:i.timeout??6e5,httpAgent:i.httpAgent,maxRetries:i.maxRetries,fetch:i.fetch}),this.completions=new wF(this),this.messages=new KP(this),this.models=new bR(this),this.beta=new dO(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&&!EG(r)?r:n!=null&&!EG(n)?n:{}}apiKeyAuth(e){return this.apiKey==null?{}:{"X-Api-Key":this.apiKey}}bearerAuth(e){return this.authToken==null?{}:{Authorization:`Bearer ${this.authToken}`}}};bVt=Ii;Ii.Anthropic=bVt;Ii.HUMAN_PROMPT=`
Human:`;Ii.AI_PROMPT=`
Assistant:`;Ii.DEFAULT_TIMEOUT=6e5;Ii.AnthropicError=Hr;Ii.APIError=Gc;Ii.APIConnectionError=mR;Ii.APIConnectionTimeoutError=x4;Ii.APIUserAbortError=Wd;Ii.NotFoundError=_G;Ii.ConflictError=vG;Ii.RateLimitError=xG;Ii.BadRequestError=gG;Ii.AuthenticationError=yG;Ii.InternalServerError=SG;Ii.PermissionDeniedError=bG;Ii.UnprocessableEntityError=wG;Ii.toFile=YHt;Ii.fileFromPath=sfe;Ii.Completions=wF;Ii.Messages=KP;Ii.Models=bR;Ii.ModelInfosPage=SF;Ii.Beta=dO;({HUMAN_PROMPT:Ypi,AI_PROMPT:Xpi}=Ii)});function gUe(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}var kG,yUe=b(()=>{Mb();kG=class extends gj{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 Ah(`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 Ah(`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)?gUe(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 vVt(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:typeof t=="string"?{type:"tool",name:t}:t}var wVt=b(()=>{});function xVt(t){return t==null||typeof t!="object"||!("type"in t)||t.type!=="image"||!("source"in t)||typeof t.source!="object"||t.source==null||!("type"in t.source)?!1:t.source.type==="base64"?!(!("media_type"in t.source)||typeof t.source.media_type!="string"||!("data"in t.source)||typeof t.source.data!="string"):t.source.type==="url"?!(!("url"in t.source)||typeof t.source.url!="string"):!1}var SVt=b(()=>{});function CVt(t){let e=_B({dataUrl:t});if(e)return{type:"base64",media_type:e.mime_type,data:e.data};let r;try{r=new URL(t)}catch{throw new Error([`Malformed image URL: ${JSON.stringify(t)}. Content blocks of type 'image_url' must be a valid http, https, or base64-encoded data URL.`,"Example: data:image/png;base64,/9j/4AAQSk...","Example: https://example.com/image.jpg"].join(`
`))}if(r.protocol==="http:"||r.protocol==="https:")return{type:"url",url:t};throw new Error([`Invalid image URL protocol: ${JSON.stringify(r.protocol)}. Anthropic only supports images as http, https, or base64-encoded data URLs on 'image_url' content blocks.`,"Example: data:image/png;base64,/9j/4AAQSk...","Example: https://example.com/image.jpg"].join(`
`))}function ign(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 Zs({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else e.push(new Zs({content:[{type:"tool_result",content:bUe(r.content),tool_use_id:r.tool_call_id}]}));else e.push(r);return e}function OVt(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 bUe(t){let e=["tool_use","tool_result","input_json_delta"],r=["text","text_delta"];return typeof t=="string"?t:t.map(o=>{if(Eb(o))return _6(o,agn);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=CVt(o.image_url):a=CVt(o.image_url.url),{type:"image",source:a,...i?{cache_control:i}:{}}}else{if(xVt(o))return o;if(o.type==="document")return{...o,...i?{cache_control:i}:{}};if(o.type==="thinking")return{type:"thinking",thinking:o.thinking,signature:o.signature,...i?{cache_control:i}:{}};if(o.type==="redacted_thinking")return{type:"redacted_thinking",data:o.data,...i?{cache_control:i}:{}};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&&typeof a.input=="string")try{a.input=JSON.parse(a.input)}catch{a.input={}}return{...a,...i?{cache_control:i}:{}}}else throw new Error("Unsupported message content format")}})}function Nfe(t){let e=ign(t),r;e.length>0&&e[0]._getType()==="system"&&(r=t[0].content);let o=(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(Vi(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(OVt)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(OVt)]};{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:bUe(i.content)}}}else return{role:a,content:bUe(i.content)}});return{messages:sgn(o),system:r}}function sgn(t){if(!t||t.length<=1)return t;let e=[],r=t[0],n=i=>typeof i=="string"?[{type:"text",text:i}]:i,o=i=>i.role!=="user"||typeof i.content=="string"?!1:Array.isArray(i.content)&&i.content.every(a=>a.type==="tool_result");for(let i=1;i<t.length;i+=1){let a=t[i];o(r)&&o(a)?r={...r,content:[...n(r.content),...n(a.content)]}:(e.push(r),r=a)}return e.push(r),e}var agn,_Ue=b(()=>{Fs();SVt();agn={providerName:"anthropic",fromStandardTextBlock(t){return{type:"text",text:t.text,..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}},fromStandardImageBlock(t){if(t.source_type==="url"){let e=_B({dataUrl:t.url,asTypedArray:!1});return e?{type:"image",source:{type:"base64",data:e.data,media_type:e.mime_type},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}:{type:"image",source:{type:"url",url:t.url,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}}else{if(t.source_type==="base64")return{type:"image",source:{type:"base64",data:t.data,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}};throw new Error(`Unsupported image source type: ${t.source_type}`)}},fromStandardFileBlock(t){let e=(t.mime_type??"").split(";")[0];if(t.source_type==="url"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"url",url:t.url,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file url source: ${t.mime_type}`)}else if(t.source_type==="text"){if(e==="text/plain"||e==="")return{type:"document",source:{type:"text",data:t.text,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file text source: ${t.mime_type}`)}else if(t.source_type==="base64"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"base64",data:t.data,media_type:"application/pdf"},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};if(["image/jpeg","image/png","image/gif","image/webp"].includes(e))return{type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:t.data,media_type:e}}]},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file base64 source: ${t.mime_type}`)}else throw new Error(`Unsupported file source type: ${t.source_type}`)}}});function EVt(t,e){if(t.type==="message_start"){let{content:r,usage:n,...o}=t.message,i={};for(let[c,d]of Object.entries(o))d!=null&&(i[c]=d);let{input_tokens:a,output_tokens:s,...u}=n??{},l={input_tokens:a,output_tokens:s,total_tokens:a+s,input_token_details:{cache_creation:u.cache_creation_input_tokens,cache_read:u.cache_read_input_tokens}};return{chunk:new xr({content:e.coerceContentToString?"":[],additional_kwargs:i,usage_metadata:e.streamUsage?l:void 0,response_metadata:{usage:{...u}},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,input_token_details:{cache_creation:t.usage.cache_creation_input_tokens,cache_read:t.usage.cache_read_input_tokens}};return{chunk:new xr({content:e.coerceContentToString?"":[],additional_kwargs:{...t.delta},usage_metadata:e.streamUsage?r:void 0})}}else if(t.type==="content_block_start"&&["tool_use","document"].includes(t.content_block.type)){let r=t.content_block,n;return r.type==="tool_use"?n=[{id:r.id,index:t.index,name:r.name,args:""}]:n=[],{chunk:new xr({content:e.coerceContentToString?"":[{index:t.index,...t.content_block,input:""}],additional_kwargs:{},tool_call_chunks:n})}}else if(t.type==="content_block_delta"&&["text_delta","citations_delta","thinking_delta","signature_delta"].includes(t.delta.type)){if(e.coerceContentToString&&"text"in t.delta)return{chunk:new xr({content:t.delta.text})};{let r=t.delta;return"citation"in r&&(r.citations=[r.citation],delete r.citation),r.type==="thinking_delta"||r.type==="signature_delta"?{chunk:new xr({content:[{index:t.index,...r,type:"thinking"}]})}:{chunk:new xr({content:[{index:t.index,...r,type:"text"}]})}}}else{if(t.type==="content_block_delta"&&t.delta.type==="input_json_delta")return{chunk:new xr({content:e.coerceContentToString?"":[{index:t.index,input:t.delta.partial_json,type:t.delta.type}],additional_kwargs:{},tool_call_chunks:[{index:t.index,args:t.delta.partial_json}]})};if(t.type==="content_block_start"&&t.content_block.type==="text"){let r=t.content_block?.text;if(r!==void 0)return{chunk:new xr({content:e.coerceContentToString?r:[{index:t.index,...t.content_block}],additional_kwargs:{}})}}else{if(t.type==="content_block_start"&&t.content_block.type==="redacted_thinking")return{chunk:new xr({content:e.coerceContentToString?"":[{index:t.index,...t.content_block}]})};if(t.type==="content_block_start"&&t.content_block.type==="thinking"){let r=t.content_block.thinking;return{chunk:new xr({content:e.coerceContentToString?r:[{index:t.index,...t.content_block}]})}}}}return null}function PVt(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),input_token_details:{cache_creation:r.cache_creation_input_tokens,cache_read:r.cache_read_input_tokens}}:void 0;if(t.length===1&&t[0].type==="text")return[{text:t[0].text,message:new Fn({content:t[0].text,additional_kwargs:e,usage_metadata:n,response_metadata:e,id:e.id})}];{let o=gUe(t);return[{text:"",message:new Fn({content:t,additional_kwargs:e,tool_calls:o,usage_metadata:n,response_metadata:e,id:e.id})}]}}var TVt=b(()=>{Fs();yUe()});function jfe(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function vUe(t){let e;return t.status===400&&t.message.includes("tool")?e=jfe(t,"INVALID_TOOL_RESULTS"):t.status===401?e=jfe(t,"MODEL_AUTHENTICATION"):t.status===404?e=jfe(t,"MODEL_NOT_FOUND"):t.status===429?e=jfe(t,"MODEL_RATE_LIMIT"):e=t,e}var AVt=b(()=>{});function ugn(t){return!!(t.tools&&t.tools.length>0)}function lgn(t){for(let e of t.messages??[])if(typeof e.content!="string"){for(let r of e.content??[])if(typeof r=="object"&&r!=null&&r.type==="document"&&typeof r.citations=="object"&&r.citations.enabled)return!0}return!1}function cgn(t){return!!(t.thinking&&t.thinking.type==="enabled")}function dgn(t){return"input_schema"in t}function fgn(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 wUe,Dfe,IVt=b(()=>{_Vt();Fs();Gf();to();UC();tg();Ug();Om();PL();rg();yUe();wVt();_Ue();TVt();AVt();wUe=class extends Cu{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,"thinking",{enumerable:!0,configurable:!0,writable:!0,value:{type:"disabled"}}),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??ct("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.thinking=e?.thinking??this.thinking,this.createClient=e?.createClient??(r=>new Ii(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(dgn(r))return r;if(kd(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(Hc(r))return{name:r.name,description:r.description,input_schema:xv(r.schema)?os(r.schema):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=vVt(e?.tool_choice);if(this.thinking.type==="enabled"){if(this.topK!==-1)throw new Error("topK is not supported when thinking is enabled");if(this.topP!==-1)throw new Error("topP is not supported when thinking is enabled");if(this.temperature!==1)throw new Error("temperature is not supported when thinking is enabled");return{model:this.model,stop_sequences:e?.stop??this.stopSequences,stream:this.streaming,max_tokens:this.maxTokens,tools:this.formatStructuredToolToAnthropic(e?.tools),tool_choice:r,thinking:this.thinking,...this.invocationKwargs}}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,thinking:this.thinking,...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=Nfe(e),a={...o,...i,stream:!0},s=!ugn(a)&&!lgn(a)&&!cgn(a),u=await this.createStreamWithRetry(a,{headers:r.headers});for await(let l of u){if(r.signal?.aborted)throw u.controller.abort(),new Error("AbortError: User aborted the request.");let c=this.streamUsage??r.streamUsage,d=EVt(l,{streamUsage:c,coerceContentToString:s});if(!d)continue;let{chunk:f}=d,p=fgn(f),h=new so({message:new xr({content:f.content,additional_kwargs:f.additional_kwargs,tool_call_chunks:f.tool_call_chunks,usage_metadata:c?f.usage_metadata:void 0,response_metadata:f.response_metadata,id:f.id}),text:p??""});yield h,await n?.handleLLMNewToken(p??"",void 0,void 0,void 0,void 0,{chunk:h})}}async _generateNonStreaming(e,r,n){let o=await this.completionWithRetry({...r,stream:!1,...Nfe(e)},n),{content:i,...a}=o,s=PVt(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()=>{try{return await this.streamingClient.messages.create({...e,...this.invocationKwargs,stream:!0},r)}catch(o){throw vUe(o)}};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()=>{try{return await this.batchClient.messages.create({...e,...this.invocationKwargs},r)}catch(o){throw vUe(o)}};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(xv(n)){let h=os(n);l=[{name:s,description:h.description??"A function available to call.",input_schema:h}],u=new kG({returnSingle:!0,keyName:s,zodSchema:n})}else{let h;typeof n.name=="string"&&typeof n.description=="string"&&typeof n.input_schema=="object"&&n.input_schema!=null?(h=n,s=n.name):h={name:s,description:n.description??"",input_schema:n},l=[h],u=new kG({returnSingle:!0,keyName:s})}let c;if(this.thinking?.type==="enabled"){let h="Anthropic structured output relies on forced tool calling, which is not supported when `thinking` is enabled. This method will raise OutputParserException if tool calls are not generated. Consider disabling `thinking` or adjust your prompt to ensure the tool is called.";console.warn(h),c=this.bind({tools:l});let m=g=>{if(!g.tool_calls||g.tool_calls.length===0)throw new Error(h);return g};c=c.pipe(m)}else c=this.bind({tools:l,tool_choice:{type:"tool",name:s}});if(!a)return c.pipe(u).withConfig({runName:"ChatAnthropicStructuredOutput"});let d=jo.assign({parsed:(h,m)=>u.invoke(h.raw,m)}),f=jo.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return ji.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},Dfe=class extends wUe{}});var MVt=b(()=>{_Ue()});var RVt=b(()=>{IVt();MVt()});var NVt=b(()=>{RVt()});var Lfe,Ffe,jVt,xUe=b(()=>{Lfe="RFC3986",Ffe={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},jVt="RFC1738"});function LVt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function CUe(t,e){if(pgn(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var pgn,fO,SUe,DVt,FVt=b(()=>{xUe();pgn=Array.isArray,fO=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),SUe=1024,DVt=(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+=SUe){let u=i.length>=SUe?i.slice(s,s+SUe):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===jVt&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=fO[d];continue}if(d<2048){l[l.length]=fO[192|d>>6]+fO[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=fO[224|d>>12]+fO[128|d>>6&63]+fO[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=fO[240|d>>18]+fO[128|d>>12&63]+fO[128|d>>6&63]+fO[128|d&63]}a+=l.join("")}return a}});function ygn(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function BVt(t,e,r,n,o,i,a,s,u,l,c,d,f,p,h,m,g,y){let _=t,w=y,S=0,C=!1;for(;(w=w.get(OUe))!==void 0&&!C;){let N=w.get(t);if(S+=1,typeof N<"u"){if(N===S)throw new RangeError("Cyclic object value");C=!0}typeof w.get(OUe)>"u"&&(S=0)}if(typeof l=="function"?_=l(e,_):_ instanceof Date?_=f?.(_):r==="comma"&&pO(_)&&(_=CUe(_,function(N){return N instanceof Date?f?.(N):N})),_===null){if(i)return u&&!m?u(e,_c.encoder,g,"key",p):e;_=""}if(ygn(_)||LVt(_)){if(u){let N=m?e:u(e,_c.encoder,g,"key",p);return[h?.(N)+"="+h?.(u(_,_c.encoder,g,"value",p))]}return[h?.(e)+"="+h?.(String(_))]}let E=[];if(typeof _>"u")return E;let P;if(r==="comma"&&pO(_))m&&u&&(_=CUe(_,u)),P=[{value:_.length>0?_.join(",")||null:void 0}];else if(pO(l))P=l;else{let N=Object.keys(_);P=c?N.sort(c):N}let T=s?String(e).replace(/\./g,"%2E"):String(e),I=n&&pO(_)&&_.length===1?T+"[]":T;if(o&&pO(_)&&_.length===0)return I+"[]";for(let N=0;N<P.length;++N){let M=P[N],D=typeof M=="object"&&typeof M.value<"u"?M.value:_[M];if(a&&D===null)continue;let k=d&&s?M.replace(/\./g,"%2E"):M,F=pO(_)?typeof r=="function"?r(I,k):I:I+(d?"."+k:"["+k+"]");y.set(t,S);let K=new WeakMap;K.set(OUe,y),$Vt(E,BVt(D,F,r,n,o,i,a,s,r==="comma"&&m&&pO(_)?null:u,l,c,d,f,p,h,m,g,K))}return E}function bgn(t=_c){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||_c.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=Lfe;if(typeof t.format<"u"){if(!mgn.call(Ffe,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=Ffe[r],o=_c.filter;(typeof t.filter=="function"||pO(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in kVt?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=_c.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:_c.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:_c.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:_c.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:_c.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?_c.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:_c.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:_c.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:_c.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:_c.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:_c.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:_c.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:_c.strictNullHandling}}function EUe(t,e={}){let r=t,n=bgn(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):pO(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=kVt[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||$Vt(a,BVt(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 mgn,kVt,pO,hgn,$Vt,ggn,_c,OUe,zVt=b(()=>{FVt();xUe();mgn=Object.prototype.hasOwnProperty,kVt={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},pO=Array.isArray,hgn=Array.prototype.push,$Vt=function(t,e){hgn.apply(t,pO(e)?e:[e])},ggn=Date.prototype.toISOString,_c={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:DVt,encodeValuesOnly:!1,format:Lfe,formatter:Ffe[Lfe],indices:!1,serializeDate(t){return ggn.call(t)},skipNulls:!1,strictNullHandling:!1};OUe={}});var UVt=b(()=>{zVt()});var CF,qVt=b(()=>{CF="4.95.1"});function VVt(t,e={auto:!1}){if(HVt)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(OF)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${OF}'\``);HVt=e.auto,OF=t.kind,PUe=t.fetch,vgn=t.Request,wgn=t.Response,xgn=t.Headers,TUe=t.FormData,Sgn=t.Blob,kfe=t.File,AUe=t.ReadableStream,IUe=t.getMultipartRequestOptions,MUe=t.getDefaultAgent,$fe=t.fileFromPath,RUe=t.isFsReadStream}var HVt,OF,PUe,vgn,wgn,xgn,TUe,Sgn,kfe,AUe,IUe,MUe,$fe,RUe,NUe=b(()=>{HVt=!1});var Bfe,WVt=b(()=>{Bfe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function KVt({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 Bfe(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 GVt=b(()=>{WVt()});var JVt=b(()=>{GVt()});var jUe,$G=b(()=>{NUe();JVt();NUe();jUe=()=>{OF||VVt(KVt(),{auto:!0})};jUe()});var qt,Au,Ia,GP,ug,M4,R4,N4,j4,D4,L4,F4,k4,$4,B4,nh=b(()=>{po();qt=class extends Error{},Au=class t extends qt{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 GP({message:n,cause:zfe(r)});let i=r?.error;return e===400?new M4(e,i,n,o):e===401?new R4(e,i,n,o):e===403?new N4(e,i,n,o):e===404?new j4(e,i,n,o):e===409?new D4(e,i,n,o):e===422?new L4(e,i,n,o):e===429?new F4(e,i,n,o):e>=500?new k4(e,i,n,o):new t(e,i,n,o)}},Ia=class extends Au{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},GP=class extends Au{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},ug=class extends GP{constructor({message:e}={}){super({message:e??"Request timed out."})}},M4=class extends Au{},R4=class extends Au{},N4=class extends Au{},j4=class extends Au{},D4=class extends Au{},L4=class extends Au{},F4=class extends Au{},k4=class extends Au{},$4=class extends qt{constructor(){super("Could not parse response content as the length limit was reached")}},B4=class extends qt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}});function Pgn(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 ZVt(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}var Ufe,EF,lg,PF,YVt=b(()=>{nh();Ufe=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},EF=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)},PF=class{constructor(){lg.set(this,void 0),this.buffer=new Uint8Array,Ufe(this,lg,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=Pgn(this.buffer,EF(this,lg,"f")))!=null;){if(i.carriage&&EF(this,lg,"f")==null){Ufe(this,lg,i.index,"f");continue}if(EF(this,lg,"f")!=null&&(i.index!==EF(this,lg,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,EF(this,lg,"f")-1))),this.buffer=this.buffer.slice(EF(this,lg,"f")),Ufe(this,lg,null,"f");continue}let a=EF(this,lg,"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),Ufe(this,lg,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 qt(`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 qt(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new qt("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
`):[]}};lg=new WeakMap;PF.NEWLINE_CHARS=new Set([`
`,"\r"]);PF.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function DUe(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 XVt=b(()=>{});async function*Tgn(t,e){if(!t.body)throw e.abort(),new qt("Attempted to iterate over a response with no body");let r=new LUe,n=new PF,o=DUe(t.body);for await(let i of Agn(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*Agn(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=ZVt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function Ign(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var mO,LUe,qfe=b(()=>{$G();nh();YVt();XVt();po();nh();mO=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 Tgn(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 Au(void 0,s.error,void 0,FUe(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 Au(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 PF,s=DUe(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 AUe({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?.()}})}};LUe=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]=Ign(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function BUe(t,e,r){if(t=await t,e6t(t))return t;if(QVt(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=BG(o)?[await o.arrayBuffer()]:[o];return new kfe(i,e,r)}let n=await Rgn(t);if(e||(e=jgn(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new kfe(n,e,r)}async function Rgn(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(BG(t))e.push(await t.arrayBuffer());else if(Dgn(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${Ngn(t)}`);return e}function Ngn(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function jgn(t){return kUe(t.name)||kUe(t.filename)||kUe(t.path)?.split(/[\\/]/).pop()}var QVt,e6t,BG,Mgn,kUe,Dgn,zUe,Ny,t6t,$Ue,Hfe=b(()=>{$G();$G();QVt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",e6t=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&BG(t),BG=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",Mgn=t=>e6t(t)||QVt(t)||RUe(t);kUe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},Dgn=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",zUe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",Ny=async t=>{let e=await t6t(t.body);return IUe(e,t)},t6t=async t=>{let e=new TUe;return await Promise.all(Object.entries(t||{}).map(([r,n])=>$Ue(e,r,n))),e},$Ue=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(Mgn(r)){let n=await BUe(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>$Ue(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>$Ue(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`)}}});async function s6t(t){let{response:e}=t;if(t.options.stream)return JP("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):mO.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 JP("response",e.status,e.url,e.headers,a),u6t(a,e)}let i=await e.text();return JP("response",e.status,e.url,e.headers,i),i}function u6t(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})}function zgn(){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}function l6t(t){if(!t)return!0;for(let e in t)return!1;return!0}function c6t(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function i6t(t,e){for(let r in e){if(!c6t(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 JP(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)a6t.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)a6t.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${t}`,...r)}}function qG(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var Fgn,kgn,Vfe,Kfe,Gfe,zG,qUe,FUe,$gn,mn,Bgn,r6t,n6t,o6t,Ugn,qgn,Hgn,Vgn,ZP,UUe,zfe,UG,a6t,Wgn,d6t,Kgn,Wfe,f6t,po=b(()=>{qVt();qfe();nh();$G();Hfe();Hfe();Fgn=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},kgn=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)};jUe();Kfe=class t extends Promise{constructor(e,r=s6t){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>u6t(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)}},Gfe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=UUe("maxRetries",r),this.timeout=UUe("timeout",n),this.httpAgent=o,this.fetch=i??PUe}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...Ugn(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${Wgn()}`}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&&BG(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:zUe(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&&UUe("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let d=n.httpAgent??this.httpAgent??MUe(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 i6t(i,a),i6t(i,r),zUe(e.body)&&OF!=="node"&&delete i["content-type"],Wfe(a,"x-stainless-retry-count")===void 0&&Wfe(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),Wfe(a,"x-stainless-timeout")===void 0&&Wfe(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 Au.generate(e,r,n,o)}request(e,r=null){return new Kfe(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}),JP("request",a,n,i.headers),n.signal?.aborted)throw new Ia;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(zfe);if(l instanceof Error){if(n.signal?.aborted)throw new Ia;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new ug:new GP({cause:l})}let c=FUe(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let g=`retrying, ${r} attempts remaining`;return JP(`response (error; ${g})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(g=>zfe(g).message),f=qgn(d),p=f?void 0:d;throw JP(`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 qUe(this,n,e)}buildURL(e,r){let n=Vgn(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return l6t(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 qt(`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 ZP(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 ${CF}`}},zG=class{constructor(e,r,n,o){Vfe.set(this,void 0),Fgn(this,Vfe,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 qt("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 kgn(this,Vfe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Vfe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},qUe=class extends Kfe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await s6t(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},FUe=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),$gn={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},mn=t=>typeof t=="object"&&t!==null&&!l6t(t)&&Object.keys(t).every(e=>c6t($gn,e)),Bgn=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":CF,"X-Stainless-OS":n6t(Deno.build.os),"X-Stainless-Arch":r6t(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":CF,"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":CF,"X-Stainless-OS":n6t(process.platform),"X-Stainless-Arch":r6t(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=zgn();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":CF,"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":CF,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};r6t=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",n6t=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"),Ugn=()=>o6t??(o6t=Bgn()),qgn=t=>{try{return JSON.parse(t)}catch{return}},Hgn=/^[a-z][a-z0-9+.-]*:/i,Vgn=t=>Hgn.test(t),ZP=t=>new Promise(e=>setTimeout(e,t)),UUe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new qt(`${t} must be an integer`);if(e<0)throw new qt(`${t} must be a positive integer`);return e},zfe=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)},UG=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};a6t=new Set(["authorization","api-key"]);Wgn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),d6t=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",Kgn=t=>typeof t?.get=="function",Wfe=(t,e)=>{let r=e.toLowerCase();if(Kgn(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},f6t=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))}}});var hO,So,Zc=b(()=>{po();hO=class extends zG{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}},So=class extends zG{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 it,Cn=b(()=>{it=class{constructor(e){this._client=e}}});var z4,HUe=b(()=>{Cn();po();HG();z4=class extends it{list(e,r={},n){return mn(r)?this.list(e,{},r):this._client.getAPIList(`/chat/completions/${e}/messages`,Jfe,{query:r,...n})}}});var vR,wR,Jfe,HG=b(()=>{Cn();po();HUe();HUe();Zc();vR=class extends it{constructor(){super(...arguments),this.messages=new z4(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 mn(e)?this.list({},e):this._client.getAPIList("/chat/completions",wR,{query:e,...r})}del(e,r){return this._client.delete(`/chat/completions/${e}`,r)}},wR=class extends So{},Jfe=class extends So{};vR.ChatCompletionsPage=wR;vR.Messages=z4});var YP,VUe=b(()=>{Cn();HG();HG();YP=class extends it{constructor(){super(...arguments),this.completions=new vR(this._client)}};YP.Completions=vR;YP.ChatCompletionsPage=wR});var p6t=b(()=>{VUe()});var m6t=b(()=>{});var U4,WUe=b(()=>{Cn();U4=class extends it{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var q4,KUe=b(()=>{Cn();po();q4=class extends it{create(e,r){return this._client.post("/audio/transcriptions",Ny({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}}))}}});var H4,GUe=b(()=>{Cn();po();H4=class extends it{create(e,r){return this._client.post("/audio/translations",Ny({body:e,...r,__metadata:{model:e.model}}))}}});var gO,JUe=b(()=>{Cn();WUe();WUe();KUe();KUe();GUe();GUe();gO=class extends it{constructor(){super(...arguments),this.transcriptions=new q4(this._client),this.translations=new H4(this._client),this.speech=new U4(this._client)}};gO.Transcriptions=q4;gO.Translations=H4;gO.Speech=U4});var xR,TF,ZUe=b(()=>{Cn();po();Zc();xR=class extends it{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 mn(e)?this.list({},e):this._client.getAPIList("/batches",TF,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},TF=class extends So{};xR.BatchesPage=TF});var AF,V4,YUe=b(()=>{Cn();po();Zc();AF=class extends it{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 mn(e)?this.list({},e):this._client.getAPIList("/assistants",V4,{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}})}},V4=class extends So{};AF.AssistantsPage=V4});function XUe(t){return typeof t.parse=="function"}var h6t=b(()=>{});var SR,QUe,eqe,tqe=b(()=>{SR=t=>t?.role==="assistant",QUe=t=>t?.role==="function",eqe=t=>t?.role==="tool"});var x_,bs,rqe,Zfe,Yfe,VG,WG,Xfe,KG,XP,GG,Qfe,epe,W4,g6t,CR,tpe=b(()=>{nh();x_=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},bs=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)},CR=class{constructor(){rqe.add(this),this.controller=new AbortController,Zfe.set(this,void 0),Yfe.set(this,()=>{}),VG.set(this,()=>{}),WG.set(this,void 0),Xfe.set(this,()=>{}),KG.set(this,()=>{}),XP.set(this,{}),GG.set(this,!1),Qfe.set(this,!1),epe.set(this,!1),W4.set(this,!1),x_(this,Zfe,new Promise((e,r)=>{x_(this,Yfe,e,"f"),x_(this,VG,r,"f")}),"f"),x_(this,WG,new Promise((e,r)=>{x_(this,Xfe,e,"f"),x_(this,KG,r,"f")}),"f"),bs(this,Zfe,"f").catch(()=>{}),bs(this,WG,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},bs(this,rqe,"m",g6t).bind(this))},0)}_connected(){this.ended||(bs(this,Yfe,"f").call(this),this._emit("connect"))}get ended(){return bs(this,GG,"f")}get errored(){return bs(this,Qfe,"f")}get aborted(){return bs(this,epe,"f")}abort(){this.controller.abort()}on(e,r){return(bs(this,XP,"f")[e]||(bs(this,XP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=bs(this,XP,"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(bs(this,XP,"f")[e]||(bs(this,XP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{x_(this,W4,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){x_(this,W4,!0,"f"),await bs(this,WG,"f")}_emit(e,...r){if(bs(this,GG,"f"))return;e==="end"&&(x_(this,GG,!0,"f"),bs(this,Xfe,"f").call(this));let n=bs(this,XP,"f")[e];if(n&&(bs(this,XP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!bs(this,W4,"f")&&!n?.length&&Promise.reject(o),bs(this,VG,"f").call(this,o),bs(this,KG,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!bs(this,W4,"f")&&!n?.length&&Promise.reject(o),bs(this,VG,"f").call(this,o),bs(this,KG,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Zfe=new WeakMap,Yfe=new WeakMap,VG=new WeakMap,WG=new WeakMap,Xfe=new WeakMap,KG=new WeakMap,XP=new WeakMap,GG=new WeakMap,Qfe=new WeakMap,epe=new WeakMap,W4=new WeakMap,rqe=new WeakSet,g6t=function(e){if(x_(this,Qfe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Ia),e instanceof Ia)return x_(this,epe,!0,"f"),this._emit("abort",e);if(e instanceof qt)return this._emit("error",e);if(e instanceof Error){let r=new qt(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new qt(String(e)))}});function y6t(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function JG(t){return t?.$brand==="auto-parseable-response-format"}function b6t(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 IF(t){return t?.$brand==="auto-parseable-tool"}function _6t(t,e){return!e||!nqe(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}}))}:ZG(t,e)}function ZG(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new $4;if(n.finish_reason==="content_filter")throw new B4;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>tyn(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?eyn(e,n.message.content):null}}});return{...t,choices:r}}function eyn(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 tyn(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:IF(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function v6t(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return IF(r)||r?.function.strict||!1}function nqe(t){return JG(t.response_format)?!0:t.tools?.some(e=>IF(e)||e.type==="function"&&e.function.strict===!0)??!1}function w6t(t){for(let e of t??[]){if(e.type!=="function")throw new qt(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new qt(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var K4=b(()=>{nh()});var oh,ep,oqe,rpe,iqe,aqe,sqe,S6t,uqe,x6t,G4,lqe=b(()=>{nh();h6t();tqe();tpe();K4();oh=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)},x6t=10,G4=class extends CR{constructor(){super(...arguments),ep.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),(QUe(e)||eqe(e))&&e.content)this._emit("functionCallResult",e.content);else if(SR(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(SR(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 qt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),oh(this,ep,"m",oqe).call(this)}async finalMessage(){return await this.done(),oh(this,ep,"m",rpe).call(this)}async finalFunctionCall(){return await this.done(),oh(this,ep,"m",iqe).call(this)}async finalFunctionCallResult(){return await this.done(),oh(this,ep,"m",aqe).call(this)}async totalUsage(){return await this.done(),oh(this,ep,"m",sqe).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=oh(this,ep,"m",rpe).call(this);r&&this._emit("finalMessage",r);let n=oh(this,ep,"m",oqe).call(this);n&&this._emit("finalContent",n);let o=oh(this,ep,"m",iqe).call(this);o&&this._emit("finalFunctionCall",o);let i=oh(this,ep,"m",aqe).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",oh(this,ep,"m",sqe).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),oh(this,ep,"m",S6t).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(ZG(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=x6t}=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 h=(await this._createChatCompletion(e,{...s,function_call:i,functions:d,messages:[...this.messages]},n)).choices[0]?.message;if(!h)throw new qt("missing message in ChatCompletion response");if(!h.function_call)return;let{name:m,arguments:g}=h.function_call,y=c[m];if(y){if(u&&u!==m){let C=`Invalid function_call: ${JSON.stringify(m)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,name:m,content:C});continue}}else{let C=`Invalid function_call: ${JSON.stringify(m)}. Available options are: ${d.map(E=>JSON.stringify(E.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:m,content:C});continue}let _;try{_=XUe(y)?await y.parse(g):g}catch(C){this._addMessage({role:o,name:m,content:C instanceof Error?C.message:String(C)});continue}let w=await y.function(_,this),S=oh(this,ep,"m",uqe).call(this,w);if(this._addMessage({role:o,name:m,content:S}),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=x6t}=n||{},c=r.tools.map(p=>{if(IF(p)){if(!p.$callback)throw new qt("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 m=(await this._createChatCompletion(e,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!m)throw new qt("missing message in ChatCompletion response");if(!m.tool_calls?.length)return;for(let g of m.tool_calls){if(g.type!=="function")continue;let y=g.id,{name:_,arguments:w}=g.function,S=d[_];if(S){if(u&&u!==_){let T=`Invalid tool_call: ${JSON.stringify(_)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:y,content:T});continue}}else{let T=`Invalid tool_call: ${JSON.stringify(_)}. Available options are: ${Object.keys(d).map(I=>JSON.stringify(I)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:y,content:T});continue}let C;try{C=XUe(S)?await S.parse(w):w}catch(T){let I=T instanceof Error?T.message:String(T);this._addMessage({role:o,tool_call_id:y,content:I});continue}let E=await S.function(C,this),P=oh(this,ep,"m",uqe).call(this,E);if(this._addMessage({role:o,tool_call_id:y,content:P}),u)return}}}};ep=new WeakSet,oqe=function(){return oh(this,ep,"m",rpe).call(this).content??null},rpe=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(SR(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 qt("stream ended without producing a ChatCompletionMessage with role=assistant")},iqe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(SR(r)&&r?.function_call)return r.function_call;if(SR(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},aqe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(QUe(r)&&r.content!=null||eqe(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}},sqe=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},S6t=function(e){if(e.n!=null&&e.n>1)throw new qt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},uqe=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var YG,C6t=b(()=>{lqe();tqe();YG=class t extends G4{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),SR(e)&&e.content&&this._emit("content",e.content)}}});function ryn(t,e=Yc.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return nyn(t.trim(),e)}var Yc,cqe,dqe,nyn,fqe,O6t=b(()=>{Yc={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},cqe=class extends Error{},dqe=class extends Error{};nyn=(t,e)=>{let r=t.length,n=0,o=f=>{throw new cqe(`${f} at position ${n}`)},i=f=>{throw new dqe(`${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"||Yc.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Yc.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Yc.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Yc.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Yc.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||Yc.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(h){i(String(h))}else if(Yc.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&&Yc.OBJ&e)return f;let p=s();d(),n++;try{let h=a();Object.defineProperty(f,p,{value:h,writable:!0,enumerable:!0,configurable:!0})}catch(h){if(Yc.OBJ&e)return f;throw h}d(),t[n]===","&&n++}}catch{if(Yc.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(Yc.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&Yc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Yc.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&&!(Yc.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Yc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(h){i(String(h))}}},d=()=>{for(;n<r&&`
\r `.includes(t[n]);)n++};return a()},fqe=t=>ryn(t,Yc.ALL^Yc.NUM)});function oyn(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 qt(`missing finish_reason for choice ${d}`);let{content:h=null,function_call:m,tool_calls:g,...y}=l,_=l.role;if(!_)throw new qt(`missing role for choice ${d}`);if(m){let{arguments:w,name:S}=m;if(w==null)throw new qt(`missing function_call.arguments for choice ${d}`);if(!S)throw new qt(`missing function_call.name for choice ${d}`);return{...p,message:{content:h,function_call:{arguments:w,name:S},role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return g?{...p,index:d,finish_reason:c,logprobs:f,message:{...y,role:_,content:h,refusal:l.refusal??null,tool_calls:g.map((w,S)=>{let{function:C,type:E,id:P,...T}=w,{arguments:I,name:N,...M}=C||{};if(P==null)throw new qt(`missing choices[${d}].tool_calls[${S}].id
${ipe(t)}`);if(E==null)throw new qt(`missing choices[${d}].tool_calls[${S}].type
${ipe(t)}`);if(N==null)throw new qt(`missing choices[${d}].tool_calls[${S}].function.name
${ipe(t)}`);if(I==null)throw new qt(`missing choices[${d}].tool_calls[${S}].function.arguments
${ipe(t)}`);return{...T,id:P,type:E,function:{...M,name:N,arguments:I}}})}}:{...p,message:{...y,content:h,role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return _6t(u,e)}function ipe(t){return JSON.stringify(t)}var J4,Ji,vc,QP,Z4,OR,pqe,npe,mqe,hqe,gqe,ope,yqe,E6t,Y4,bqe=b(()=>{nh();lqe();qfe();K4();O6t();J4=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},Ji=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)},Y4=class t extends G4{constructor(e){super(),vc.add(this),QP.set(this,void 0),Z4.set(this,void 0),OR.set(this,void 0),J4(this,QP,e,"f"),J4(this,Z4,[],"f")}get currentChatCompletionSnapshot(){return Ji(this,OR,"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())),Ji(this,vc,"m",pqe).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)Ji(this,vc,"m",mqe).call(this,a);if(i.controller.signal?.aborted)throw new Ia;return this._addChatCompletion(Ji(this,vc,"m",ope).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Ji(this,vc,"m",pqe).call(this),this._connected();let o=mO.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(Ji(this,vc,"m",ope).call(this)),Ji(this,vc,"m",mqe).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new Ia;return this._addChatCompletion(Ji(this,vc,"m",ope).call(this))}[(QP=new WeakMap,Z4=new WeakMap,OR=new WeakMap,vc=new WeakSet,pqe=function(){this.ended||J4(this,OR,void 0,"f")},npe=function(r){let n=Ji(this,Z4,"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},Ji(this,Z4,"f")[r.index]=n,n)},mqe=function(r){if(this.ended)return;let n=Ji(this,vc,"m",E6t).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=Ji(this,vc,"m",npe).call(this,i);i.finish_reason&&(Ji(this,vc,"m",gqe).call(this,i),a.current_tool_call_index!=null&&Ji(this,vc,"m",hqe).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(Ji(this,vc,"m",gqe).call(this,i),a.current_tool_call_index!=null&&Ji(this,vc,"m",hqe).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))}}},hqe=function(r,n){if(Ji(this,vc,"m",npe).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=Ji(this,QP,"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:IF(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},gqe=function(r){let n=Ji(this,vc,"m",npe).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=Ji(this,vc,"m",yqe).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}))},ope=function(){if(this.ended)throw new qt("stream has ended, this shouldn't happen");let r=Ji(this,OR,"f");if(!r)throw new qt("request ended without sending any chunks");return J4(this,OR,void 0,"f"),J4(this,Z4,[],"f"),oyn(r,Ji(this,QP,"f"))},yqe=function(){let r=Ji(this,QP,"f")?.response_format;return JG(r)?r:null},E6t=function(r){var n,o,i,a;let s=Ji(this,OR,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=J4(this,OR,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...h}of r.choices){let m=s.choices[f];if(m||(m=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...h}),p)if(!m.logprobs)m.logprobs=Object.assign({},p);else{let{content:E,refusal:P,...T}=p;Object.assign(m.logprobs,T),E&&((n=m.logprobs).content??(n.content=[]),m.logprobs.content.push(...E)),P&&((o=m.logprobs).refusal??(o.refusal=[]),m.logprobs.refusal.push(...P))}if(d&&(m.finish_reason=d,Ji(this,QP,"f")&&nqe(Ji(this,QP,"f")))){if(d==="length")throw new $4;if(d==="content_filter")throw new B4}if(Object.assign(m,h),!c)continue;let{content:g,refusal:y,function_call:_,role:w,tool_calls:S,...C}=c;if(Object.assign(m.message,C),y&&(m.message.refusal=(m.message.refusal||"")+y),w&&(m.message.role=w),_&&(m.message.function_call?(_.name&&(m.message.function_call.name=_.name),_.arguments&&((i=m.message.function_call).arguments??(i.arguments=""),m.message.function_call.arguments+=_.arguments)):m.message.function_call=_),g&&(m.message.content=(m.message.content||"")+g,!m.message.refusal&&Ji(this,vc,"m",yqe).call(this)&&(m.message.parsed=fqe(m.message.content))),S){m.message.tool_calls||(m.message.tool_calls=[]);for(let{index:E,id:P,type:T,function:I,...N}of S){let M=(a=m.message.tool_calls)[E]??(a[E]={});Object.assign(M,N),P&&(M.id=P),T&&(M.type=T),I&&(M.function??(M.function={name:I.name??"",arguments:""})),I?.name&&(M.function.name=I.name),I?.arguments&&(M.function.arguments+=I.arguments,v6t(Ji(this,QP,"f"),M)&&(M.function.parsed_arguments=fqe(M.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 mO(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var XG,P6t=b(()=>{bqe();XG=class t extends Y4{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 QG,T6t=b(()=>{Cn();C6t();P6t();bqe();K4();QG=class extends it{parse(e,r){return w6t(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>ZG(n,e))}runFunctions(e,r){return e.stream?XG.runFunctions(this._client,e,r):YG.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?XG.runTools(this._client,e,r):YG.runTools(this._client,e,r)}stream(e,r){return Y4.createChatCompletion(this._client,e,r)}}});var X4,A6t=b(()=>{Cn();T6t();X4=class extends it{constructor(){super(...arguments),this.completions=new QG(this._client)}};(function(t){t.Completions=QG})(X4||(X4={}))});var Q4,_qe=b(()=>{Cn();Q4=class extends it{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var e3,vqe=b(()=>{Cn();e3=class extends it{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var ER,wqe=b(()=>{Cn();_qe();_qe();vqe();vqe();ER=class extends it{constructor(){super(...arguments),this.sessions=new Q4(this._client),this.transcriptionSessions=new e3(this._client)}};ER.Sessions=Q4;ER.TranscriptionSessions=e3});var or,cg,Kd,xqe,yO,ape,S_,RF,t3,MF,lpe,dg,spe,upe,rJ,eJ,tJ,I6t,M6t,R6t,N6t,j6t,D6t,L6t,bO,Sqe=b(()=>{po();qfe();nh();tpe();or=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)},cg=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},bO=class t extends CR{constructor(){super(...arguments),Kd.add(this),xqe.set(this,[]),yO.set(this,{}),ape.set(this,{}),S_.set(this,void 0),RF.set(this,void 0),t3.set(this,void 0),MF.set(this,void 0),lpe.set(this,void 0),dg.set(this,void 0),spe.set(this,void 0),upe.set(this,void 0),rJ.set(this,void 0)}[(xqe=new WeakMap,yO=new WeakMap,ape=new WeakMap,S_=new WeakMap,RF=new WeakMap,t3=new WeakMap,MF=new WeakMap,lpe=new WeakMap,dg=new WeakMap,spe=new WeakMap,upe=new WeakMap,rJ=new WeakMap,Kd=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=mO.fromReadableStream(e,this.controller);for await(let i of o)or(this,Kd,"m",eJ).call(this,i);if(o.controller.signal?.aborted)throw new Ia;return this._addRun(or(this,Kd,"m",tJ).call(this))}toReadableStream(){return new mO(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)or(this,Kd,"m",eJ).call(this,l);if(u.controller.signal?.aborted)throw new Ia;return this._addRun(or(this,Kd,"m",tJ).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 or(this,spe,"f")}currentRun(){return or(this,upe,"f")}currentMessageSnapshot(){return or(this,S_,"f")}currentRunStepSnapshot(){return or(this,rJ,"f")}async finalRunSteps(){return await this.done(),Object.values(or(this,yO,"f"))}async finalMessages(){return await this.done(),Object.values(or(this,ape,"f"))}async finalRun(){if(await this.done(),!or(this,RF,"f"))throw Error("Final run was not received.");return or(this,RF,"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)or(this,Kd,"m",eJ).call(this,s);if(a.controller.signal?.aborted)throw new Ia;return this._addRun(or(this,Kd,"m",tJ).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)or(this,Kd,"m",eJ).call(this,u);if(s.controller.signal?.aborted)throw new Ia;return this._addRun(or(this,Kd,"m",tJ).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(qG(i)&&qG(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(!qG(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)}};eJ=function(e){if(!this.ended)switch(cg(this,spe,e,"f"),or(this,Kd,"m",R6t).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":or(this,Kd,"m",L6t).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":or(this,Kd,"m",M6t).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":or(this,Kd,"m",I6t).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},tJ=function(){if(this.ended)throw new qt("stream has ended, this shouldn't happen");if(!or(this,RF,"f"))throw Error("Final run has not been received");return or(this,RF,"f")},I6t=function(e){let[r,n]=or(this,Kd,"m",j6t).call(this,e,or(this,S_,"f"));cg(this,S_,r,"f"),or(this,ape,"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!=or(this,t3,"f")){if(or(this,MF,"f"))switch(or(this,MF,"f").type){case"text":this._emit("textDone",or(this,MF,"f").text,or(this,S_,"f"));break;case"image_file":this._emit("imageFileDone",or(this,MF,"f").image_file,or(this,S_,"f"));break}cg(this,t3,o.index,"f")}cg(this,MF,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(or(this,t3,"f")!==void 0){let o=e.data.content[or(this,t3,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,or(this,S_,"f"));break;case"text":this._emit("textDone",o.text,or(this,S_,"f"));break}}or(this,S_,"f")&&this._emit("messageDone",e.data),cg(this,S_,void 0,"f")}},M6t=function(e){let r=or(this,Kd,"m",N6t).call(this,e);switch(cg(this,rJ,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==or(this,lpe,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(or(this,dg,"f")&&this._emit("toolCallDone",or(this,dg,"f")),cg(this,lpe,i.index,"f"),cg(this,dg,r.step_details.tool_calls[i.index],"f"),or(this,dg,"f")&&this._emit("toolCallCreated",or(this,dg,"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":cg(this,rJ,void 0,"f"),e.data.step_details.type=="tool_calls"&&or(this,dg,"f")&&(this._emit("toolCallDone",or(this,dg,"f")),cg(this,dg,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},R6t=function(e){or(this,xqe,"f").push(e),this._emit("event",e)},N6t=function(e){switch(e.event){case"thread.run.step.created":return or(this,yO,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=or(this,yO,"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=bO.accumulateDelta(r,n.delta);or(this,yO,"f")[e.data.id]=o}return or(this,yO,"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":or(this,yO,"f")[e.data.id]=e.data;break}if(or(this,yO,"f")[e.data.id])return or(this,yO,"f")[e.data.id];throw new Error("No snapshot available")},j6t=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]=or(this,Kd,"m",D6t).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")},D6t=function(e,r){return bO.accumulateDelta(r,e)},L6t=function(e){switch(cg(this,upe,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":cg(this,RF,e.data,"f"),or(this,dg,"f")&&(this._emit("toolCallDone",or(this,dg,"f")),cg(this,dg,void 0,"f"));break;case"thread.run.cancelling":break}}});var NF,r3,Cqe=b(()=>{Cn();po();Zc();NF=class extends it{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 mn(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,r3,{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}})}},r3=class extends So{};NF.MessagesPage=r3});var jF,n3,Oqe=b(()=>{Cn();po();Zc();jF=class extends it{retrieve(e,r,n,o={},i){return mn(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 mn(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,n3,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},n3=class extends So{};jF.RunStepsPage=n3});var eT,o3,Eqe=b(()=>{Cn();po();Sqe();po();Oqe();Oqe();Zc();eT=class extends it{constructor(){super(...arguments),this.steps=new jF(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 mn(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,o3,{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 bO.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 ZP(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return bO.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 bO.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},o3=class extends So{};eT.RunsPage=o3;eT.Steps=jF;eT.RunStepsPage=n3});var _O,Pqe=b(()=>{Cn();po();Sqe();Cqe();Cqe();Eqe();Eqe();_O=class extends it{constructor(){super(...arguments),this.runs=new eT(this._client),this.messages=new NF(this._client)}create(e={},r){return mn(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 bO.createThreadAssistantStream(e,this._client.beta.threads,r)}};_O.Runs=eT;_O.RunsPage=o3;_O.Messages=NF;_O.MessagesPage=r3});var C_,Tqe=b(()=>{Cn();YUe();A6t();YUe();wqe();wqe();Pqe();Pqe();C_=class extends it{constructor(){super(...arguments),this.realtime=new ER(this._client),this.chat=new X4(this._client),this.assistants=new AF(this._client),this.threads=new _O(this._client)}};C_.Realtime=ER;C_.Assistants=AF;C_.AssistantsPage=V4;C_.Threads=_O});var DF,Aqe=b(()=>{Cn();DF=class extends it{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var LF,Iqe=b(()=>{Cn();po();LF=class extends it{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&JP("Request","User defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(JP("response","Decoding base64 embeddings to float32 array"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=f6t(u)}),a)))}}});var FF,i3,Mqe=b(()=>{Cn();po();Zc();FF=class extends it{retrieve(e,r,n,o){return this._client.get(`/evals/${e}/runs/${r}/output_items/${n}`,o)}list(e,r,n={},o){return mn(n)?this.list(e,r,{},n):this._client.getAPIList(`/evals/${e}/runs/${r}/output_items`,i3,{query:n,...o})}},i3=class extends So{};FF.OutputItemListResponsesPage=i3});var tT,a3,Rqe=b(()=>{Cn();po();Mqe();Mqe();Zc();tT=class extends it{constructor(){super(...arguments),this.outputItems=new FF(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 mn(r)?this.list(e,{},r):this._client.getAPIList(`/evals/${e}/runs`,a3,{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)}},a3=class extends So{};tT.RunListResponsesPage=a3;tT.OutputItems=FF;tT.OutputItemListResponsesPage=i3});var vO,kF,Nqe=b(()=>{Cn();po();Rqe();Rqe();Zc();vO=class extends it{constructor(){super(...arguments),this.runs=new tT(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 mn(e)?this.list({},e):this._client.getAPIList("/evals",kF,{query:e,...r})}del(e,r){return this._client.delete(`/evals/${e}`,r)}},kF=class extends So{};vO.EvalListResponsesPage=kF;vO.Runs=tT;vO.RunListResponsesPage=a3});var PR,$F,jqe=b(()=>{Cn();po();po();nh();po();Zc();PR=class extends it{create(e,r){return this._client.post("/files",Ny({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return mn(e)?this.list({},e):this._client.getAPIList("/files",$F,{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 ZP(r),a=await this.retrieve(e),Date.now()-i>n)throw new ug({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},$F=class extends So{};PR.FileObjectsPage=$F});var BF,s3,Dqe=b(()=>{Cn();po();Zc();BF=class extends it{create(e,r,n){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,s3,{body:r,method:"post",...n})}retrieve(e,r={},n){return mn(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)}},s3=class extends hO{};BF.PermissionCreateResponsesPage=s3});var TR,Lqe=b(()=>{Cn();Dqe();Dqe();TR=class extends it{constructor(){super(...arguments),this.permissions=new BF(this._client)}};TR.Permissions=BF;TR.PermissionCreateResponsesPage=s3});var zF,u3,Fqe=b(()=>{Cn();po();Zc();zF=class extends it{list(e,r={},n){return mn(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,u3,{query:r,...n})}},u3=class extends So{};zF.FineTuningJobCheckpointsPage=u3});var wO,l3,c3,kqe=b(()=>{Cn();po();Fqe();Fqe();Zc();wO=class extends it{constructor(){super(...arguments),this.checkpoints=new zF(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 mn(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",l3,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return mn(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,c3,{query:r,...n})}},l3=class extends So{},c3=class extends So{};wO.FineTuningJobsPage=l3;wO.FineTuningJobEventsPage=c3;wO.Checkpoints=zF;wO.FineTuningJobCheckpointsPage=u3});var O_,$qe=b(()=>{Cn();Lqe();Lqe();kqe();kqe();O_=class extends it{constructor(){super(...arguments),this.jobs=new wO(this._client),this.checkpoints=new TR(this._client)}};O_.Jobs=wO;O_.FineTuningJobsPage=l3;O_.FineTuningJobEventsPage=c3;O_.Checkpoints=TR});var UF,Bqe=b(()=>{Cn();po();UF=class extends it{createVariation(e,r){return this._client.post("/images/variations",Ny({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",Ny({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}}});var AR,qF,zqe=b(()=>{Cn();Zc();AR=class extends it{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",qF,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},qF=class extends hO{};AR.ModelsPage=qF});var HF,Uqe=b(()=>{Cn();HF=class extends it{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function F6t(t,e){return!e||!wyn(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)}:qqe(t,e)}function qqe(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:Cyn(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:vyn(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||Hqe(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 vyn(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function wyn(t){return!!JG(t.text?.format)}function xyn(t){return t?.$brand==="auto-parseable-tool"}function Syn(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function Cyn(t,e){let r=Syn(t.tools??[],e.name);return{...e,...e,parsed_arguments:xyn(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function Hqe(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 Vqe=b(()=>{K4()});var d3,Wqe=b(()=>{Cn();po();dpe();d3=class extends it{list(e,r={},n){return mn(r)?this.list(e,{},r):this._client.getAPIList(`/responses/${e}/input_items`,cpe,{query:r,...n})}}});function Eyn(t,e){return F6t(t,e)}var f3,IR,p3,fpe,MR,ppe,k6t,$6t,B6t,z6t,mpe,U6t=b(()=>{nh();tpe();Vqe();f3=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},IR=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)},mpe=class t extends CR{constructor(e){super(),p3.add(this),fpe.set(this,void 0),MR.set(this,void 0),ppe.set(this,void 0),f3(this,fpe,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())),IR(this,p3,"m",k6t).call(this);let i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)IR(this,p3,"m",$6t).call(this,a);if(i.controller.signal?.aborted)throw new Ia;return IR(this,p3,"m",B6t).call(this)}[(fpe=new WeakMap,MR=new WeakMap,ppe=new WeakMap,p3=new WeakSet,k6t=function(){this.ended||f3(this,MR,void 0,"f")},$6t=function(r){if(this.ended)return;let n=IR(this,p3,"m",z6t).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 qt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new qt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new qt(`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 qt(`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}},B6t=function(){if(this.ended)throw new qt("stream has ended, this shouldn't happen");let r=IR(this,MR,"f");if(!r)throw new qt("request ended without sending any events");f3(this,MR,void 0,"f");let n=Eyn(r,IR(this,fpe,"f"));return f3(this,ppe,n,"f"),n},z6t=function(r){let n=IR(this,MR,"f");if(!n){if(r.type!=="response.created")throw new qt(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=f3(this,MR,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 qt(`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 qt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new qt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new qt(`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 qt(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{f3(this,MR,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=IR(this,ppe,"f");if(!e)throw new qt("stream ended without producing a ChatCompletion");return e}}});var RR,cpe,dpe=b(()=>{Vqe();po();Cn();Wqe();Wqe();U6t();Zc();RR=class extends it{constructor(){super(...arguments),this.inputItems=new d3(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"&&Hqe(n),n))}retrieve(e,r={},n){return mn(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=>qqe(n,e))}stream(e,r){return mpe.createResponse(this._client,e,r)}},cpe=class extends So{};RR.InputItems=d3});var m3,Kqe=b(()=>{Cn();po();m3=class extends it{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,Ny({body:r,...n}))}}});var NR,Gqe=b(()=>{Cn();Kqe();Kqe();NR=class extends it{constructor(){super(...arguments),this.parts=new m3(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})}};NR.Parts=m3});var q6t,H6t=b(()=>{q6t=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 jR,DR,h3,hpe=b(()=>{Cn();po();Zc();jR=class extends it{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 mn(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,DR,{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 ZP(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`,h3,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},DR=class extends So{},h3=class extends hO{};jR.VectorStoreFilesPage=DR;jR.FileContentResponsesPage=h3});var g3,Jqe=b(()=>{Cn();po();po();H6t();hpe();g3=class extends it{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 mn(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,DR,{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 ZP(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 h=await s.files.create({file:p,purpose:"assistants"},o);l.push(h.id)}}let d=Array(a).fill(u).map(c);return await q6t(d),await this.createAndPoll(e,{file_ids:l})}}});var fg,VF,WF,Zqe=b(()=>{Cn();po();Jqe();Jqe();hpe();hpe();Zc();fg=class extends it{constructor(){super(...arguments),this.files=new jR(this._client),this.fileBatches=new g3(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 mn(e)?this.list({},e):this._client.getAPIList("/vector_stores",VF,{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`,WF,{body:r,method:"post",...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},VF=class extends So{},WF=class extends hO{};fg.VectorStoresPage=VF;fg.VectorStoreSearchResponsesPage=WF;fg.Files=jR;fg.VectorStoreFilesPage=DR;fg.FileContentResponsesPage=h3;fg.FileBatches=g3});var V6t=b(()=>{p6t();m6t();JUe();ZUe();Tqe();Aqe();Iqe();Nqe();jqe();$qe();Bqe();zqe();Uqe();dpe();Gqe();Zqe()});var W6t,Pr,KF=b(()=>{UVt();po();nh();Hfe();V6t();ZUe();Aqe();Iqe();jqe();Bqe();zqe();Uqe();JUe();Tqe();VUe();Nqe();$qe();dpe();Gqe();Zqe();HG();nh();Pr=class extends Gfe{constructor({baseURL:e=UG("OPENAI_BASE_URL"),apiKey:r=UG("OPENAI_API_KEY"),organization:n=UG("OPENAI_ORG_ID")??null,project:o=UG("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new qt("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&&d6t())throw new qt(`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 DF(this),this.chat=new YP(this),this.embeddings=new LF(this),this.files=new PR(this),this.images=new UF(this),this.audio=new gO(this),this.moderations=new HF(this),this.models=new AR(this),this.fineTuning=new O_(this),this.vectorStores=new fg(this),this.beta=new C_(this),this.batches=new xR(this),this.uploads=new NR(this),this.responses=new RR(this),this.evals=new vO(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 EUe(e,{arrayFormat:"brackets"})}};W6t=Pr;Pr.OpenAI=W6t;Pr.DEFAULT_TIMEOUT=6e5;Pr.OpenAIError=qt;Pr.APIError=Au;Pr.APIConnectionError=GP;Pr.APIConnectionTimeoutError=ug;Pr.APIUserAbortError=Ia;Pr.NotFoundError=j4;Pr.ConflictError=D4;Pr.RateLimitError=F4;Pr.BadRequestError=M4;Pr.AuthenticationError=R4;Pr.InternalServerError=k4;Pr.PermissionDeniedError=N4;Pr.UnprocessableEntityError=L4;Pr.toFile=BUe;Pr.fileFromPath=$fe;Pr.Completions=DF;Pr.Chat=YP;Pr.ChatCompletionsPage=wR;Pr.Embeddings=LF;Pr.Files=PR;Pr.FileObjectsPage=$F;Pr.Images=UF;Pr.Audio=gO;Pr.Moderations=HF;Pr.Models=AR;Pr.ModelsPage=qF;Pr.FineTuning=O_;Pr.VectorStores=fg;Pr.VectorStoresPage=VF;Pr.VectorStoreSearchResponsesPage=WF;Pr.Beta=C_;Pr.Batches=xR;Pr.BatchesPage=TF;Pr.Uploads=NR;Pr.Responses=RR;Pr.Evals=vO;Pr.EvalListResponsesPage=kF});var G6t,K6t,J6t,gpe=b(()=>{G6t=Symbol("Let zodToJsonSchema decide on which parser to use"),K6t={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"},J6t=t=>typeof t=="string"?{...K6t,basePath:["#"],definitions:{},name:t}:{...K6t,basePath:["#"],definitions:{},...t}});function Z6t(t){if(!t)return!0;for(let e in t)return!1;return!0}var nJ,Yqe=b(()=>{nJ=t=>"_def"in t?t._def:t});var Y6t,Xqe=b(()=>{gpe();Yqe();Y6t=t=>{let e=J6t(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])=>[nJ(o),{def:nJ(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function Qqe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function mo(t,e,r,n,o){t[e]=r,Qqe(t,e,n,o)}var LR=b(()=>{});function X6t(){return{}}var e2e=b(()=>{});function Q6t(t,e){let r={type:"array"};return t.type?._def?.typeName!==re.ZodAny&&(r.items=Tr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&mo(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&mo(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(mo(r,"minItems",t.exactLength.value,t.exactLength.message,e),mo(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var t2e=b(()=>{vd();LR();Iu()});function e8t(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?mo(r,"minimum",n.value,n.message,e):mo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),mo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?mo(r,"maximum",n.value,n.message,e):mo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),mo(r,"maximum",n.value,n.message,e));break;case"multipleOf":mo(r,"multipleOf",n.value,n.message,e);break}return r}var r2e=b(()=>{LR()});function t8t(){return{type:"boolean"}}var n2e=b(()=>{});function r8t(t,e){return Tr(t.type._def,e)}var o2e=b(()=>{Iu()});var n8t,i2e=b(()=>{Iu();n8t=(t,e)=>Tr(t.innerType._def,e)});function a2e(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>a2e(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 Myn(t,e)}}var Myn,s2e=b(()=>{LR();Myn=(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":mo(r,"minimum",n.value,n.message,e);break;case"max":mo(r,"maximum",n.value,n.message,e);break}return r}});function o8t(t,e){return{...Tr(t.innerType._def,e),default:t.defaultValue()}}var u2e=b(()=>{Iu()});function i8t(t,e,r){return e.effectStrategy==="input"?Tr(t.schema._def,e,r):{}}var l2e=b(()=>{Iu()});function a8t(t){return{type:"string",enum:[...t.values]}}var c2e=b(()=>{});function s8t(t,e){let r=[Tr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Tr(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(Ryn(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 Ryn,d2e=b(()=>{Iu();Ryn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function u8t(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 f2e=b(()=>{});function ype(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?Nyn(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":mo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":mo(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":E_(r,"email",o.message,e);break;case"format:idn-email":E_(r,"idn-email",o.message,e);break;case"pattern:zod":P_(r,GF.email,o.message,e);break}break;case"url":E_(r,"uri",o.message,e);break;case"uuid":E_(r,"uuid",o.message,e);break;case"regex":P_(r,o.regex,o.message,e);break;case"cuid":P_(r,GF.cuid,o.message,e);break;case"cuid2":P_(r,GF.cuid2,o.message,e);break;case"startsWith":P_(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":P_(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":E_(r,"date-time",o.message,e);break;case"date":E_(r,"date",o.message,e);break;case"time":E_(r,"time",o.message,e);break;case"duration":E_(r,"duration",o.message,e);break;case"length":mo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),mo(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{P_(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&E_(r,"ipv4",o.message,e),o.version!=="v4"&&E_(r,"ipv6",o.message,e);break}case"emoji":P_(r,GF.emoji,o.message,e);break;case"ulid":{P_(r,GF.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{E_(r,"binary",o.message,e);break}case"contentEncoding:base64":{mo(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{P_(r,GF.base64,o.message,e);break}}break}case"nanoid":P_(r,GF.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var p2e,GF,Nyn,E_,P_,l8t,bpe=b(()=>{LR();GF={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:()=>(p2e===void 0&&(p2e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),p2e),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}$/};Nyn=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),E_=(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}}})):mo(t,"format",e,r,n)},P_=(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:l8t(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):mo(t,"pattern",l8t(e,n),r,n)},l8t=(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 _pe(t,e){if(e.target==="openApi3"&&t.keyType?._def.typeName===re.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:Tr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Tr(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===re.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(ype(t.keyType._def,e)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===re.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}var vpe=b(()=>{vd();Iu();bpe()});function c8t(t,e){if(e.mapStrategy==="record")return _pe(t,e);let r=Tr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=Tr(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 m2e=b(()=>{Iu();vpe()});function d8t(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 h2e=b(()=>{});function f8t(){return{not:{}}}var g2e=b(()=>{});function p8t(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var y2e=b(()=>{});function h8t(t,e){if(e.target==="openApi3")return m8t(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in oJ&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=oJ[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 m8t(t,e)}var oJ,m8t,wpe=b(()=>{Iu();oJ={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};m8t=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Tr(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 g8t(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:oJ[t.innerType._def.typeName],nullable:!0}:{type:[oJ[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Tr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Tr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var b2e=b(()=>{Iu();wpe()});function y8t(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",Qqe(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?mo(r,"minimum",n.value,n.message,e):mo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),mo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?mo(r,"maximum",n.value,n.message,e):mo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),mo(r,"maximum",n.value,n.message,e));break;case"multipleOf":mo(r,"multipleOf",n.value,n.message,e);break}return r}var _2e=b(()=>{LR()});function jyn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":Tr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":Tr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function b8t(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=Tr(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:jyn(t,e)};return r.required.length||delete r.required,r}var v2e=b(()=>{Iu()});var _8t,w2e=b(()=>{Iu();_8t=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Tr(t.innerType._def,e);let r=Tr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var v8t,x2e=b(()=>{Iu();v8t=(t,e)=>{if(e.pipeStrategy==="input")return Tr(t.in._def,e);if(e.pipeStrategy==="output")return Tr(t.out._def,e);let r=Tr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Tr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function w8t(t,e){return Tr(t.type._def,e)}var S2e=b(()=>{Iu()});function x8t(t,e){let n={type:"array",uniqueItems:!0,items:Tr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&mo(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&mo(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var C2e=b(()=>{LR();Iu()});function S8t(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Tr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Tr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Tr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var O2e=b(()=>{Iu()});function C8t(){return{not:{}}}var E2e=b(()=>{});function O8t(){return{}}var P2e=b(()=>{});var E8t,T2e=b(()=>{Iu();E8t=(t,e)=>Tr(t.innerType._def,e)});function Tr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==G6t)return a}if(n&&!r){let a=Dyn(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=Fyn(t,t.typeName,e,r);return i&&kyn(t,e,i),o.jsonSchema=i,i}var Dyn,Lyn,Fyn,kyn,Iu=b(()=>{vd();e2e();t2e();r2e();n2e();o2e();i2e();s2e();u2e();l2e();c2e();d2e();f2e();m2e();h2e();g2e();y2e();b2e();_2e();v2e();w2e();x2e();S2e();vpe();C2e();bpe();O2e();E2e();wpe();P2e();T2e();gpe();Dyn=(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:Lyn(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}},Lyn=(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("/")},Fyn=(t,e,r,n)=>{switch(e){case re.ZodString:return ype(t,r);case re.ZodNumber:return y8t(t,r);case re.ZodObject:return b8t(t,r);case re.ZodBigInt:return e8t(t,r);case re.ZodBoolean:return t8t();case re.ZodDate:return a2e(t,r);case re.ZodUndefined:return C8t();case re.ZodNull:return p8t(r);case re.ZodArray:return Q6t(t,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return h8t(t,r);case re.ZodIntersection:return s8t(t,r);case re.ZodTuple:return S8t(t,r);case re.ZodRecord:return _pe(t,r);case re.ZodLiteral:return u8t(t,r);case re.ZodEnum:return a8t(t);case re.ZodNativeEnum:return d8t(t);case re.ZodNullable:return g8t(t,r);case re.ZodOptional:return _8t(t,r);case re.ZodMap:return c8t(t,r);case re.ZodSet:return x8t(t,r);case re.ZodLazy:return Tr(t.getter()._def,r);case re.ZodPromise:return w8t(t,r);case re.ZodNaN:case re.ZodNever:return f8t();case re.ZodEffects:return i8t(t,r,n);case re.ZodAny:return X6t();case re.ZodUnknown:return O8t();case re.ZodDefault:return o8t(t,r);case re.ZodBranded:return r8t(t,r);case re.ZodReadonly:return E8t(t,r);case re.ZodCatch:return n8t(t,r);case re.ZodPipeline:return v8t(t,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(o=>{})(e)}},kyn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var P8t,T8t=b(()=>{Iu();Xqe();Yqe();P8t=(t,e)=>{let r=Y6t(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=Tr(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(Z6t(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]=Tr(nJ(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}});var A8t=b(()=>{gpe();Xqe();LR();Iu();e2e();t2e();r2e();n2e();o2e();i2e();s2e();u2e();l2e();c2e();d2e();f2e();m2e();h2e();g2e();y2e();b2e();_2e();v2e();w2e();x2e();S2e();T2e();vpe();C2e();bpe();O2e();E2e();wpe();P2e();T8t()});function I8t(t,e){return P8t(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function xpe(t,e,r){return y6t({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:I8t(t,{name:e})}},n=>t.parse(JSON.parse(n)))}function Spe(t){return b6t({type:"function",function:{name:t.name,parameters:I8t(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))})}var iJ=b(()=>{K4();A8t()});function JF(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}var FR=b(()=>{});function aJ(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var M8t=b(()=>{});function ZF(t){let e;return t.constructor.name===ug.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Ia.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=aJ(t,"INVALID_TOOL_RESULTS"):t.status===401?e=aJ(t,"MODEL_AUTHENTICATION"):t.status===429?e=aJ(t,"MODEL_RATE_LIMIT"):t.status===404?e=aJ(t,"MODEL_NOT_FOUND"):e=t,e}function A2e(t){if(t)return t==="any"||t==="required"?"required":t==="auto"?"auto":t==="none"?"none":typeof t=="string"?{type:"function",function:{name:t}}:t}var y3=b(()=>{KF();Ug();rg();M8t()});function $yn(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function R8t(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(N8t(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function N8t(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}: ${Cpe(o,e)},`):r.push(`${n}?: ${Cpe(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function Cpe(t,e){if($yn(t))return t.anyOf.map(r=>Cpe(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["{",N8t(t,e+2),"}"].join(`
`);case"array":return t.items?`${Cpe(t.items,e)}[]`:"any[]";default:return""}}var j8t=b(()=>{});function D8t(t,e){let r;if(Hc(t)){let n=Spe({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:DM(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}var L8t=b(()=>{rg();iJ()});function Byn(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 R2e(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(!Js.isInstance(t))throw new Error("Invalid generic chat message");return Byn(t)}default:throw new Error(`Unknown message type: ${e}`)}}function M2e(t,e){return t.flatMap(r=>{let n=R2e(r);n==="system"&&N2e(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=""),Vi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(rO),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})}function F8t(t,e){return t.flatMap(r=>{let n=R2e(r);if(n==="system"&&N2e(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[b3];if(Vi(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 $8t(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(Xm(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Qm(s,l))}i[b3]??(i[b3]={}),i[b3][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 Fn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function zyn(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[b3]={[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=$8t(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 so({text:e.map(u=>u.text).join(""),message:new xr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function I2e(t){return"type"in t&&t.type!=="function"}function Uyn(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function k8t(t,e){return kd(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:D8t(t,e)}function N2e(t){return t?.startsWith("o1")||t?.startsWith("o3")}function Ope(t){return typeof t?.parse=="function"}function qyn(t){return t!==void 0&&typeof t.schema=="object"}var b3,sJ,Epe=b(()=>{KF();Fs();Gf();to();UC();tg();Om();Mb();H2();Ug();iJ();FR();y3();j8t();L8t();b3="__openai_function_call_ids__";sJ=class extends Cu{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??ct("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??ct("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=>I2e(o)?o:k8t(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&Ope(e.json_schema.schema)?xpe(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=>I2e(l)?l:kd(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:Uyn(e?.tool_choice)?e?.tool_choice:(()=>{let l=A2e(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=>k8t(s,{strict:n})):void 0,tool_choice:A2e(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),N2e(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(Xm(u,{returnId:!0}))}catch(l){i.push(Qm(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 Fn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Js(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 xp({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 xr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Of({content:i,response_metadata:s}):o==="developer"?new Of({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Ch({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Bg({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new wp({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:F8t(e,this.model),stream:!0},r);for await(let c of l){let d=zyn(c);d!=null&&(yield d)}return}let o=M2e(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 h={...p};c.finish_reason!=null&&(h.finish_reason=c.finish_reason,h.system_fingerprint=l.system_fingerprint,h.model_name=l.model),this.logprobs&&(h.logprobs=c.logprobs);let m=new so({message:f,text:f.content,generationInfo:h});yield m,await n?.handleLLMNewToken(m.text??"",p,void 0,void 0,void 0,{chunk:m})}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 so({message:new xr({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=F8t(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:$8t(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(I2e),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=M2e(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let h of s){h.message.response_metadata={...h.generationInfo,...h.message.response_metadata};let m=h.generationInfo?.completion??0;u[m]===void 0?u[m]=h:u[m]=u[m].concat(h)}let l=Object.entries(u).sort(([h],[m])=>parseInt(h,10)-parseInt(m,10)).map(([h,m])=>m),{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 h of s?.choices??[]){let g={text:h.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(h.message??{role:"assistant"},s)};g.generationInfo={...h.finish_reason?{finish_reason:h.finish_reason}:{},...h.logprobs?{logprobs:h.logprobs}:{}},Vi(g.message)&&(g.message.usage_metadata=o),g.message=new Fn(Object.fromEntries(Object.entries(g.message).filter(([y])=>!y.startsWith("lc_")))),p.push(g)}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=R8t(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(R2e(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 ZF(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 ZF(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 ZF(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=JF(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Pr(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;qyn(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"}}),Ope(n)?u=wd.fromZodSchema(n):u=new xd;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}}}),Ope(n)){let f=wd.fromZodSchema(n);u=Ep.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new xd;else{let f=o??"extract";if(Ope(n)){let p=os(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 qd({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 qd({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=jo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=jo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return ji.from([{raw:s},d])}}});var B8t=b(()=>{to();Epe();FR()});var j2e=b(()=>{tg();Gf();to();wL();Cy();FR();y3()});var z8t=b(()=>{to();j2e();FR()});var D2e=b(()=>{to();CP();Cy();FR();y3()});var U8t=b(()=>{to();D2e();FR();y3()});var q8t=b(()=>{});var L2e,H8t=b(()=>{to();KF();$K();L2e=class extends eR{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??ct("OPENAI_API_KEY"),n=e?.organization??ct("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new Pr(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(L2e,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"})});var V8t=b(()=>{H8t()});var W8t=b(()=>{Epe()});var K8t=b(()=>{Epe();B8t();j2e();z8t();U8t();D2e();q8t();y3();FR();V8t();W8t()});var G8t=b(()=>{K8t()});var Ppe,J8t=b(()=>{to();G8t();Ppe=class extends sJ{static lc_name(){return"ChatDeepSeek"}_llmType(){return"deepseek"}get lc_secrets(){return{apiKey:"DEEPSEEK_API_KEY"}}constructor(e){let r=e?.apiKey||ct("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)}}});var Z8t=b(()=>{J8t()});var Y8t=b(()=>{Z8t()});var YF,X8t=b(()=>{YF="0.5.0"});function e5t(t,e={auto:!1}){if(Q8t)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(XF)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${XF}'\``);Q8t=e.auto,XF=t.kind,F2e=t.fetch,Hyn=t.Request,Vyn=t.Response,Wyn=t.Headers,k2e=t.FormData,Kyn=t.Blob,Tpe=t.File,$2e=t.ReadableStream,B2e=t.getMultipartRequestOptions,z2e=t.getDefaultAgent,Ape=t.fileFromPath,U2e=t.isFsReadStream}var Q8t,XF,F2e,Hyn,Vyn,Wyn,k2e,Kyn,Tpe,$2e,B2e,z2e,Ape,U2e,q2e=b(()=>{Q8t=!1});var Ipe,t5t=b(()=>{Ipe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function r5t({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 Ipe(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}}var n5t=b(()=>{t5t()});var o5t=b(()=>{n5t()});var uJ=b(()=>{q2e();o5t();q2e();XF||e5t(r5t(),{auto:!0})});var H2e={};ns(H2e,{APIConnectionError:()=>rT,APIConnectionTimeoutError:()=>QF,APIError:()=>wc,APIUserAbortError:()=>kR,AuthenticationError:()=>v3,BadRequestError:()=>_3,ConflictError:()=>S3,GroqError:()=>Xc,InternalServerError:()=>E3,NotFoundError:()=>x3,PermissionDeniedError:()=>w3,RateLimitError:()=>O3,UnprocessableEntityError:()=>C3});var Xc,wc,kR,rT,QF,_3,v3,w3,x3,S3,C3,O3,E3,lJ=b(()=>{cJ();Xc=class extends Error{},wc=class t extends Xc{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 rT({cause:Mpe(r)});let i=r;return e===400?new _3(e,i,n,o):e===401?new v3(e,i,n,o):e===403?new w3(e,i,n,o):e===404?new x3(e,i,n,o):e===409?new S3(e,i,n,o):e===422?new C3(e,i,n,o):e===429?new O3(e,i,n,o):e>=500?new E3(e,i,n,o):new t(e,i,n,o)}},kR=class extends wc{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}},rT=class extends wc{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},QF=class extends rT{constructor({message:e}={}){super({message:e??"Request timed out."})}},_3=class extends wc{constructor(){super(...arguments),this.status=400}},v3=class extends wc{constructor(){super(...arguments),this.status=401}},w3=class extends wc{constructor(){super(...arguments),this.status=403}},x3=class extends wc{constructor(){super(...arguments),this.status=404}},S3=class extends wc{constructor(){super(...arguments),this.status=409}},C3=class extends wc{constructor(){super(...arguments),this.status=422}},O3=class extends wc{constructor(){super(...arguments),this.status=429}},E3=class extends wc{}});function Zyn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function i5t(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 Rpe,V2e,P3,a5t=b(()=>{uJ();lJ();lJ();Rpe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new V2e;async function*i(){if(!e.body)throw r.abort(),new Xc("Attempted to iterate over a response with no body");let s=new P3,u=i5t(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 wc(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 P3,s=i5t(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 $2e({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?.()}})}},V2e=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]=Zyn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},P3=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 Xc(`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 Xc(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Xc("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}};P3.NEWLINE_CHARS=new Set([`
`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);P3.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g});async function G2e(t,e,r){if(t=await t,r??(r=u5t(t)?{lastModified:t.lastModified,type:t.type}:{}),s5t(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file"),new Tpe([o],e,r)}let n=await Xyn(t);if(e||(e=ebn(t)??"unknown_file"),!r.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Tpe(n,e,r)}async function Xyn(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Npe(t))e.push(await t.arrayBuffer());else if(tbn(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${Qyn(t)}`);return e}function Qyn(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function ebn(t){return W2e(t.name)||W2e(t.filename)||W2e(t.path)?.split(/[\\/]/).pop()}var s5t,u5t,Npe,Yyn,W2e,tbn,J2e,dJ,l5t,K2e,jpe=b(()=>{uJ();uJ();s5t=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",u5t=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Npe(t),Npe=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",Yyn=t=>u5t(t)||s5t(t)||U2e(t);W2e=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},tbn=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",J2e=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",dJ=async t=>{let e=await l5t(t.body);return B2e(e,t)},l5t=async t=>{let e=new k2e;return await Promise.all(Object.entries(t||{}).map(([r,n])=>K2e(e,r,n))),e},K2e=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(Yyn(r)){let n=await G2e(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>K2e(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>K2e(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`)}}});async function h5t(t){let{response:e}=t;if(t.options.stream)return T3("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):Rpe.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 T3("response",e.status,e.url,e.headers,i),i}let o=await e.text();return T3("response",e.status,e.url,e.headers,o),o}function sbn(){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}function pbn(t){if(!t)return!0;for(let e in t)return!1;return!0}function mbn(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function m5t(t,e){for(let r in e){if(!mbn(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 T3(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var nbn,obn,Dpe,Lpe,Fpe,c5t,Y2e,ibn,abn,d5t,f5t,p5t,ubn,lbn,cbn,dbn,fbn,Z2e,Mpe,X2e,hbn,g5t,cJ=b(()=>{X8t();a5t();lJ();uJ();jpe();jpe();nbn=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},obn=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)};Lpe=class t extends Promise{constructor(e,r=h5t){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)}},Fpe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=Z2e("maxRetries",r),this.timeout=Z2e("timeout",n),this.httpAgent=o,this.fetch=i??F2e}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...ubn(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${hbn()}`}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&&Npe(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:J2e(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&&Z2e("timeout",e.timeout);let l=e.timeout??this.timeout,c=e.httpAgent??this.httpAgent??z2e(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 m5t(o,i),m5t(o,r),J2e(e.body)&&XF!=="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 wc.generate(e,r,n,o)}request(e,r=null){return new Lpe(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}),T3("request",i,n,o.headers),n.signal?.aborted)throw new kR;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(Mpe);if(u instanceof Error){if(n.signal?.aborted)throw new kR;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new QF:new rT({cause:u})}let l=ibn(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let m=`retrying, ${r} attempts remaining`;return T3(`response (error; ${m})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(m=>Mpe(m).message),d=lbn(c),f=d?void 0:c;throw T3(`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 Y2e(this,n,e)}buildURL(e,r){let n=dbn(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return pbn(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 Xc(`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 fbn(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 ${YF}`}},c5t=class{constructor(e,r,n,o){Dpe.set(this,void 0),nbn(this,Dpe,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 Xc("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 obn(this,Dpe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Dpe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Y2e=class extends Lpe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await h5t(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},ibn=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),abn=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":YF,"X-Stainless-OS":f5t(Deno.build.os),"X-Stainless-Arch":d5t(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":YF,"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":YF,"X-Stainless-OS":f5t(process.platform),"X-Stainless-Arch":d5t(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=sbn();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":YF,"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":YF,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};d5t=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",f5t=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"),ubn=()=>p5t??(p5t=abn()),lbn=t=>{try{return JSON.parse(t)}catch{return}},cbn=new RegExp("^(?:[a-z]+:)?//","i"),dbn=t=>cbn.test(t),fbn=t=>new Promise(e=>setTimeout(e,t)),Z2e=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Xc(`${t} must be an integer`);if(e<0)throw new Xc(`${t} must be a positive integer`);return e},Mpe=t=>t instanceof Error?t:new Error(t),X2e=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};hbn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),g5t=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"});var y5t=b(()=>{});var Qc,nT=b(()=>{Qc=class{constructor(e){this._client=e}}});var ek,b5t=b(()=>{nT();cJ();ek=class extends Qc{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",dJ({body:e,...r}))}};ek||(ek={})});var tk,_5t=b(()=>{nT();cJ();tk=class extends Qc{create(e,r){return this._client.post("/openai/v1/audio/translations",dJ({body:e,...r}))}};tk||(tk={})});var $R,v5t=b(()=>{nT();b5t();_5t();$R=class extends Qc{constructor(){super(...arguments),this.transcriptions=new ek(this._client),this.translations=new tk(this._client)}};(function(t){t.Transcriptions=ek,t.Translations=tk})($R||($R={}))});var rk,w5t=b(()=>{nT();rk=class extends Qc{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}};rk||(rk={})});var BR,x5t=b(()=>{nT();w5t();BR=class extends Qc{constructor(){super(...arguments),this.completions=new rk(this._client)}};(function(t){t.Completions=rk})(BR||(BR={}))});var zR,S5t=b(()=>{nT();zR=class extends Qc{};zR||(zR={})});var UR,C5t=b(()=>{nT();UR=class extends Qc{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}};UR||(UR={})});var qR,O5t=b(()=>{nT();qR=class extends Qc{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)}};qR||(qR={})});var E5t=b(()=>{y5t();v5t();x5t();S5t();C5t();O5t()});var P5t,Bs,fSi,pSi,mSi,hSi,gSi,ySi,bSi,_Si,vSi,wSi,xSi,SSi,CSi,T5t,A5t=b(()=>{cJ();lJ();jpe();E5t();Bs=class extends Fpe{constructor({baseURL:e=X2e("GROQ_BASE_URL"),apiKey:r=X2e("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new Xc("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&&g5t())throw new Xc(`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 zR(this),this.chat=new BR(this),this.embeddings=new UR(this),this.audio=new $R(this),this.models=new qR(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}`}}};P5t=Bs;Bs.Groq=P5t;Bs.GroqError=Xc;Bs.APIError=wc;Bs.APIConnectionError=rT;Bs.APIConnectionTimeoutError=QF;Bs.APIUserAbortError=kR;Bs.NotFoundError=x3;Bs.ConflictError=S3;Bs.RateLimitError=O3;Bs.BadRequestError=_3;Bs.AuthenticationError=v3;Bs.InternalServerError=E3;Bs.PermissionDeniedError=w3;Bs.UnprocessableEntityError=C3;Bs.toFile=G2e;Bs.fileFromPath=Ape;({GroqError:fSi,APIError:pSi,APIConnectionError:mSi,APIConnectionTimeoutError:hSi,APIUserAbortError:gSi,NotFoundError:ySi,ConflictError:bSi,RateLimitError:_Si,BadRequestError:vSi,AuthenticationError:wSi,InternalServerError:xSi,PermissionDeniedError:SSi,UnprocessableEntityError:CSi}=H2e);(function(t){t.Completions=zR,t.Chat=BR,t.Embeddings=UR,t.Audio=$R,t.Models=qR})(Bs||(Bs={}));T5t=Bs});function wbn(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 I5t(t){return t.map(e=>{if(typeof e.content!="string")throw new Error("Non string message content not supported");let r={role:wbn(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 Vi(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(rO):(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 xbn(t,e){let r=t.tool_calls;switch(t.role){case"assistant":{let n=[],o=[];for(let i of r??[])try{n.push(Xm(i,{returnId:!0}))}catch(a){o.push(Qm(i,a.message))}return new Fn({content:t.content||"",additional_kwargs:{tool_calls:r},tool_calls:n,invalid_tool_calls:o,usage_metadata:e})}default:return new Js(t.content||"",t.role??"unknown")}}function Sbn(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 Cbn(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 xp({content:o})};if(n==="assistant"){let u=Sbn(t.tool_calls,e);return{message:new xr({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 Of({content:o})}:{message:new wp({content:o,role:n})}}var kpe,M5t=b(()=>{Ug();UC();Fs();Gf();to();PL();A5t();Om();Mb();H2();rg();kpe=class extends Cu{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||ct("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 T5t({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=>zC(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=I5t(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}=Cbn({...d.delta,role:s},d.index,c.x_groq);if(p){let m=p.filter(g=>u.every(y=>y.id!==g.id));u.push(...m),yield new so({message:new xr({content:"",tool_call_chunks:m}),text:""})}let h=new so({message:f,text:d.delta.content??"",generationInfo:{finishReason:d.finish_reason}});yield h,n?.handleLLMNewToken(h.text??"")}if(l&&("choices"in l&&delete l.choices,yield new so({message:new xr({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=I5t(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:xbn(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"}}),xv(n)?u=wd.fromZodSchema(n):u=new xd;else if(xv(n)){let p=os(n);l=this.bind({tools:[{type:"function",function:{name:s,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:s}}}),u=new qd({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 qd({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=jo.assign({parsed:(p,h)=>u.invoke(p.raw,h)}),d=jo.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return ji.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}}});var R5t=b(()=>{M5t()});var N5t=b(()=>{R5t()});function j5t(t,e=0){return(Gd[t[e+0]]+Gd[t[e+1]]+Gd[t[e+2]]+Gd[t[e+3]]+"-"+Gd[t[e+4]]+Gd[t[e+5]]+"-"+Gd[t[e+6]]+Gd[t[e+7]]+"-"+Gd[t[e+8]]+Gd[t[e+9]]+"-"+Gd[t[e+10]]+Gd[t[e+11]]+Gd[t[e+12]]+Gd[t[e+13]]+Gd[t[e+14]]+Gd[t[e+15]]).toLowerCase()}var Gd,$pe,D5t=b(()=>{Gd=[];for($pe=0;$pe<256;++$pe)Gd.push(($pe+256).toString(16).slice(1))});function Q2e(){if(!Bpe&&(Bpe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Bpe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Bpe(Obn)}var Bpe,Obn,L5t=b(()=>{Obn=new Uint8Array(16)});var Ebn,e4e,F5t=b(()=>{Ebn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),e4e={randomUUID:Ebn}});function Pbn(t,e,r){if(e4e.randomUUID&&!e&&!t)return e4e.randomUUID();t=t||{};var n=t.random||(t.rng||Q2e)();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 j5t(n)}var zpe,k5t=b(()=>{F5t();L5t();D5t();zpe=Pbn});var $5t=b(()=>{k5t()});var Uo=x(t4e=>{"use strict";Object.defineProperty(t4e,"__esModule",{value:!0});t4e.pathToFunc=Abn;var Tbn=Object.prototype.hasOwnProperty;function Abn(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!Tbn.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 Upe=x(jy=>{"use strict";Object.defineProperty(jy,"__esModule",{value:!0});jy.SDK_METADATA=jy.ServerList=jy.ServerEu=void 0;jy.serverURLFromOptions=Mbn;var Ibn=Uo();jy.ServerEu="eu";jy.ServerList={[jy.ServerEu]:"https://api.mistral.ai"};function Mbn(t){let e=t.serverURL,r={};if(!e){let o=t.server??jy.ServerEu;e=jy.ServerList[o]||""}let n=(0,Ibn.pathToFunc)(e)(r);return new URL(n)}jy.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 n4e=x(r4e=>{"use strict";Object.defineProperty(r4e,"__esModule",{value:!0});r4e.readableStreamToArrayBuffer=Rbn;async function Rbn(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 B5t=x(qpe=>{"use strict";Object.defineProperty(qpe,"__esModule",{value:!0});qpe.CustomUserAgentHook=void 0;var Nbn=Upe(),o4e=class{beforeRequest(e,r){let o=`mistral-client-typescript/${Nbn.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};qpe.CustomUserAgentHook=o4e});var U5t=x(Hpe=>{"use strict";Object.defineProperty(Hpe,"__esModule",{value:!0});Hpe.DeprecationWarningHook=void 0;var z5t="x-model-deprecation-timestamp",i4e=class{afterSuccess(e,r){return r.headers.has(z5t)&&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(z5t)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};Hpe.DeprecationWarningHook=i4e});var q5t=x(a4e=>{"use strict";Object.defineProperty(a4e,"__esModule",{value:!0});a4e.initHooks=Lbn;var jbn=B5t(),Dbn=U5t();function Lbn(t){let e=new jbn.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new Dbn.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var H5t=x(Vpe=>{"use strict";Object.defineProperty(Vpe,"__esModule",{value:!0});Vpe.SDKHooks=void 0;var Fbn=q5t(),s4e=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,Fbn.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}}};Vpe.SDKHooks=s4e});var p4e=x(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});ih.ConnectionError=ih.RequestTimeoutError=ih.RequestAbortedError=ih.InvalidRequestError=ih.UnexpectedClientError=ih.HTTPClientError=void 0;var HR=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)}};ih.HTTPClientError=HR;var u4e=class extends HR{constructor(){super(...arguments),this.name="UnexpectedClientError"}};ih.UnexpectedClientError=u4e;var l4e=class extends HR{constructor(){super(...arguments),this.name="InvalidRequestError"}};ih.InvalidRequestError=l4e;var c4e=class extends HR{constructor(){super(...arguments),this.name="RequestAbortedError"}};ih.RequestAbortedError=c4e;var d4e=class extends HR{constructor(){super(...arguments),this.name="RequestTimeoutError"}};ih.RequestTimeoutError=d4e;var f4e=class extends HR{constructor(){super(...arguments),this.name="ConnectionError"}};ih.ConnectionError=f4e});var Dy=x(A3=>{"use strict";Object.defineProperty(A3,"__esModule",{value:!0});A3.OK=kbn;A3.ERR=$bn;A3.unwrap=Bbn;A3.unwrapAsync=zbn;function kbn(t){return{ok:!0,value:t}}function $bn(t){return{ok:!1,error:t}}function Bbn(t){if(!t.ok)throw t.error;return t.value}async function zbn(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var fJ=x(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.getParsedType=fa.ZodParsedType=fa.objectUtil=fa.util=void 0;var m4e;(function(t){t.assertEqual=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"&&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})(m4e||(fa.util=m4e={}));var V5t;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(V5t||(fa.objectUtil=V5t={}));fa.ZodParsedType=m4e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Ubn=t=>{switch(typeof t){case"undefined":return fa.ZodParsedType.undefined;case"string":return fa.ZodParsedType.string;case"number":return Number.isNaN(t)?fa.ZodParsedType.nan:fa.ZodParsedType.number;case"boolean":return fa.ZodParsedType.boolean;case"function":return fa.ZodParsedType.function;case"bigint":return fa.ZodParsedType.bigint;case"symbol":return fa.ZodParsedType.symbol;case"object":return Array.isArray(t)?fa.ZodParsedType.array:t===null?fa.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?fa.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?fa.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?fa.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?fa.ZodParsedType.date:fa.ZodParsedType.object;default:return fa.ZodParsedType.unknown}};fa.getParsedType=Ubn});var Wpe=x(VR=>{"use strict";Object.defineProperty(VR,"__esModule",{value:!0});VR.ZodError=VR.quotelessJson=VR.ZodIssueCode=void 0;var W5t=fJ();VR.ZodIssueCode=W5t.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 qbn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");VR.quotelessJson=qbn;var pJ=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,W5t.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};VR.ZodError=pJ;pJ.create=t=>new pJ(t)});var g4e=x(h4e=>{"use strict";Object.defineProperty(h4e,"__esModule",{value:!0});var tp=Wpe(),nk=fJ(),Hbn=(t,e)=>{let r;switch(t.code){case tp.ZodIssueCode.invalid_type:t.received===nk.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case tp.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,nk.util.jsonStringifyReplacer)}`;break;case tp.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${nk.util.joinValues(t.keys,", ")}`;break;case tp.ZodIssueCode.invalid_union:r="Invalid input";break;case tp.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${nk.util.joinValues(t.options)}`;break;case tp.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${nk.util.joinValues(t.options)}, received '${t.received}'`;break;case tp.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case tp.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case tp.ZodIssueCode.invalid_date:r="Invalid date";break;case tp.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}"`:nk.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case tp.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==="bigint"?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 tp.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 tp.ZodIssueCode.custom:r="Invalid input";break;case tp.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case tp.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case tp.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,nk.util.assertNever(t)}return{message:r}};h4e.default=Hbn});var Kpe=x(WR=>{"use strict";var Vbn=WR&&WR.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(WR,"__esModule",{value:!0});WR.defaultErrorMap=void 0;WR.setErrorMap=Wbn;WR.getErrorMap=Kbn;var K5t=Vbn(g4e());WR.defaultErrorMap=K5t.default;var G5t=K5t.default;function Wbn(t){G5t=t}function Kbn(){return G5t}});var b4e=x(Bi=>{"use strict";var Gbn=Bi&&Bi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Bi,"__esModule",{value:!0});Bi.isAsync=Bi.isValid=Bi.isDirty=Bi.isAborted=Bi.OK=Bi.DIRTY=Bi.INVALID=Bi.ParseStatus=Bi.EMPTY_PATH=Bi.makeIssue=void 0;Bi.addIssueToContext=Ybn;var Jbn=Kpe(),J5t=Gbn(g4e()),Zbn=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}};Bi.makeIssue=Zbn;Bi.EMPTY_PATH=[];function Ybn(t,e){let r=(0,Jbn.getErrorMap)(),n=(0,Bi.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===J5t.default?void 0:J5t.default].filter(o=>!!o)});t.common.issues.push(n)}var y4e=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 Bi.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 Bi.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}}};Bi.ParseStatus=y4e;Bi.INVALID=Object.freeze({status:"aborted"});var Xbn=t=>({status:"dirty",value:t});Bi.DIRTY=Xbn;var Qbn=t=>({status:"valid",value:t});Bi.OK=Qbn;var e_n=t=>t.status==="aborted";Bi.isAborted=e_n;var t_n=t=>t.status==="dirty";Bi.isDirty=t_n;var r_n=t=>t.status==="valid";Bi.isValid=r_n;var n_n=t=>typeof Promise<"u"&&t instanceof Promise;Bi.isAsync=n_n});var Y5t=x(Z5t=>{"use strict";Object.defineProperty(Z5t,"__esModule",{value:!0})});var Q5t=x(Gpe=>{"use strict";Object.defineProperty(Gpe,"__esModule",{value:!0});Gpe.errorUtil=void 0;var X5t;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(X5t||(Gpe.errorUtil=X5t={}))});var dWt=x(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.discriminatedUnion=se.date=se.boolean=se.bigint=se.array=se.any=se.coerce=se.ZodFirstPartyTypeKind=se.late=se.ZodSchema=se.Schema=se.ZodReadonly=se.ZodPipeline=se.ZodBranded=se.BRAND=se.ZodNaN=se.ZodCatch=se.ZodDefault=se.ZodNullable=se.ZodOptional=se.ZodTransformer=se.ZodEffects=se.ZodPromise=se.ZodNativeEnum=se.ZodEnum=se.ZodLiteral=se.ZodLazy=se.ZodFunction=se.ZodSet=se.ZodMap=se.ZodRecord=se.ZodTuple=se.ZodIntersection=se.ZodDiscriminatedUnion=se.ZodUnion=se.ZodObject=se.ZodArray=se.ZodVoid=se.ZodNever=se.ZodUnknown=se.ZodAny=se.ZodNull=se.ZodUndefined=se.ZodSymbol=se.ZodDate=se.ZodBoolean=se.ZodBigInt=se.ZodNumber=se.ZodString=se.ZodType=void 0;se.NEVER=se.void=se.unknown=se.union=se.undefined=se.tuple=se.transformer=se.symbol=se.string=se.strictObject=se.set=se.record=se.promise=se.preprocess=se.pipeline=se.ostring=se.optional=se.onumber=se.oboolean=se.object=se.number=se.nullable=se.null=se.never=se.nativeEnum=se.nan=se.map=se.literal=se.lazy=se.intersection=se.instanceof=se.function=se.enum=se.effect=void 0;se.datetimeRegex=oWt;se.custom=aWt;var Ye=Wpe(),Jpe=Kpe(),Xt=Q5t(),ue=b4e(),at=fJ(),Fy=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||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},eWt=(t,e)=>{if((0,ue.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 Ye.ZodError(t.common.issues);return this._error=r,this._error}}};function hn(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)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}var gn=class{get description(){return this._def.description}_getType(e){return(0,at.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,at.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ue.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,at.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,ue.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){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,at.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return eWt(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,at.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return(0,ue.isValid)(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>(0,ue.isValid)(n)?{value:n.value}:{issues:r.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,at.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,ue.isAsync)(o)?o:Promise.resolve(o));return eWt(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:Ye.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 pg({schema:this,typeName:Dr.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 Ly.create(this,this._def)}nullable(){return SO.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return aT.create(this)}promise(){return JR.create(this,this._def)}or(e){return ck.create([this,e],this._def)}and(e){return dk.create(this,e,this._def)}transform(e){return new pg({...hn(this._def),schema:this,typeName:Dr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new gk({...hn(this._def),innerType:this,defaultValue:r,typeName:Dr.ZodDefault})}brand(){return new mJ({typeName:Dr.ZodBranded,type:this,...hn(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new yk({...hn(this._def),innerType:this,catchValue:r,typeName:Dr.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return hJ.create(this,e)}readonly(){return bk.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};se.ZodType=gn;se.Schema=gn;se.ZodSchema=gn;var o_n=/^c[^\s-]{8,}$/i,i_n=/^[0-9a-z]+$/,a_n=/^[0-9A-HJKMNP-TV-Z]{26}$/i,s_n=/^[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,u_n=/^[a-z0-9_-]{21}$/i,l_n=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,c_n=/^[-+]?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)?)??$/,d_n=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,f_n="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_4e,p_n=/^(?:(?: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])$/,m_n=/^(?:(?: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])$/,h_n=/^(([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]))$/,g_n=/^(([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])$/,y_n=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,b_n=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,rWt="((\\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])))",__n=new RegExp(`^${rWt}$`);function nWt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function v_n(t){return new RegExp(`^${nWt(t)}$`)}function oWt(t){let e=`${rWt}T${nWt(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 w_n(t,e){return!!((e==="v4"||!e)&&p_n.test(t)||(e==="v6"||!e)&&h_n.test(t))}function x_n(t,e){if(!l_n.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let 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||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function S_n(t,e){return!!((e==="v4"||!e)&&m_n.test(t)||(e==="v6"||!e)&&g_n.test(t))}var KR=class t extends gn{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==at.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(i,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.string,received:i.parsedType}),ue.INVALID}let n=new ue.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Ye.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,ue.addIssueToContext)(o,{code:Ye.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,ue.addIssueToContext)(o,{code:Ye.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,ue.addIssueToContext)(o,{code:Ye.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")d_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"email",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")_4e||(_4e=new RegExp(f_n,"u")),_4e.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"emoji",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")s_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"uuid",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")u_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"nanoid",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")o_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"cuid",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")i_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"cuid2",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")a_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"ulid",code:Ye.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,ue.addIssueToContext)(o,{validation:"url",code:Ye.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,ue.addIssueToContext)(o,{validation:"regex",code:Ye.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,ue.addIssueToContext)(o,{code:Ye.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,ue.addIssueToContext)(o,{code:Ye.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,ue.addIssueToContext)(o,{code:Ye.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?oWt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Ye.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?__n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Ye.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?v_n(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Ye.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?c_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"duration",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?w_n(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"ip",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?x_n(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"jwt",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?S_n(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"cidr",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?y_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"base64",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?b_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"base64url",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):at.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:Ye.ZodIssueCode.invalid_string,...Xt.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Xt.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Xt.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Xt.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Xt.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Xt.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Xt.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Xt.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Xt.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Xt.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Xt.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Xt.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Xt.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Xt.errorUtil.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Xt.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,...Xt.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Xt.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Xt.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Xt.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Xt.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Xt.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Xt.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Xt.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Xt.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,Xt.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}};se.ZodString=KR;KR.create=t=>new KR({checks:[],typeName:Dr.ZodString,coerce:t?.coerce??!1,...hn(t)});function C_n(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}var ok=class t extends gn{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.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(i,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.number,received:i.parsedType}),ue.INVALID}let n,o=new ue.ParseStatus;for(let i of this._def.checks)i.kind==="int"?at.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,ue.addIssueToContext)(n,{code:Ye.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,ue.addIssueToContext)(n,{code:Ye.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,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?C_n(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,ue.addIssueToContext)(n,{code:Ye.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,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.not_finite,message:i.message}),o.dirty()):at.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Xt.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Xt.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Xt.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Xt.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Xt.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Xt.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Xt.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Xt.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Xt.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Xt.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Xt.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Xt.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Xt.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Xt.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"&&at.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)}};se.ZodNumber=ok;ok.create=t=>new ok({checks:[],typeName:Dr.ZodNumber,coerce:t?.coerce||!1,...hn(t)});var ik=class t extends gn{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.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new ue.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,ue.addIssueToContext)(n,{code:Ye.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,ue.addIssueToContext)(n,{code:Ye.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,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):at.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.bigint,received:r.parsedType}),ue.INVALID}gte(e,r){return this.setLimit("min",e,!0,Xt.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Xt.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Xt.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Xt.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Xt.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:Xt.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Xt.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Xt.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Xt.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Xt.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}};se.ZodBigInt=ik;ik.create=t=>new ik({checks:[],typeName:Dr.ZodBigInt,coerce:t?.coerce??!1,...hn(t)});var ak=class extends gn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==at.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.boolean,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};se.ZodBoolean=ak;ak.create=t=>new ak({typeName:Dr.ZodBoolean,coerce:t?.coerce||!1,...hn(t)});var sk=class t extends gn{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==at.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(i,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.date,received:i.parsedType}),ue.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(i,{code:Ye.ZodIssueCode.invalid_date}),ue.INVALID}let n=new ue.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Ye.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,ue.addIssueToContext)(o,{code:Ye.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):at.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:Xt.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Xt.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}};se.ZodDate=sk;sk.create=t=>new sk({checks:[],coerce:t?.coerce||!1,typeName:Dr.ZodDate,...hn(t)});var M3=class extends gn{_parse(e){if(this._getType(e)!==at.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.symbol,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};se.ZodSymbol=M3;M3.create=t=>new M3({typeName:Dr.ZodSymbol,...hn(t)});var uk=class extends gn{_parse(e){if(this._getType(e)!==at.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.undefined,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};se.ZodUndefined=uk;uk.create=t=>new uk({typeName:Dr.ZodUndefined,...hn(t)});var lk=class extends gn{_parse(e){if(this._getType(e)!==at.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.null,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};se.ZodNull=lk;lk.create=t=>new lk({typeName:Dr.ZodNull,...hn(t)});var GR=class extends gn{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,ue.OK)(e.data)}};se.ZodAny=GR;GR.create=t=>new GR({typeName:Dr.ZodAny,...hn(t)});var iT=class extends gn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,ue.OK)(e.data)}};se.ZodUnknown=iT;iT.create=t=>new iT({typeName:Dr.ZodUnknown,...hn(t)});var T_=class extends gn{_parse(e){let r=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.never,received:r.parsedType}),ue.INVALID}};se.ZodNever=T_;T_.create=t=>new T_({typeName:Dr.ZodNever,...hn(t)});var R3=class extends gn{_parse(e){if(this._getType(e)!==at.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.void,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};se.ZodVoid=R3;R3.create=t=>new R3({typeName:Dr.ZodVoid,...hn(t)});var aT=class t extends gn{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==at.ZodParsedType.array)return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.array,received:r.parsedType}),ue.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,ue.addIssueToContext)(r,{code:a?Ye.ZodIssueCode.too_big:Ye.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,ue.addIssueToContext)(r,{code:Ye.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,ue.addIssueToContext)(r,{code:Ye.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 Fy(r,a,r.path,s)))).then(a=>ue.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Fy(r,a,r.path,s)));return ue.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Xt.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Xt.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Xt.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};se.ZodArray=aT;aT.create=(t,e)=>new aT({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Dr.ZodArray,...hn(e)});function I3(t){if(t instanceof ah){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Ly.create(I3(n))}return new ah({...t._def,shape:()=>e})}else return t instanceof aT?new aT({...t._def,type:I3(t.element)}):t instanceof Ly?Ly.create(I3(t.unwrap())):t instanceof SO?SO.create(I3(t.unwrap())):t instanceof xO?xO.create(t.items.map(e=>I3(e))):t}var ah=class t extends gn{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=at.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==at.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(l,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.object,received:l.parsedType}),ue.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof T_&&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 Fy(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof T_){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,ue.addIssueToContext)(o,{code:Ye.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 Fy(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=>ue.ParseStatus.mergeObjectSync(n,l)):ue.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Xt.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Xt.errorUtil.errToObj(e).message??o}:{message:o}}}:{}})}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:Dr.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of at.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of at.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return I3(this)}partial(e){let r={};for(let n of at.util.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of at.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Ly;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return iWt(at.util.objectKeys(this.shape))}};se.ZodObject=ah;ah.create=(t,e)=>new ah({shape:()=>t,unknownKeys:"strip",catchall:T_.create(),typeName:Dr.ZodObject,...hn(e)});ah.strictCreate=(t,e)=>new ah({shape:()=>t,unknownKeys:"strict",catchall:T_.create(),typeName:Dr.ZodObject,...hn(e)});ah.lazycreate=(t,e)=>new ah({shape:t,unknownKeys:"strip",catchall:T_.create(),typeName:Dr.ZodObject,...hn(e)});var ck=class extends gn{_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 Ye.ZodError(s.ctx.common.issues));return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_union,unionErrors:a}),ue.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 Ye.ZodError(u));return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_union,unionErrors:s}),ue.INVALID}}get options(){return this._def.options}};se.ZodUnion=ck;ck.create=(t,e)=>new ck({options:t,typeName:Dr.ZodUnion,...hn(e)});var oT=t=>t instanceof fk?oT(t.schema):t instanceof pg?oT(t.innerType()):t instanceof pk?[t.value]:t instanceof mk?t.options:t instanceof hk?at.util.objectValues(t.enum):t instanceof gk?oT(t._def.innerType):t instanceof uk?[void 0]:t instanceof lk?[null]:t instanceof Ly?[void 0,...oT(t.unwrap())]:t instanceof SO?[null,...oT(t.unwrap())]:t instanceof mJ||t instanceof bk?oT(t.unwrap()):t instanceof yk?oT(t._def.innerType):[],Zpe=class t extends gn{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==at.ZodParsedType.object)return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.object,received:r.parsedType}),ue.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,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ue.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=oT(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:Dr.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...hn(n)})}};se.ZodDiscriminatedUnion=Zpe;function v4e(t,e){let r=(0,at.getParsedType)(t),n=(0,at.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===at.ZodParsedType.object&&n===at.ZodParsedType.object){let o=at.util.objectKeys(e),i=at.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=v4e(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===at.ZodParsedType.array&&n===at.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=v4e(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===at.ZodParsedType.date&&n===at.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var dk=class extends gn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if((0,ue.isAborted)(i)||(0,ue.isAborted)(a))return ue.INVALID;let s=v4e(i.value,a.value);return s.valid?(((0,ue.isDirty)(i)||(0,ue.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_intersection_types}),ue.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}))}};se.ZodIntersection=dk;dk.create=(t,e,r)=>new dk({left:t,right:e,typeName:Dr.ZodIntersection,...hn(r)});var xO=class t extends gn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==at.ZodParsedType.array)return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.array,received:n.parsedType}),ue.INVALID;if(n.data.length<this._def.items.length)return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ue.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,ue.addIssueToContext)(n,{code:Ye.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 Fy(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>ue.ParseStatus.mergeArray(r,a)):ue.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};se.ZodTuple=xO;xO.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xO({items:t,typeName:Dr.ZodTuple,rest:null,...hn(e)})};var Ype=class t extends gn{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.ZodParsedType.object)return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.object,received:n.parsedType}),ue.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Fy(n,s,n.path,s)),value:a._parse(new Fy(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?ue.ParseStatus.mergeObjectAsync(r,o):ue.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof gn?new t({keyType:e,valueType:r,typeName:Dr.ZodRecord,...hn(n)}):new t({keyType:KR.create(),valueType:e,typeName:Dr.ZodRecord,...hn(r)})}};se.ZodRecord=Ype;var N3=class extends gn{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.ZodParsedType.map)return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.map,received:n.parsedType}),ue.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new Fy(n,s,n.path,[l,"key"])),value:i._parse(new Fy(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 ue.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 ue.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};se.ZodMap=N3;N3.create=(t,e,r)=>new N3({valueType:e,keyType:t,typeName:Dr.ZodMap,...hn(r)});var j3=class t extends gn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==at.ZodParsedType.set)return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.set,received:n.parsedType}),ue.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,ue.addIssueToContext)(n,{code:Ye.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,ue.addIssueToContext)(n,{code:Ye.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 ue.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 Fy(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:Xt.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Xt.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};se.ZodSet=j3;j3.create=(t,e)=>new j3({valueType:t,minSize:null,maxSize:null,typeName:Dr.ZodSet,...hn(e)});var Xpe=class t extends gn{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==at.ZodParsedType.function)return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.function,received:r.parsedType}),ue.INVALID;function n(s,u){return(0,ue.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Jpe.getErrorMap)(),Jpe.defaultErrorMap].filter(l=>!!l),issueData:{code:Ye.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,ue.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Jpe.getErrorMap)(),Jpe.defaultErrorMap].filter(l=>!!l),issueData:{code:Ye.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof JR){let s=this;return(0,ue.OK)(async function(...u){let l=new Ye.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,ue.OK)(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new Ye.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 Ye.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:xO.create(e).rest(iT.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||xO.create([]).rest(iT.create()),returns:r||iT.create(),typeName:Dr.ZodFunction,...hn(n)})}};se.ZodFunction=Xpe;var fk=class extends gn{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})}};se.ZodLazy=fk;fk.create=(t,e)=>new fk({getter:t,typeName:Dr.ZodLazy,...hn(e)});var pk=class extends gn{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(r,{received:r.data,code:Ye.ZodIssueCode.invalid_literal,expected:this._def.value}),ue.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};se.ZodLiteral=pk;pk.create=(t,e)=>new pk({value:t,typeName:Dr.ZodLiteral,...hn(e)});function iWt(t,e){return new mk({values:t,typeName:Dr.ZodEnum,...hn(e)})}var mk=class t extends gn{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,ue.addIssueToContext)(r,{expected:at.util.joinValues(n),received:r.parsedType,code:Ye.ZodIssueCode.invalid_type}),ue.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,ue.addIssueToContext)(r,{received:r.data,code:Ye.ZodIssueCode.invalid_enum_value,options:n}),ue.INVALID}return(0,ue.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})}};se.ZodEnum=mk;mk.create=iWt;var hk=class extends gn{_parse(e){let r=at.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==at.ZodParsedType.string&&n.parsedType!==at.ZodParsedType.number){let o=at.util.objectValues(r);return(0,ue.addIssueToContext)(n,{expected:at.util.joinValues(o),received:n.parsedType,code:Ye.ZodIssueCode.invalid_type}),ue.INVALID}if(this._cache||(this._cache=new Set(at.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=at.util.objectValues(r);return(0,ue.addIssueToContext)(n,{received:n.data,code:Ye.ZodIssueCode.invalid_enum_value,options:o}),ue.INVALID}return(0,ue.OK)(e.data)}get enum(){return this._def.values}};se.ZodNativeEnum=hk;hk.create=(t,e)=>new hk({values:t,typeName:Dr.ZodNativeEnum,...hn(e)});var JR=class extends gn{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==at.ZodParsedType.promise&&r.common.async===!1)return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.promise,received:r.parsedType}),ue.INVALID;let n=r.parsedType===at.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,ue.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};se.ZodPromise=JR;JR.create=(t,e)=>new JR({type:t,typeName:Dr.ZodPromise,...hn(e)});var pg=class extends gn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Dr.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,ue.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 ue.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?ue.INVALID:u.status==="dirty"||r.value==="dirty"?(0,ue.DIRTY)(u.value):u});{if(r.value==="aborted")return ue.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?ue.INVALID:s.status==="dirty"||r.value==="dirty"?(0,ue.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"?ue.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"?ue.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,ue.isValid)(a))return ue.INVALID;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,ue.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):ue.INVALID);at.util.assertNever(o)}};se.ZodEffects=pg;se.ZodTransformer=pg;pg.create=(t,e,r)=>new pg({schema:t,typeName:Dr.ZodEffects,effect:e,...hn(r)});pg.createWithPreprocess=(t,e,r)=>new pg({schema:e,effect:{type:"preprocess",transform:t},typeName:Dr.ZodEffects,...hn(r)});var Ly=class extends gn{_parse(e){return this._getType(e)===at.ZodParsedType.undefined?(0,ue.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};se.ZodOptional=Ly;Ly.create=(t,e)=>new Ly({innerType:t,typeName:Dr.ZodOptional,...hn(e)});var SO=class extends gn{_parse(e){return this._getType(e)===at.ZodParsedType.null?(0,ue.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};se.ZodNullable=SO;SO.create=(t,e)=>new SO({innerType:t,typeName:Dr.ZodNullable,...hn(e)});var gk=class extends gn{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===at.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};se.ZodDefault=gk;gk.create=(t,e)=>new gk({innerType:t,typeName:Dr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...hn(e)});var yk=class extends gn{_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,ue.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ye.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ye.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};se.ZodCatch=yk;yk.create=(t,e)=>new yk({innerType:t,typeName:Dr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...hn(e)});var D3=class extends gn{_parse(e){if(this._getType(e)!==at.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:at.ZodParsedType.nan,received:n.parsedType}),ue.INVALID}return{status:"valid",value:e.data}}};se.ZodNaN=D3;D3.create=t=>new D3({typeName:Dr.ZodNaN,...hn(t)});se.BRAND=Symbol("zod_brand");var mJ=class extends gn{_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}};se.ZodBranded=mJ;var hJ=class t extends gn{_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"?ue.INVALID:i.status==="dirty"?(r.dirty(),(0,ue.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"?ue.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:Dr.ZodPipeline})}};se.ZodPipeline=hJ;var bk=class extends gn{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,ue.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,ue.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};se.ZodReadonly=bk;bk.create=(t,e)=>new bk({innerType:t,typeName:Dr.ZodReadonly,...hn(e)});function tWt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function aWt(t,e={},r){return t?GR.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=tWt(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=tWt(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):GR.create()}se.late={object:ah.lazycreate};var Dr;(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"})(Dr||(se.ZodFirstPartyTypeKind=Dr={}));var O_n=(t,e={message:`Input not instance of ${t.name}`})=>aWt(r=>r instanceof t,e);se.instanceof=O_n;var sWt=KR.create;se.string=sWt;var uWt=ok.create;se.number=uWt;var E_n=D3.create;se.nan=E_n;var P_n=ik.create;se.bigint=P_n;var lWt=ak.create;se.boolean=lWt;var T_n=sk.create;se.date=T_n;var A_n=M3.create;se.symbol=A_n;var I_n=uk.create;se.undefined=I_n;var M_n=lk.create;se.null=M_n;var R_n=GR.create;se.any=R_n;var N_n=iT.create;se.unknown=N_n;var j_n=T_.create;se.never=j_n;var D_n=R3.create;se.void=D_n;var L_n=aT.create;se.array=L_n;var F_n=ah.create;se.object=F_n;var k_n=ah.strictCreate;se.strictObject=k_n;var $_n=ck.create;se.union=$_n;var B_n=Zpe.create;se.discriminatedUnion=B_n;var z_n=dk.create;se.intersection=z_n;var U_n=xO.create;se.tuple=U_n;var q_n=Ype.create;se.record=q_n;var H_n=N3.create;se.map=H_n;var V_n=j3.create;se.set=V_n;var W_n=Xpe.create;se.function=W_n;var K_n=fk.create;se.lazy=K_n;var G_n=pk.create;se.literal=G_n;var J_n=mk.create;se.enum=J_n;var Z_n=hk.create;se.nativeEnum=Z_n;var Y_n=JR.create;se.promise=Y_n;var cWt=pg.create;se.effect=cWt;se.transformer=cWt;var X_n=Ly.create;se.optional=X_n;var Q_n=SO.create;se.nullable=Q_n;var evn=pg.createWithPreprocess;se.preprocess=evn;var tvn=hJ.create;se.pipeline=tvn;var rvn=()=>sWt().optional();se.ostring=rvn;var nvn=()=>uWt().optional();se.onumber=nvn;var ovn=()=>lWt().optional();se.oboolean=ovn;se.coerce={string:t=>KR.create({...t,coerce:!0}),number:t=>ok.create({...t,coerce:!0}),boolean:t=>ak.create({...t,coerce:!0}),bigint:t=>ik.create({...t,coerce:!0}),date:t=>sk.create({...t,coerce:!0})};se.NEVER=ue.INVALID});var w4e=x(ky=>{"use strict";var ivn=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]}),L3=ky&&ky.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ivn(e,t,r)};Object.defineProperty(ky,"__esModule",{value:!0});L3(Kpe(),ky);L3(b4e(),ky);L3(Y5t(),ky);L3(fJ(),ky);L3(dWt(),ky);L3(Wpe(),ky)});var Ie=x(sh=>{"use strict";var fWt=sh&&sh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),avn=sh&&sh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),svn=sh&&sh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fWt(e,t,r);return avn(e,t),e},uvn=sh&&sh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fWt(e,t,r)};Object.defineProperty(sh,"__esModule",{value:!0});sh.z=void 0;var pWt=svn(w4e());sh.z=pWt;uvn(w4e(),sh);sh.default=pWt});var C4e=x(ed=>{"use strict";var lvn=ed&&ed.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cvn=ed&&ed.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dvn=ed&&ed.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lvn(e,t,r);return cvn(e,t),e};Object.defineProperty(ed,"__esModule",{value:!0});ed.zodInbound=ed.zodOutbound=void 0;ed.bytesToBase64=mWt;ed.bytesFromBase64=x4e;ed.stringToBytes=S4e;ed.stringFromBytes=hWt;ed.stringToBase64=fvn;ed.stringFromBase64=pvn;var Qpe=dvn(Ie());function mWt(t){return btoa(String.fromCodePoint(...t))}function x4e(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function S4e(t){return new TextEncoder().encode(t)}function hWt(t){return new TextDecoder().decode(t)}function fvn(t){return mWt(S4e(t))}function pvn(t){return hWt(x4e(t))}ed.zodOutbound=Qpe.instanceof(Uint8Array).or(Qpe.string().transform(S4e));ed.zodInbound=Qpe.instanceof(Uint8Array).or(Qpe.string().transform(x4e))});var E4e=x(O4e=>{"use strict";Object.defineProperty(O4e,"__esModule",{value:!0});O4e.isPlainObject=mvn;function mvn(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 wi=x(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.encodeDeepObjectQuery=Co.encodePipeDelimitedQuery=Co.encodeSpaceDelimitedQuery=Co.encodeFormQuery=Co.encodeJSONQuery=Co.encodeSimple=Co.encodePipeDelimited=Co.encodeSpaceDelimited=Co.encodeForm=Co.EncodingError=void 0;Co.encodeMatrix=hvn;Co.encodeLabel=gvn;Co.encodeBodyForm=yvn;Co.encodeDeepObject=yWt;Co.encodeDeepObjectObject=T4e;Co.encodeJSON=bWt;Co.queryJoin=_Wt;Co.queryEncoder=k3;Co.appendForm=_vn;var gWt=C4e(),A_=E4e(),gJ=class extends Error{constructor(e){super(e),this.name="EncodingError"}};Co.EncodingError=gJ;function hvn(t,e,r){let n="",o=r?.explode?yJ(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(F3(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=bJ(u,f=>`${a(f)}`)?.join(","):(0,A_.isPlainObject)(u)?c=tme(Object.entries(u),([p,h])=>`,${i(p)},${a(h)}`)?.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 gvn(t,e,r){let n="",o=r?.explode?yJ(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(F3(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=bJ(u,c=>`${a(c)}`)?.join("."):(0,A_.isPlainObject)(u)?l=tme(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,A_.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function P4e(t){return(e,r,n)=>{let o="",i=n?.explode?yJ(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(F3(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=bJ(c,p=>`${s(p)}`)?.join(u):(0,A_.isPlainObject)(c)?f=tme(Object.entries(c),([p,h])=>`${a(p)}${u}${s(h)}`)?.join(u):f=`${s(c)}`,f!=null&&(d=`${a(l)}=${f}`,!(!d||d==="=")&&(o+=`&${d}`)))}),o.slice(1)}}Co.encodeForm=P4e(",");Co.encodeSpaceDelimited=P4e(" ");Co.encodePipeDelimited=P4e("|");function yvn(t,e,r){let n="",o=r?.explode?yJ(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(F3(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,A_.isPlainObject)(u)?c=JSON.stringify(u,eme):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function yWt(t,e,r){if(e!=null){if(!(0,A_.isPlainObject)(e))throw new gJ(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return T4e(t,e,r)}}function T4e(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,A_.isPlainObject)(e))throw new gJ(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,A_.isPlainObject)(a)){let c=T4e(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=bJ(u,c=>`${o(s)}=${o(F3(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function bWt(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,eme));return r?.explode?o:`${n(t)}=${o}`}var bvn=(t,e,r)=>{let n="",o=r?.explode?yJ(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(F3(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=bJ(u,c=>`${a(c)}`)?.join(","):(0,A_.isPlainObject)(u)?l=tme(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,A_.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};Co.encodeSimple=bvn;function yJ(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,A_.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function F3(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,gWt.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,eme):`${t}`}function eme(t,e){return e instanceof Uint8Array?(0,gWt.bytesToBase64)(e):e}function bJ(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 tme(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 _Wt(...t){return t.filter(Boolean).join("&")}function k3(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 _Wt(...i)}}Co.encodeJSONQuery=k3(bWt);Co.encodeFormQuery=k3(Co.encodeForm);Co.encodeSpaceDelimitedQuery=k3(Co.encodeSpaceDelimited);Co.encodePipeDelimitedQuery=k3(Co.encodePipeDelimited);Co.encodeDeepObjectQuery=k3(yWt);function _vn(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 vWt=x(A4e=>{"use strict";Object.defineProperty(A4e,"__esModule",{value:!0});A4e.dlv=vvn;function vvn(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 M4e=x(mg=>{"use strict";var wvn=mg&&mg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xvn=mg&&mg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Svn=mg&&mg.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wvn(e,t,r);return xvn(e,t),e};Object.defineProperty(mg,"__esModule",{value:!0});mg.envSchema=void 0;mg.env=Cvn;mg.resetEnv=Ovn;var wWt=vWt(),I4e=Svn(Ie());mg.envSchema=I4e.object({MISTRAL_API_KEY:I4e.string().optional(),MISTRAL_DEBUG:I4e.coerce.boolean().optional()});var _J;function Cvn(){return _J||(_J=mg.envSchema.parse((0,wWt.dlv)(globalThis,"process.env")??(0,wWt.dlv)(globalThis,"Deno.env")??{}),_J)}function Ovn(){_J=void 0}});var vJ=x(CO=>{"use strict";Object.defineProperty(CO,"__esModule",{value:!0});CO.HTTPClient=void 0;CO.matchContentType=SWt;CO.matchStatusCode=CWt;CO.matchResponse=Tvn;CO.isConnectionError=Avn;CO.isTimeoutError=Ivn;CO.isAbortError=Mvn;var Evn=(t,e)=>e==null?fetch(t):fetch(t,e),R4e=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||Evn}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}};CO.HTTPClient=R4e;var xWt=/\s*;\s*/g;function SWt(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(xWt),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(xWt),[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 Pvn=new RegExp("^[0-9]xx$","i");function CWt(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(!Pvn.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 Tvn(t,e,r){return CWt(t,e)&&SWt(t,r)}function Avn(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 Ivn(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 Mvn(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 EWt=x(vk=>{"use strict";Object.defineProperty(vk,"__esModule",{value:!0});vk.TemporaryError=vk.PermanentError=void 0;vk.retry=Nvn;var OWt=vJ(),Rvn={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},wJ=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)}};vk.PermanentError=wJ;var _k=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};vk.TemporaryError=_k;async function Nvn(t,e){switch(e.config.strategy){case"backoff":return Fvn(jvn(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??Rvn);default:return await t()}}function jvn(t,e){return async()=>{try{let r=await t();if(Lvn(r,e.statusCodes))throw new _k("Response failed with retryable status code",r);return r}catch(r){throw r instanceof _k||e.retryConnectionErrors&&((0,OWt.isTimeoutError)(r)||(0,OWt.isConnectionError)(r))?r:new wJ("Permanent error",{cause:r})}}}var Dvn=new RegExp("^[0-9]xx$","i");function Lvn(t,e){let r=`${t.status}`;return e.some(n=>{if(!Dvn.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 Fvn(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 wJ)throw u.cause;if(Date.now()-a>r){if(u instanceof _k)return u.response;throw u}let c=0;u instanceof _k&&(c=kvn(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await $vn(d),s++}}function kvn(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 $vn(t){return new Promise(e=>setTimeout(e,t))}});var hg=x(YR=>{"use strict";var xJ=YR&&YR.__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},$y=YR&&YR.__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)},nme,OO,sT;Object.defineProperty(YR,"__esModule",{value:!0});YR.ClientSDK=void 0;var PWt=H5t(),$3=p4e(),ZR=Dy(),Bvn=C4e(),TWt=Upe(),zvn=wi(),Uvn=M4e(),uT=vJ(),qvn=EWt(),rme=typeof globalThis>"u"?null:globalThis,Hvn=typeof rme=="object"&&rme!=null&&"importScripts"in rme&&typeof rme.importScripts=="function",Vvn=Hvn||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",N4e=class{constructor(e={}){nme.set(this,void 0),OO.set(this,void 0),sT.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof PWt.SDKHooks?xJ(this,OO,r.hooks,"f"):xJ(this,OO,new PWt.SDKHooks,"f"),this._options={...e,hooks:$y(this,OO,"f")};let n=(0,TWt.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=$y(this,OO,"f").sdkInit({baseURL:n,client:e.httpClient||new uT.HTTPClient});this._baseURL=o,xJ(this,nme,i,"f"),xJ(this,sT,e.debugLogger,"f"),!$y(this,sT,"f")&&(0,Uvn.env)().MISTRAL_DEBUG&&xJ(this,sT,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,ZR.ERR)(new $3.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[E,P]of Object.entries(u?.queryParams||{})){let T=(0,zvn.encodeForm)(E,P,{charEncoding:"percent"});typeof T<"u"&&p.push(T)}if(p.length&&(f+=`&${p.join("&")}`),f){let E=f.startsWith("&")?f.slice(1):f;c.search=`?${E}`}let h=new Headers(s),m=u?.basic.username,g=u?.basic.password;if(m!=null||g!=null){let E=(0,Bvn.stringToBase64)([m||"",g||""].join(":"));h.set("Authorization",`Basic ${E}`)}let y=new Headers(u?.headers||{});for(let[E,P]of y)h.set(E,P);let _=h.get("cookie")||"";for(let[E,P]of Object.entries(u?.cookies||{}))_+=`; ${E}=${P}`;_=_.startsWith("; ")?_.slice(2):_,h.set("cookie",_);let w=new Headers(n?.fetchOptions?.headers);for(let[E,P]of w)h.set(E,P);Vvn||h.set(r.uaHeader??"user-agent",TWt.SDK_METADATA.userAgent);let S=n?.fetchOptions;if(!S?.signal&&r.timeoutMs&&r.timeoutMs>0){let E=AbortSignal.timeout(r.timeoutMs);S?S.signal=E:S={signal:E}}r.body instanceof ReadableStream&&(S?S.duplex="half":S={duplex:"half"});let C;try{C=$y(this,OO,"f").beforeCreateRequest(e,{url:c,options:{...S,body:r.body??null,headers:h,method:o}})}catch(E){return(0,ZR.ERR)(new $3.UnexpectedClientError("Create request hook failed to execute",{cause:E}))}return(0,ZR.OK)(new Request(C.url,C.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,qvn.retry)(async()=>{let i=await $y(this,OO,"f").beforeRequest(n,e.clone());await Wvn($y(this,sT,"f"),i).catch(s=>$y(this,sT,"f")?.log("Failed to log request:",s));let a=await $y(this,nme,"f").request(i);try{if((0,uT.matchStatusCode)(a,o)){let s=await $y(this,OO,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await $y(this,OO,"f").afterSuccess(n,a)}finally{await Kvn($y(this,sT,"f"),a,i).catch(s=>$y(this,sT,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,ZR.OK)(i),i=>{switch(!0){case(0,uT.isAbortError)(i):return(0,ZR.ERR)(new $3.RequestAbortedError("Request aborted by client",{cause:i}));case(0,uT.isTimeoutError)(i):return(0,ZR.ERR)(new $3.RequestTimeoutError("Request timed out",{cause:i}));case(0,uT.isConnectionError)(i):return(0,ZR.ERR)(new $3.ConnectionError("Unable to make request",{cause:i}));default:return(0,ZR.ERR)(new $3.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};YR.ClientSDK=N4e;nme=new WeakMap,OO=new WeakMap,sT=new WeakMap;var AWt=/^application\/(?:.{0,100}\+)?json/;async function Wvn(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 AWt.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 Kvn(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,uT.matchContentType)(e,"application/json")||AWt.test(o)):t.log(await e.clone().json());break;case(0,uT.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,uT.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,uT.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 D4e=x(ome=>{"use strict";Object.defineProperty(ome,"__esModule",{value:!0});ome.SDKError=void 0;var j4e=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"}};ome.SDKError=j4e});var EJ=x(OJ=>{"use strict";Object.defineProperty(OJ,"__esModule",{value:!0});OJ.EventStream=void 0;OJ.discardSentinel=Zvn;var SJ=10,CJ=13,IWt=new Set([SJ,CJ]),Gvn=[new Uint8Array([CJ,SJ,CJ,SJ]),new Uint8Array([CJ,CJ]),new Uint8Array([SJ,SJ])],L4e=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=MWt(r,s);if(u==null)continue;let l=r.slice(n,s);n=s+u.length;let c=F4e(l,this.decoder);c!=null&&(yield c)}n>0&&(r=r.slice(n),n=0)}if(r.length>0){let o=F4e(r,this.decoder);o!=null&&(yield o)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{e.releaseLock()}}};OJ.EventStream=L4e;function MWt(t,e){let r=t[e],n=t[e+1];if(r==null||n==null||!IWt.has(r)||!IWt.has(n))return null;for(let o of Gvn){let i=Jvn(e,t,o);if(i!=null)return i}return null}function Jvn(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 F4e(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 Zvn(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=MWt(n,d);if(f==null)continue;let p=o,h=n.slice(p,d);o=d+f.length,F4e(h,Yvn)?.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 Yvn(t){return t}});var B4e=x(I_=>{"use strict";var Xvn=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]}),Qvn=I_&&I_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ewn=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)&&Xvn(e,t,r);return Qvn(e,t),e};Object.defineProperty(I_,"__esModule",{value:!0});I_.SDKValidationError=void 0;I_.formatZodError=$4e;var twn=ewn(Ie()),k4e=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 twn.ZodError?`${this.rawMessage}
${$4e(this.cause)}`:this.toString()}};I_.SDKValidationError=k4e;function $4e(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(`${$4e(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var Ce=x(PJ=>{"use strict";Object.defineProperty(PJ,"__esModule",{value:!0});PJ.parse=nwn;PJ.safeParse=own;PJ.collectExtraKeys=iwn;var rwn=Ie(),NWt=B4e(),RWt=Dy();function nwn(t,e,r){try{return e(t)}catch(n){throw n instanceof rwn.ZodError?new NWt.SDKValidationError(r,n,t):n}}function own(t,e,r){try{return(0,RWt.OK)(e(t))}catch(n){return(0,RWt.ERR)(new NWt.SDKValidationError(r,n,t))}}function iwn(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 xi=x(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});td.jsonErr=uwn;td.json=lwn;td.textErr=cwn;td.text=dwn;td.bytesErr=fwn;td.bytes=pwn;td.streamErr=mwn;td.stream=hwn;td.sseErr=gwn;td.sse=ywn;td.nilErr=bwn;td.nil=_wn;td.fail=vwn;td.match=wwn;td.unpackHeaders=ime;td.discardResponseBody=kWt;var jWt=D4e(),awn=EJ(),DWt=vJ(),LWt=E4e(),FWt=Ce(),swn={json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function uwn(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function lwn(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function cwn(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function dwn(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function fwn(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function pwn(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function mwn(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function hwn(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function gwn(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function ywn(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function bwn(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function _wn(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function vwn(t){return{enc:"fail",codes:t}}function wwn(...t){return async function(r,n){let o,i;for(let l of t){let{codes:c}=l,d="ctype"in l?l.ctype:swn[l.enc];if(d&&(0,DWt.matchResponse)(r,c,d)){i=l;break}else if(!d&&(0,DWt.matchStatusCode)(r,c)){i=l;break}}if(!i){let l=await r.text();return[{ok:!1,error:new jWt.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,awn.discardSentinel)(r.body,i.sseSentinel):r.body;break;case"nil":o=await kWt(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 jWt.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:ime(r.headers)}:null,...(0,LWt.isPlainObject)(o)?o:null}:s?u={...n?.extraFields,...i.hdrs?{Headers:ime(r.headers)}:null,[s]:o}:i.hdrs?u={...n?.extraFields,...i.hdrs?{Headers:ime(r.headers)}:null,...(0,LWt.isPlainObject)(o)?o:null}:u=o,"err"in i){let l=(0,FWt.safeParse)(u,c=>i.schema.parse(c),"Response validation failed");return[l.ok?{ok:!1,error:l.value}:l,o]}else return[(0,FWt.safeParse)(u,l=>i.schema.parse(l),"Response validation failed"),o]}}var xwn=/, */;function ime(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(xwn);return e}async function kWt(t){let e=t.body?.getReader();if(e!=null)try{let r=!1;for(;!r;)r=(await e.read()).done}finally{e.releaseLock()}}});var Ke=x(wk=>{"use strict";Object.defineProperty(wk,"__esModule",{value:!0});wk.invariant=Swn;wk.remap=Cwn;wk.combineSignals=Own;wk.abortSignalAny=$Wt;wk.compactMap=Ewn;var z4e=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function Swn(t,e){if(!t)throw new z4e(e)}function Cwn(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 Own(...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):$Wt(e)}}function $Wt(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 Ewn(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}});var Si=x(lT=>{"use strict";Object.defineProperty(lT,"__esModule",{value:!0});lT.SecurityError=lT.SecurityErrorCode=void 0;lT.resolveSecurity=BWt;lT.resolveGlobalSecurity=Awn;lT.extractSecurity=Iwn;var Pwn=M4e(),sme;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(sme||(lT.SecurityErrorCode=sme={}));var ume=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(sme.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(sme.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};lT.SecurityError=ume;function BWt(...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":Twn(e,n);break;case"http:custom":break;case"http:bearer":ame(e,n);break;case"oauth2":ame(e,n);break;case"oauth2:password":ame(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":ame(e,n);break;default:throw ume.unrecognizedType(o)}}),e)}function Twn(t,e){e.value!=null&&(t.basic=e.value)}function ame(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 Awn(t){return BWt([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,Pwn.env)().MISTRAL_API_KEY}])}async function Iwn(t){if(t!=null)return typeof t=="function"?t():t}});var U4e=x(Mu=>{"use strict";var Mwn=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]}),Rwn=Mu&&Mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nwn=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)&&Mwn(e,t,r);return Rwn(e,t),e};Object.defineProperty(Mu,"__esModule",{value:!0});Mu.ImageURL$=Mu.ImageURL$outboundSchema=Mu.ImageURL$inboundSchema=void 0;Mu.imageURLToJSON=Dwn;Mu.imageURLFromJSON=Lwn;var XR=Nwn(Ie()),jwn=Ce();Mu.ImageURL$inboundSchema=XR.object({url:XR.string(),detail:XR.nullable(XR.string()).optional()});Mu.ImageURL$outboundSchema=XR.object({url:XR.string(),detail:XR.nullable(XR.string()).optional()});var zWt;(function(t){t.inboundSchema=Mu.ImageURL$inboundSchema,t.outboundSchema=Mu.ImageURL$outboundSchema})(zWt||(Mu.ImageURL$=zWt={}));function Dwn(t){return JSON.stringify(Mu.ImageURL$outboundSchema.parse(t))}function Lwn(t){return(0,jwn.safeParse)(t,e=>Mu.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var q4e=x(Vr=>{"use strict";var Fwn=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]}),kwn=Vr&&Vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$wn=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)&&Fwn(e,t,r);return kwn(e,t),e};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.ImageURLChunk$=Vr.ImageURLChunk$outboundSchema=Vr.ImageURLChunk$inboundSchema=Vr.ImageURLChunkType$=Vr.ImageURLChunkType$outboundSchema=Vr.ImageURLChunkType$inboundSchema=Vr.ImageURLChunkImageURL$=Vr.ImageURLChunkImageURL$outboundSchema=Vr.ImageURLChunkImageURL$inboundSchema=Vr.ImageURLChunkType=void 0;Vr.imageURLChunkImageURLToJSON=Bwn;Vr.imageURLChunkImageURLFromJSON=zwn;Vr.imageURLChunkToJSON=Uwn;Vr.imageURLChunkFromJSON=qwn;var M_=$wn(Ie()),VWt=Ke(),WWt=Ce(),lme=U4e();Vr.ImageURLChunkType={ImageUrl:"image_url"};Vr.ImageURLChunkImageURL$inboundSchema=M_.union([lme.ImageURL$inboundSchema,M_.string()]);Vr.ImageURLChunkImageURL$outboundSchema=M_.union([lme.ImageURL$outboundSchema,M_.string()]);var UWt;(function(t){t.inboundSchema=Vr.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=Vr.ImageURLChunkImageURL$outboundSchema})(UWt||(Vr.ImageURLChunkImageURL$=UWt={}));function Bwn(t){return JSON.stringify(Vr.ImageURLChunkImageURL$outboundSchema.parse(t))}function zwn(t){return(0,WWt.safeParse)(t,e=>Vr.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}Vr.ImageURLChunkType$inboundSchema=M_.nativeEnum(Vr.ImageURLChunkType);Vr.ImageURLChunkType$outboundSchema=Vr.ImageURLChunkType$inboundSchema;var qWt;(function(t){t.inboundSchema=Vr.ImageURLChunkType$inboundSchema,t.outboundSchema=Vr.ImageURLChunkType$outboundSchema})(qWt||(Vr.ImageURLChunkType$=qWt={}));Vr.ImageURLChunk$inboundSchema=M_.object({image_url:M_.union([lme.ImageURL$inboundSchema,M_.string()]),type:Vr.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,VWt.remap)(t,{image_url:"imageUrl"}));Vr.ImageURLChunk$outboundSchema=M_.object({imageUrl:M_.union([lme.ImageURL$outboundSchema,M_.string()]),type:Vr.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,VWt.remap)(t,{imageUrl:"image_url"}));var HWt;(function(t){t.inboundSchema=Vr.ImageURLChunk$inboundSchema,t.outboundSchema=Vr.ImageURLChunk$outboundSchema})(HWt||(Vr.ImageURLChunk$=HWt={}));function Uwn(t){return JSON.stringify(Vr.ImageURLChunk$outboundSchema.parse(t))}function qwn(t){return(0,WWt.safeParse)(t,e=>Vr.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var H4e=x(Oo=>{"use strict";var Hwn=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]}),Vwn=Oo&&Oo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wwn=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)&&Hwn(e,t,r);return Vwn(e,t),e};Object.defineProperty(Oo,"__esModule",{value:!0});Oo.ReferenceChunk$=Oo.ReferenceChunk$outboundSchema=Oo.ReferenceChunk$inboundSchema=Oo.ReferenceChunkType$=Oo.ReferenceChunkType$outboundSchema=Oo.ReferenceChunkType$inboundSchema=Oo.ReferenceChunkType=void 0;Oo.referenceChunkToJSON=Gwn;Oo.referenceChunkFromJSON=Jwn;var xk=Wwn(Ie()),JWt=Ke(),Kwn=Ce();Oo.ReferenceChunkType={Reference:"reference"};Oo.ReferenceChunkType$inboundSchema=xk.nativeEnum(Oo.ReferenceChunkType);Oo.ReferenceChunkType$outboundSchema=Oo.ReferenceChunkType$inboundSchema;var KWt;(function(t){t.inboundSchema=Oo.ReferenceChunkType$inboundSchema,t.outboundSchema=Oo.ReferenceChunkType$outboundSchema})(KWt||(Oo.ReferenceChunkType$=KWt={}));Oo.ReferenceChunk$inboundSchema=xk.object({reference_ids:xk.array(xk.number().int()),type:Oo.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,JWt.remap)(t,{reference_ids:"referenceIds"}));Oo.ReferenceChunk$outboundSchema=xk.object({referenceIds:xk.array(xk.number().int()),type:Oo.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,JWt.remap)(t,{referenceIds:"reference_ids"}));var GWt;(function(t){t.inboundSchema=Oo.ReferenceChunk$inboundSchema,t.outboundSchema=Oo.ReferenceChunk$outboundSchema})(GWt||(Oo.ReferenceChunk$=GWt={}));function Gwn(t){return JSON.stringify(Oo.ReferenceChunk$outboundSchema.parse(t))}function Jwn(t){return(0,Kwn.safeParse)(t,e=>Oo.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var cme=x(Eo=>{"use strict";var Zwn=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]}),Ywn=Eo&&Eo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xwn=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)&&Zwn(e,t,r);return Ywn(e,t),e};Object.defineProperty(Eo,"__esModule",{value:!0});Eo.TextChunk$=Eo.TextChunk$outboundSchema=Eo.TextChunk$inboundSchema=Eo.TextChunkType$=Eo.TextChunkType$outboundSchema=Eo.TextChunkType$inboundSchema=Eo.TextChunkType=void 0;Eo.textChunkToJSON=e0n;Eo.textChunkFromJSON=t0n;var TJ=Xwn(Ie()),Qwn=Ce();Eo.TextChunkType={Text:"text"};Eo.TextChunkType$inboundSchema=TJ.nativeEnum(Eo.TextChunkType);Eo.TextChunkType$outboundSchema=Eo.TextChunkType$inboundSchema;var ZWt;(function(t){t.inboundSchema=Eo.TextChunkType$inboundSchema,t.outboundSchema=Eo.TextChunkType$outboundSchema})(ZWt||(Eo.TextChunkType$=ZWt={}));Eo.TextChunk$inboundSchema=TJ.object({text:TJ.string(),type:Eo.TextChunkType$inboundSchema.default("text")});Eo.TextChunk$outboundSchema=TJ.object({text:TJ.string(),type:Eo.TextChunkType$outboundSchema.default("text")});var YWt;(function(t){t.inboundSchema=Eo.TextChunk$inboundSchema,t.outboundSchema=Eo.TextChunk$outboundSchema})(YWt||(Eo.TextChunk$=YWt={}));function e0n(t){return JSON.stringify(Eo.TextChunk$outboundSchema.parse(t))}function t0n(t){return(0,Qwn.safeParse)(t,e=>Eo.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var B3=x(Ru=>{"use strict";var r0n=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]}),n0n=Ru&&Ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o0n=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)&&r0n(e,t,r);return n0n(e,t),e};Object.defineProperty(Ru,"__esModule",{value:!0});Ru.ContentChunk$=Ru.ContentChunk$outboundSchema=Ru.ContentChunk$inboundSchema=void 0;Ru.contentChunkToJSON=a0n;Ru.contentChunkFromJSON=s0n;var uh=o0n(Ie()),i0n=Ce(),QWt=q4e(),e9t=H4e(),t9t=cme();Ru.ContentChunk$inboundSchema=uh.union([QWt.ImageURLChunk$inboundSchema.and(uh.object({type:uh.literal("image_url")}).transform(t=>({type:t.type}))),t9t.TextChunk$inboundSchema.and(uh.object({type:uh.literal("text")}).transform(t=>({type:t.type}))),e9t.ReferenceChunk$inboundSchema.and(uh.object({type:uh.literal("reference")}).transform(t=>({type:t.type})))]);Ru.ContentChunk$outboundSchema=uh.union([QWt.ImageURLChunk$outboundSchema.and(uh.object({type:uh.literal("image_url")}).transform(t=>({type:t.type}))),t9t.TextChunk$outboundSchema.and(uh.object({type:uh.literal("text")}).transform(t=>({type:t.type}))),e9t.ReferenceChunk$outboundSchema.and(uh.object({type:uh.literal("reference")}).transform(t=>({type:t.type})))]);var XWt;(function(t){t.inboundSchema=Ru.ContentChunk$inboundSchema,t.outboundSchema=Ru.ContentChunk$outboundSchema})(XWt||(Ru.ContentChunk$=XWt={}));function a0n(t){return JSON.stringify(Ru.ContentChunk$outboundSchema.parse(t))}function s0n(t){return(0,i0n.safeParse)(t,e=>Ru.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var V4e=x(qo=>{"use strict";var u0n=qo&&qo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),l0n=qo&&qo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c0n=qo&&qo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&u0n(e,t,r);return l0n(e,t),e};Object.defineProperty(qo,"__esModule",{value:!0});qo.FunctionCall$=qo.FunctionCall$outboundSchema=qo.FunctionCall$inboundSchema=qo.Arguments$=qo.Arguments$outboundSchema=qo.Arguments$inboundSchema=void 0;qo.argumentsToJSON=d0n;qo.argumentsFromJSON=f0n;qo.functionCallToJSON=p0n;qo.functionCallFromJSON=m0n;var Nu=c0n(Ie()),o9t=Ce();qo.Arguments$inboundSchema=Nu.union([Nu.record(Nu.any()),Nu.string()]);qo.Arguments$outboundSchema=Nu.union([Nu.record(Nu.any()),Nu.string()]);var r9t;(function(t){t.inboundSchema=qo.Arguments$inboundSchema,t.outboundSchema=qo.Arguments$outboundSchema})(r9t||(qo.Arguments$=r9t={}));function d0n(t){return JSON.stringify(qo.Arguments$outboundSchema.parse(t))}function f0n(t){return(0,o9t.safeParse)(t,e=>qo.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}qo.FunctionCall$inboundSchema=Nu.object({name:Nu.string(),arguments:Nu.union([Nu.record(Nu.any()),Nu.string()])});qo.FunctionCall$outboundSchema=Nu.object({name:Nu.string(),arguments:Nu.union([Nu.record(Nu.any()),Nu.string()])});var n9t;(function(t){t.inboundSchema=qo.FunctionCall$inboundSchema,t.outboundSchema=qo.FunctionCall$outboundSchema})(n9t||(qo.FunctionCall$=n9t={}));function p0n(t){return JSON.stringify(qo.FunctionCall$outboundSchema.parse(t))}function m0n(t){return(0,o9t.safeParse)(t,e=>qo.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var QR=x(W4e=>{"use strict";Object.defineProperty(W4e,"__esModule",{value:!0});W4e.catchUnrecognizedEnum=h0n;function h0n(t){return t}});var AJ=x(ju=>{"use strict";var g0n=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]}),y0n=ju&&ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b0n=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)&&g0n(e,t,r);return y0n(e,t),e};Object.defineProperty(ju,"__esModule",{value:!0});ju.ToolTypes$=ju.ToolTypes$outboundSchema=ju.ToolTypes$inboundSchema=ju.ToolTypes=void 0;var Sk=b0n(Ie()),_0n=QR();ju.ToolTypes={Function:"function"};ju.ToolTypes$inboundSchema=Sk.union([Sk.nativeEnum(ju.ToolTypes),Sk.string().transform(_0n.catchUnrecognizedEnum)]);ju.ToolTypes$outboundSchema=Sk.union([Sk.nativeEnum(ju.ToolTypes),Sk.string().and(Sk.custom())]);var i9t;(function(t){t.inboundSchema=ju.ToolTypes$inboundSchema,t.outboundSchema=ju.ToolTypes$outboundSchema})(i9t||(ju.ToolTypes$=i9t={}))});var dme=x(Du=>{"use strict";var v0n=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]}),w0n=Du&&Du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x0n=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)&&v0n(e,t,r);return w0n(e,t),e};Object.defineProperty(Du,"__esModule",{value:!0});Du.ToolCall$=Du.ToolCall$outboundSchema=Du.ToolCall$inboundSchema=void 0;Du.toolCallToJSON=C0n;Du.toolCallFromJSON=O0n;var z3=x0n(Ie()),S0n=Ce(),s9t=V4e(),u9t=AJ();Du.ToolCall$inboundSchema=z3.object({id:z3.string().default("null"),type:u9t.ToolTypes$inboundSchema.optional(),function:s9t.FunctionCall$inboundSchema,index:z3.number().int().default(0)});Du.ToolCall$outboundSchema=z3.object({id:z3.string().default("null"),type:u9t.ToolTypes$outboundSchema.optional(),function:s9t.FunctionCall$outboundSchema,index:z3.number().int().default(0)});var a9t;(function(t){t.inboundSchema=Du.ToolCall$inboundSchema,t.outboundSchema=Du.ToolCall$outboundSchema})(a9t||(Du.ToolCall$=a9t={}));function C0n(t){return JSON.stringify(Du.ToolCall$outboundSchema.parse(t))}function O0n(t){return(0,S0n.safeParse)(t,e=>Du.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var e1=x(Wr=>{"use strict";var E0n=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]}),P0n=Wr&&Wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T0n=Wr&&Wr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&E0n(e,t,r);return P0n(e,t),e};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.AssistantMessage$=Wr.AssistantMessage$outboundSchema=Wr.AssistantMessage$inboundSchema=Wr.AssistantMessageRole$=Wr.AssistantMessageRole$outboundSchema=Wr.AssistantMessageRole$inboundSchema=Wr.AssistantMessageContent$=Wr.AssistantMessageContent$outboundSchema=Wr.AssistantMessageContent$inboundSchema=Wr.AssistantMessageRole=void 0;Wr.assistantMessageContentToJSON=A0n;Wr.assistantMessageContentFromJSON=I0n;Wr.assistantMessageToJSON=M0n;Wr.assistantMessageFromJSON=R0n;var _s=T0n(Ie()),f9t=Ke(),p9t=Ce(),fme=B3(),m9t=dme();Wr.AssistantMessageRole={Assistant:"assistant"};Wr.AssistantMessageContent$inboundSchema=_s.union([_s.string(),_s.array(fme.ContentChunk$inboundSchema)]);Wr.AssistantMessageContent$outboundSchema=_s.union([_s.string(),_s.array(fme.ContentChunk$outboundSchema)]);var l9t;(function(t){t.inboundSchema=Wr.AssistantMessageContent$inboundSchema,t.outboundSchema=Wr.AssistantMessageContent$outboundSchema})(l9t||(Wr.AssistantMessageContent$=l9t={}));function A0n(t){return JSON.stringify(Wr.AssistantMessageContent$outboundSchema.parse(t))}function I0n(t){return(0,p9t.safeParse)(t,e=>Wr.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}Wr.AssistantMessageRole$inboundSchema=_s.nativeEnum(Wr.AssistantMessageRole);Wr.AssistantMessageRole$outboundSchema=Wr.AssistantMessageRole$inboundSchema;var c9t;(function(t){t.inboundSchema=Wr.AssistantMessageRole$inboundSchema,t.outboundSchema=Wr.AssistantMessageRole$outboundSchema})(c9t||(Wr.AssistantMessageRole$=c9t={}));Wr.AssistantMessage$inboundSchema=_s.object({content:_s.nullable(_s.union([_s.string(),_s.array(fme.ContentChunk$inboundSchema)])).optional(),tool_calls:_s.nullable(_s.array(m9t.ToolCall$inboundSchema)).optional(),prefix:_s.boolean().default(!1),role:Wr.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,f9t.remap)(t,{tool_calls:"toolCalls"}));Wr.AssistantMessage$outboundSchema=_s.object({content:_s.nullable(_s.union([_s.string(),_s.array(fme.ContentChunk$outboundSchema)])).optional(),toolCalls:_s.nullable(_s.array(m9t.ToolCall$outboundSchema)).optional(),prefix:_s.boolean().default(!1),role:Wr.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,f9t.remap)(t,{toolCalls:"tool_calls"}));var d9t;(function(t){t.inboundSchema=Wr.AssistantMessage$inboundSchema,t.outboundSchema=Wr.AssistantMessage$outboundSchema})(d9t||(Wr.AssistantMessage$=d9t={}));function M0n(t){return JSON.stringify(Wr.AssistantMessage$outboundSchema.parse(t))}function R0n(t){return(0,p9t.safeParse)(t,e=>Wr.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var U3=x(Ho=>{"use strict";var N0n=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]}),j0n=Ho&&Ho.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D0n=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)&&N0n(e,t,r);return j0n(e,t),e};Object.defineProperty(Ho,"__esModule",{value:!0});Ho.Prediction$=Ho.Prediction$outboundSchema=Ho.Prediction$inboundSchema=Ho.PredictionType$=Ho.PredictionType$outboundSchema=Ho.PredictionType$inboundSchema=Ho.PredictionType=void 0;Ho.predictionToJSON=F0n;Ho.predictionFromJSON=k0n;var Ck=D0n(Ie()),L0n=Ce();Ho.PredictionType={Content:"content"};Ho.PredictionType$inboundSchema=Ck.nativeEnum(Ho.PredictionType);Ho.PredictionType$outboundSchema=Ho.PredictionType$inboundSchema;var h9t;(function(t){t.inboundSchema=Ho.PredictionType$inboundSchema,t.outboundSchema=Ho.PredictionType$outboundSchema})(h9t||(Ho.PredictionType$=h9t={}));Ho.Prediction$inboundSchema=Ck.object({type:Ck.literal("content").default("content"),content:Ck.string().default("")});Ho.Prediction$outboundSchema=Ck.object({type:Ck.literal("content").default("content"),content:Ck.string().default("")});var g9t;(function(t){t.inboundSchema=Ho.Prediction$inboundSchema,t.outboundSchema=Ho.Prediction$outboundSchema})(g9t||(Ho.Prediction$=g9t={}));function F0n(t){return JSON.stringify(Ho.Prediction$outboundSchema.parse(t))}function k0n(t){return(0,L0n.safeParse)(t,e=>Ho.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var K4e=x(Lu=>{"use strict";var $0n=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]}),B0n=Lu&&Lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z0n=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)&&$0n(e,t,r);return B0n(e,t),e};Object.defineProperty(Lu,"__esModule",{value:!0});Lu.JsonSchema$=Lu.JsonSchema$outboundSchema=Lu.JsonSchema$inboundSchema=void 0;Lu.jsonSchemaToJSON=q0n;Lu.jsonSchemaFromJSON=H0n;var lh=z0n(Ie()),b9t=Ke(),U0n=Ce();Lu.JsonSchema$inboundSchema=lh.object({name:lh.string(),description:lh.nullable(lh.string()).optional(),schema:lh.record(lh.any()),strict:lh.boolean().default(!1)}).transform(t=>(0,b9t.remap)(t,{schema:"schemaDefinition"}));Lu.JsonSchema$outboundSchema=lh.object({name:lh.string(),description:lh.nullable(lh.string()).optional(),schemaDefinition:lh.record(lh.any()),strict:lh.boolean().default(!1)}).transform(t=>(0,b9t.remap)(t,{schemaDefinition:"schema"}));var y9t;(function(t){t.inboundSchema=Lu.JsonSchema$inboundSchema,t.outboundSchema=Lu.JsonSchema$outboundSchema})(y9t||(Lu.JsonSchema$=y9t={}));function q0n(t){return JSON.stringify(Lu.JsonSchema$outboundSchema.parse(t))}function H0n(t){return(0,U0n.safeParse)(t,e=>Lu.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var G4e=x(Fu=>{"use strict";var V0n=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]}),W0n=Fu&&Fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K0n=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)&&V0n(e,t,r);return W0n(e,t),e};Object.defineProperty(Fu,"__esModule",{value:!0});Fu.ResponseFormats$=Fu.ResponseFormats$outboundSchema=Fu.ResponseFormats$inboundSchema=Fu.ResponseFormats=void 0;var G0n=K0n(Ie());Fu.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};Fu.ResponseFormats$inboundSchema=G0n.nativeEnum(Fu.ResponseFormats);Fu.ResponseFormats$outboundSchema=Fu.ResponseFormats$inboundSchema;var _9t;(function(t){t.inboundSchema=Fu.ResponseFormats$inboundSchema,t.outboundSchema=Fu.ResponseFormats$outboundSchema})(_9t||(Fu.ResponseFormats$=_9t={}))});var q3=x(ku=>{"use strict";var J0n=ku&&ku.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z0n=ku&&ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y0n=ku&&ku.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&J0n(e,t,r);return Z0n(e,t),e};Object.defineProperty(ku,"__esModule",{value:!0});ku.ResponseFormat$=ku.ResponseFormat$outboundSchema=ku.ResponseFormat$inboundSchema=void 0;ku.responseFormatToJSON=Q0n;ku.responseFormatFromJSON=exn;var pme=Y0n(Ie()),w9t=Ke(),X0n=Ce(),x9t=K4e(),S9t=G4e();ku.ResponseFormat$inboundSchema=pme.object({type:S9t.ResponseFormats$inboundSchema.optional(),json_schema:pme.nullable(x9t.JsonSchema$inboundSchema).optional()}).transform(t=>(0,w9t.remap)(t,{json_schema:"jsonSchema"}));ku.ResponseFormat$outboundSchema=pme.object({type:S9t.ResponseFormats$outboundSchema.optional(),jsonSchema:pme.nullable(x9t.JsonSchema$outboundSchema).optional()}).transform(t=>(0,w9t.remap)(t,{jsonSchema:"json_schema"}));var v9t;(function(t){t.inboundSchema=ku.ResponseFormat$inboundSchema,t.outboundSchema=ku.ResponseFormat$outboundSchema})(v9t||(ku.ResponseFormat$=v9t={}));function Q0n(t){return JSON.stringify(ku.ResponseFormat$outboundSchema.parse(t))}function exn(t){return(0,X0n.safeParse)(t,e=>ku.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var Ok=x(Kr=>{"use strict";var txn=Kr&&Kr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rxn=Kr&&Kr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nxn=Kr&&Kr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&txn(e,t,r);return rxn(e,t),e};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.SystemMessage$=Kr.SystemMessage$outboundSchema=Kr.SystemMessage$inboundSchema=Kr.Role$=Kr.Role$outboundSchema=Kr.Role$inboundSchema=Kr.SystemMessageContent$=Kr.SystemMessageContent$outboundSchema=Kr.SystemMessageContent$inboundSchema=Kr.Role=void 0;Kr.systemMessageContentToJSON=oxn;Kr.systemMessageContentFromJSON=ixn;Kr.systemMessageToJSON=axn;Kr.systemMessageFromJSON=sxn;var Kp=nxn(Ie()),P9t=Ce(),mme=cme();Kr.Role={System:"system"};Kr.SystemMessageContent$inboundSchema=Kp.union([Kp.string(),Kp.array(mme.TextChunk$inboundSchema)]);Kr.SystemMessageContent$outboundSchema=Kp.union([Kp.string(),Kp.array(mme.TextChunk$outboundSchema)]);var C9t;(function(t){t.inboundSchema=Kr.SystemMessageContent$inboundSchema,t.outboundSchema=Kr.SystemMessageContent$outboundSchema})(C9t||(Kr.SystemMessageContent$=C9t={}));function oxn(t){return JSON.stringify(Kr.SystemMessageContent$outboundSchema.parse(t))}function ixn(t){return(0,P9t.safeParse)(t,e=>Kr.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}Kr.Role$inboundSchema=Kp.nativeEnum(Kr.Role);Kr.Role$outboundSchema=Kr.Role$inboundSchema;var O9t;(function(t){t.inboundSchema=Kr.Role$inboundSchema,t.outboundSchema=Kr.Role$outboundSchema})(O9t||(Kr.Role$=O9t={}));Kr.SystemMessage$inboundSchema=Kp.object({content:Kp.union([Kp.string(),Kp.array(mme.TextChunk$inboundSchema)]),role:Kr.Role$inboundSchema.default("system")});Kr.SystemMessage$outboundSchema=Kp.object({content:Kp.union([Kp.string(),Kp.array(mme.TextChunk$outboundSchema)]),role:Kr.Role$outboundSchema.default("system")});var E9t;(function(t){t.inboundSchema=Kr.SystemMessage$inboundSchema,t.outboundSchema=Kr.SystemMessage$outboundSchema})(E9t||(Kr.SystemMessage$=E9t={}));function axn(t){return JSON.stringify(Kr.SystemMessage$outboundSchema.parse(t))}function sxn(t){return(0,P9t.safeParse)(t,e=>Kr.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var J4e=x($u=>{"use strict";var uxn=$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]}),lxn=$u&&$u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cxn=$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)&&uxn(e,t,r);return lxn(e,t),e};Object.defineProperty($u,"__esModule",{value:!0});$u.FunctionT$=$u.FunctionT$outboundSchema=$u.FunctionT$inboundSchema=void 0;$u.functionToJSON=fxn;$u.functionFromJSON=pxn;var By=cxn(Ie()),dxn=Ce();$u.FunctionT$inboundSchema=By.object({name:By.string(),description:By.string().default(""),strict:By.boolean().default(!1),parameters:By.record(By.any())});$u.FunctionT$outboundSchema=By.object({name:By.string(),description:By.string().default(""),strict:By.boolean().default(!1),parameters:By.record(By.any())});var T9t;(function(t){t.inboundSchema=$u.FunctionT$inboundSchema,t.outboundSchema=$u.FunctionT$outboundSchema})(T9t||($u.FunctionT$=T9t={}));function fxn(t){return JSON.stringify($u.FunctionT$outboundSchema.parse(t))}function pxn(t){return(0,dxn.safeParse)(t,e=>$u.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var H3=x(Bu=>{"use strict";var mxn=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]}),hxn=Bu&&Bu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gxn=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)&&mxn(e,t,r);return hxn(e,t),e};Object.defineProperty(Bu,"__esModule",{value:!0});Bu.Tool$=Bu.Tool$outboundSchema=Bu.Tool$inboundSchema=void 0;Bu.toolToJSON=bxn;Bu.toolFromJSON=_xn;var I9t=gxn(Ie()),yxn=Ce(),M9t=J4e(),R9t=AJ();Bu.Tool$inboundSchema=I9t.object({type:R9t.ToolTypes$inboundSchema.optional(),function:M9t.FunctionT$inboundSchema});Bu.Tool$outboundSchema=I9t.object({type:R9t.ToolTypes$outboundSchema.optional(),function:M9t.FunctionT$outboundSchema});var A9t;(function(t){t.inboundSchema=Bu.Tool$inboundSchema,t.outboundSchema=Bu.Tool$outboundSchema})(A9t||(Bu.Tool$=A9t={}));function bxn(t){return JSON.stringify(Bu.Tool$outboundSchema.parse(t))}function _xn(t){return(0,yxn.safeParse)(t,e=>Bu.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var Z4e=x(zu=>{"use strict";var vxn=zu&&zu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wxn=zu&&zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xxn=zu&&zu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vxn(e,t,r);return wxn(e,t),e};Object.defineProperty(zu,"__esModule",{value:!0});zu.FunctionName$=zu.FunctionName$outboundSchema=zu.FunctionName$inboundSchema=void 0;zu.functionNameToJSON=Cxn;zu.functionNameFromJSON=Oxn;var hme=xxn(Ie()),Sxn=Ce();zu.FunctionName$inboundSchema=hme.object({name:hme.string()});zu.FunctionName$outboundSchema=hme.object({name:hme.string()});var N9t;(function(t){t.inboundSchema=zu.FunctionName$inboundSchema,t.outboundSchema=zu.FunctionName$outboundSchema})(N9t||(zu.FunctionName$=N9t={}));function Cxn(t){return JSON.stringify(zu.FunctionName$outboundSchema.parse(t))}function Oxn(t){return(0,Sxn.safeParse)(t,e=>zu.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var V3=x(Uu=>{"use strict";var Exn=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]}),Pxn=Uu&&Uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Txn=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)&&Exn(e,t,r);return Pxn(e,t),e};Object.defineProperty(Uu,"__esModule",{value:!0});Uu.ToolChoice$=Uu.ToolChoice$outboundSchema=Uu.ToolChoice$inboundSchema=void 0;Uu.toolChoiceToJSON=Ixn;Uu.toolChoiceFromJSON=Mxn;var D9t=Txn(Ie()),Axn=Ce(),L9t=Z4e(),F9t=AJ();Uu.ToolChoice$inboundSchema=D9t.object({type:F9t.ToolTypes$inboundSchema.optional(),function:L9t.FunctionName$inboundSchema});Uu.ToolChoice$outboundSchema=D9t.object({type:F9t.ToolTypes$outboundSchema.optional(),function:L9t.FunctionName$outboundSchema});var j9t;(function(t){t.inboundSchema=Uu.ToolChoice$inboundSchema,t.outboundSchema=Uu.ToolChoice$outboundSchema})(j9t||(Uu.ToolChoice$=j9t={}));function Ixn(t){return JSON.stringify(Uu.ToolChoice$outboundSchema.parse(t))}function Mxn(t){return(0,Axn.safeParse)(t,e=>Uu.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var W3=x(qu=>{"use strict";var Rxn=qu&&qu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Nxn=qu&&qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jxn=qu&&qu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rxn(e,t,r);return Nxn(e,t),e};Object.defineProperty(qu,"__esModule",{value:!0});qu.ToolChoiceEnum$=qu.ToolChoiceEnum$outboundSchema=qu.ToolChoiceEnum$inboundSchema=qu.ToolChoiceEnum=void 0;var Dxn=jxn(Ie());qu.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};qu.ToolChoiceEnum$inboundSchema=Dxn.nativeEnum(qu.ToolChoiceEnum);qu.ToolChoiceEnum$outboundSchema=qu.ToolChoiceEnum$inboundSchema;var k9t;(function(t){t.inboundSchema=qu.ToolChoiceEnum$inboundSchema,t.outboundSchema=qu.ToolChoiceEnum$outboundSchema})(k9t||(qu.ToolChoiceEnum$=k9t={}))});var Ek=x(Gr=>{"use strict";var Lxn=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]}),Fxn=Gr&&Gr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kxn=Gr&&Gr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lxn(e,t,r);return Fxn(e,t),e};Object.defineProperty(Gr,"__esModule",{value:!0});Gr.ToolMessage$=Gr.ToolMessage$outboundSchema=Gr.ToolMessage$inboundSchema=Gr.ToolMessageRole$=Gr.ToolMessageRole$outboundSchema=Gr.ToolMessageRole$inboundSchema=Gr.ToolMessageContent$=Gr.ToolMessageContent$outboundSchema=Gr.ToolMessageContent$inboundSchema=Gr.ToolMessageRole=void 0;Gr.toolMessageContentToJSON=$xn;Gr.toolMessageContentFromJSON=Bxn;Gr.toolMessageToJSON=zxn;Gr.toolMessageFromJSON=Uxn;var Ma=kxn(Ie()),U9t=Ke(),q9t=Ce(),gme=B3();Gr.ToolMessageRole={Tool:"tool"};Gr.ToolMessageContent$inboundSchema=Ma.union([Ma.string(),Ma.array(gme.ContentChunk$inboundSchema)]);Gr.ToolMessageContent$outboundSchema=Ma.union([Ma.string(),Ma.array(gme.ContentChunk$outboundSchema)]);var $9t;(function(t){t.inboundSchema=Gr.ToolMessageContent$inboundSchema,t.outboundSchema=Gr.ToolMessageContent$outboundSchema})($9t||(Gr.ToolMessageContent$=$9t={}));function $xn(t){return JSON.stringify(Gr.ToolMessageContent$outboundSchema.parse(t))}function Bxn(t){return(0,q9t.safeParse)(t,e=>Gr.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}Gr.ToolMessageRole$inboundSchema=Ma.nativeEnum(Gr.ToolMessageRole);Gr.ToolMessageRole$outboundSchema=Gr.ToolMessageRole$inboundSchema;var B9t;(function(t){t.inboundSchema=Gr.ToolMessageRole$inboundSchema,t.outboundSchema=Gr.ToolMessageRole$outboundSchema})(B9t||(Gr.ToolMessageRole$=B9t={}));Gr.ToolMessage$inboundSchema=Ma.object({content:Ma.nullable(Ma.union([Ma.string(),Ma.array(gme.ContentChunk$inboundSchema)])),tool_call_id:Ma.nullable(Ma.string()).optional(),name:Ma.nullable(Ma.string()).optional(),role:Gr.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,U9t.remap)(t,{tool_call_id:"toolCallId"}));Gr.ToolMessage$outboundSchema=Ma.object({content:Ma.nullable(Ma.union([Ma.string(),Ma.array(gme.ContentChunk$outboundSchema)])),toolCallId:Ma.nullable(Ma.string()).optional(),name:Ma.nullable(Ma.string()).optional(),role:Gr.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,U9t.remap)(t,{toolCallId:"tool_call_id"}));var z9t;(function(t){t.inboundSchema=Gr.ToolMessage$inboundSchema,t.outboundSchema=Gr.ToolMessage$outboundSchema})(z9t||(Gr.ToolMessage$=z9t={}));function zxn(t){return JSON.stringify(Gr.ToolMessage$outboundSchema.parse(t))}function Uxn(t){return(0,q9t.safeParse)(t,e=>Gr.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var Pk=x(Jr=>{"use strict";var qxn=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]}),Hxn=Jr&&Jr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vxn=Jr&&Jr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qxn(e,t,r);return Hxn(e,t),e};Object.defineProperty(Jr,"__esModule",{value:!0});Jr.UserMessage$=Jr.UserMessage$outboundSchema=Jr.UserMessage$inboundSchema=Jr.UserMessageRole$=Jr.UserMessageRole$outboundSchema=Jr.UserMessageRole$inboundSchema=Jr.UserMessageContent$=Jr.UserMessageContent$outboundSchema=Jr.UserMessageContent$inboundSchema=Jr.UserMessageRole=void 0;Jr.userMessageContentToJSON=Wxn;Jr.userMessageContentFromJSON=Kxn;Jr.userMessageToJSON=Gxn;Jr.userMessageFromJSON=Jxn;var Jd=Vxn(Ie()),K9t=Ce(),yme=B3();Jr.UserMessageRole={User:"user"};Jr.UserMessageContent$inboundSchema=Jd.union([Jd.string(),Jd.array(yme.ContentChunk$inboundSchema)]);Jr.UserMessageContent$outboundSchema=Jd.union([Jd.string(),Jd.array(yme.ContentChunk$outboundSchema)]);var H9t;(function(t){t.inboundSchema=Jr.UserMessageContent$inboundSchema,t.outboundSchema=Jr.UserMessageContent$outboundSchema})(H9t||(Jr.UserMessageContent$=H9t={}));function Wxn(t){return JSON.stringify(Jr.UserMessageContent$outboundSchema.parse(t))}function Kxn(t){return(0,K9t.safeParse)(t,e=>Jr.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}Jr.UserMessageRole$inboundSchema=Jd.nativeEnum(Jr.UserMessageRole);Jr.UserMessageRole$outboundSchema=Jr.UserMessageRole$inboundSchema;var V9t;(function(t){t.inboundSchema=Jr.UserMessageRole$inboundSchema,t.outboundSchema=Jr.UserMessageRole$outboundSchema})(V9t||(Jr.UserMessageRole$=V9t={}));Jr.UserMessage$inboundSchema=Jd.object({content:Jd.nullable(Jd.union([Jd.string(),Jd.array(yme.ContentChunk$inboundSchema)])),role:Jr.UserMessageRole$inboundSchema.default("user")});Jr.UserMessage$outboundSchema=Jd.object({content:Jd.nullable(Jd.union([Jd.string(),Jd.array(yme.ContentChunk$outboundSchema)])),role:Jr.UserMessageRole$outboundSchema.default("user")});var W9t;(function(t){t.inboundSchema=Jr.UserMessage$inboundSchema,t.outboundSchema=Jr.UserMessage$outboundSchema})(W9t||(Jr.UserMessage$=W9t={}));function Gxn(t){return JSON.stringify(Jr.UserMessage$outboundSchema.parse(t))}function Jxn(t){return(0,K9t.safeParse)(t,e=>Jr.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var rKt=x(ir=>{"use strict";var Zxn=ir&&ir.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yxn=ir&&ir.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xxn=ir&&ir.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Zxn(e,t,r);return Yxn(e,t),e};Object.defineProperty(ir,"__esModule",{value:!0});ir.AgentsCompletionRequest$=ir.AgentsCompletionRequest$outboundSchema=ir.AgentsCompletionRequest$inboundSchema=ir.AgentsCompletionRequestToolChoice$=ir.AgentsCompletionRequestToolChoice$outboundSchema=ir.AgentsCompletionRequestToolChoice$inboundSchema=ir.AgentsCompletionRequestMessages$=ir.AgentsCompletionRequestMessages$outboundSchema=ir.AgentsCompletionRequestMessages$inboundSchema=ir.AgentsCompletionRequestStop$=ir.AgentsCompletionRequestStop$outboundSchema=ir.AgentsCompletionRequestStop$inboundSchema=void 0;ir.agentsCompletionRequestStopToJSON=Qxn;ir.agentsCompletionRequestStopFromJSON=eSn;ir.agentsCompletionRequestMessagesToJSON=tSn;ir.agentsCompletionRequestMessagesFromJSON=rSn;ir.agentsCompletionRequestToolChoiceToJSON=nSn;ir.agentsCompletionRequestToolChoiceFromJSON=oSn;ir.agentsCompletionRequestToJSON=iSn;ir.agentsCompletionRequestFromJSON=aSn;var rt=Xxn(Ie()),X9t=Ke(),bme=Ce(),_me=e1(),Q9t=U3(),eKt=q3(),vme=Ok(),tKt=H3(),wme=V3(),xme=W3(),Sme=Ek(),Cme=Pk();ir.AgentsCompletionRequestStop$inboundSchema=rt.union([rt.string(),rt.array(rt.string())]);ir.AgentsCompletionRequestStop$outboundSchema=rt.union([rt.string(),rt.array(rt.string())]);var G9t;(function(t){t.inboundSchema=ir.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=ir.AgentsCompletionRequestStop$outboundSchema})(G9t||(ir.AgentsCompletionRequestStop$=G9t={}));function Qxn(t){return JSON.stringify(ir.AgentsCompletionRequestStop$outboundSchema.parse(t))}function eSn(t){return(0,bme.safeParse)(t,e=>ir.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}ir.AgentsCompletionRequestMessages$inboundSchema=rt.union([vme.SystemMessage$inboundSchema.and(rt.object({role:rt.literal("system")}).transform(t=>({role:t.role}))),Cme.UserMessage$inboundSchema.and(rt.object({role:rt.literal("user")}).transform(t=>({role:t.role}))),_me.AssistantMessage$inboundSchema.and(rt.object({role:rt.literal("assistant")}).transform(t=>({role:t.role}))),Sme.ToolMessage$inboundSchema.and(rt.object({role:rt.literal("tool")}).transform(t=>({role:t.role})))]);ir.AgentsCompletionRequestMessages$outboundSchema=rt.union([vme.SystemMessage$outboundSchema.and(rt.object({role:rt.literal("system")}).transform(t=>({role:t.role}))),Cme.UserMessage$outboundSchema.and(rt.object({role:rt.literal("user")}).transform(t=>({role:t.role}))),_me.AssistantMessage$outboundSchema.and(rt.object({role:rt.literal("assistant")}).transform(t=>({role:t.role}))),Sme.ToolMessage$outboundSchema.and(rt.object({role:rt.literal("tool")}).transform(t=>({role:t.role})))]);var J9t;(function(t){t.inboundSchema=ir.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=ir.AgentsCompletionRequestMessages$outboundSchema})(J9t||(ir.AgentsCompletionRequestMessages$=J9t={}));function tSn(t){return JSON.stringify(ir.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function rSn(t){return(0,bme.safeParse)(t,e=>ir.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}ir.AgentsCompletionRequestToolChoice$inboundSchema=rt.union([wme.ToolChoice$inboundSchema,xme.ToolChoiceEnum$inboundSchema]);ir.AgentsCompletionRequestToolChoice$outboundSchema=rt.union([wme.ToolChoice$outboundSchema,xme.ToolChoiceEnum$outboundSchema]);var Z9t;(function(t){t.inboundSchema=ir.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=ir.AgentsCompletionRequestToolChoice$outboundSchema})(Z9t||(ir.AgentsCompletionRequestToolChoice$=Z9t={}));function nSn(t){return JSON.stringify(ir.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function oSn(t){return(0,bme.safeParse)(t,e=>ir.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}ir.AgentsCompletionRequest$inboundSchema=rt.object({max_tokens:rt.nullable(rt.number().int()).optional(),stream:rt.boolean().default(!1),stop:rt.union([rt.string(),rt.array(rt.string())]).optional(),random_seed:rt.nullable(rt.number().int()).optional(),messages:rt.array(rt.union([vme.SystemMessage$inboundSchema.and(rt.object({role:rt.literal("system")}).transform(t=>({role:t.role}))),Cme.UserMessage$inboundSchema.and(rt.object({role:rt.literal("user")}).transform(t=>({role:t.role}))),_me.AssistantMessage$inboundSchema.and(rt.object({role:rt.literal("assistant")}).transform(t=>({role:t.role}))),Sme.ToolMessage$inboundSchema.and(rt.object({role:rt.literal("tool")}).transform(t=>({role:t.role})))])),response_format:eKt.ResponseFormat$inboundSchema.optional(),tools:rt.nullable(rt.array(tKt.Tool$inboundSchema)).optional(),tool_choice:rt.union([wme.ToolChoice$inboundSchema,xme.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:rt.number().optional(),frequency_penalty:rt.number().optional(),n:rt.nullable(rt.number().int()).optional(),prediction:Q9t.Prediction$inboundSchema.optional(),agent_id:rt.string()}).transform(t=>(0,X9t.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));ir.AgentsCompletionRequest$outboundSchema=rt.object({maxTokens:rt.nullable(rt.number().int()).optional(),stream:rt.boolean().default(!1),stop:rt.union([rt.string(),rt.array(rt.string())]).optional(),randomSeed:rt.nullable(rt.number().int()).optional(),messages:rt.array(rt.union([vme.SystemMessage$outboundSchema.and(rt.object({role:rt.literal("system")}).transform(t=>({role:t.role}))),Cme.UserMessage$outboundSchema.and(rt.object({role:rt.literal("user")}).transform(t=>({role:t.role}))),_me.AssistantMessage$outboundSchema.and(rt.object({role:rt.literal("assistant")}).transform(t=>({role:t.role}))),Sme.ToolMessage$outboundSchema.and(rt.object({role:rt.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:eKt.ResponseFormat$outboundSchema.optional(),tools:rt.nullable(rt.array(tKt.Tool$outboundSchema)).optional(),toolChoice:rt.union([wme.ToolChoice$outboundSchema,xme.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:rt.number().optional(),frequencyPenalty:rt.number().optional(),n:rt.nullable(rt.number().int()).optional(),prediction:Q9t.Prediction$outboundSchema.optional(),agentId:rt.string()}).transform(t=>(0,X9t.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var Y9t;(function(t){t.inboundSchema=ir.AgentsCompletionRequest$inboundSchema,t.outboundSchema=ir.AgentsCompletionRequest$outboundSchema})(Y9t||(ir.AgentsCompletionRequest$=Y9t={}));function iSn(t){return JSON.stringify(ir.AgentsCompletionRequest$outboundSchema.parse(t))}function aSn(t){return(0,bme.safeParse)(t,e=>ir.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var dKt=x(ar=>{"use strict";var sSn=ar&&ar.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uSn=ar&&ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lSn=ar&&ar.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sSn(e,t,r);return uSn(e,t),e};Object.defineProperty(ar,"__esModule",{value:!0});ar.AgentsCompletionStreamRequest$=ar.AgentsCompletionStreamRequest$outboundSchema=ar.AgentsCompletionStreamRequest$inboundSchema=ar.AgentsCompletionStreamRequestToolChoice$=ar.AgentsCompletionStreamRequestToolChoice$outboundSchema=ar.AgentsCompletionStreamRequestToolChoice$inboundSchema=ar.AgentsCompletionStreamRequestMessages$=ar.AgentsCompletionStreamRequestMessages$outboundSchema=ar.AgentsCompletionStreamRequestMessages$inboundSchema=ar.AgentsCompletionStreamRequestStop$=ar.AgentsCompletionStreamRequestStop$outboundSchema=ar.AgentsCompletionStreamRequestStop$inboundSchema=void 0;ar.agentsCompletionStreamRequestStopToJSON=cSn;ar.agentsCompletionStreamRequestStopFromJSON=dSn;ar.agentsCompletionStreamRequestMessagesToJSON=fSn;ar.agentsCompletionStreamRequestMessagesFromJSON=pSn;ar.agentsCompletionStreamRequestToolChoiceToJSON=mSn;ar.agentsCompletionStreamRequestToolChoiceFromJSON=hSn;ar.agentsCompletionStreamRequestToJSON=gSn;ar.agentsCompletionStreamRequestFromJSON=ySn;var nt=lSn(Ie()),sKt=Ke(),Ome=Ce(),Eme=e1(),uKt=U3(),lKt=q3(),Pme=Ok(),cKt=H3(),Tme=V3(),Ame=W3(),Ime=Ek(),Mme=Pk();ar.AgentsCompletionStreamRequestStop$inboundSchema=nt.union([nt.string(),nt.array(nt.string())]);ar.AgentsCompletionStreamRequestStop$outboundSchema=nt.union([nt.string(),nt.array(nt.string())]);var nKt;(function(t){t.inboundSchema=ar.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=ar.AgentsCompletionStreamRequestStop$outboundSchema})(nKt||(ar.AgentsCompletionStreamRequestStop$=nKt={}));function cSn(t){return JSON.stringify(ar.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function dSn(t){return(0,Ome.safeParse)(t,e=>ar.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}ar.AgentsCompletionStreamRequestMessages$inboundSchema=nt.union([Pme.SystemMessage$inboundSchema.and(nt.object({role:nt.literal("system")}).transform(t=>({role:t.role}))),Mme.UserMessage$inboundSchema.and(nt.object({role:nt.literal("user")}).transform(t=>({role:t.role}))),Eme.AssistantMessage$inboundSchema.and(nt.object({role:nt.literal("assistant")}).transform(t=>({role:t.role}))),Ime.ToolMessage$inboundSchema.and(nt.object({role:nt.literal("tool")}).transform(t=>({role:t.role})))]);ar.AgentsCompletionStreamRequestMessages$outboundSchema=nt.union([Pme.SystemMessage$outboundSchema.and(nt.object({role:nt.literal("system")}).transform(t=>({role:t.role}))),Mme.UserMessage$outboundSchema.and(nt.object({role:nt.literal("user")}).transform(t=>({role:t.role}))),Eme.AssistantMessage$outboundSchema.and(nt.object({role:nt.literal("assistant")}).transform(t=>({role:t.role}))),Ime.ToolMessage$outboundSchema.and(nt.object({role:nt.literal("tool")}).transform(t=>({role:t.role})))]);var oKt;(function(t){t.inboundSchema=ar.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=ar.AgentsCompletionStreamRequestMessages$outboundSchema})(oKt||(ar.AgentsCompletionStreamRequestMessages$=oKt={}));function fSn(t){return JSON.stringify(ar.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function pSn(t){return(0,Ome.safeParse)(t,e=>ar.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}ar.AgentsCompletionStreamRequestToolChoice$inboundSchema=nt.union([Tme.ToolChoice$inboundSchema,Ame.ToolChoiceEnum$inboundSchema]);ar.AgentsCompletionStreamRequestToolChoice$outboundSchema=nt.union([Tme.ToolChoice$outboundSchema,Ame.ToolChoiceEnum$outboundSchema]);var iKt;(function(t){t.inboundSchema=ar.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=ar.AgentsCompletionStreamRequestToolChoice$outboundSchema})(iKt||(ar.AgentsCompletionStreamRequestToolChoice$=iKt={}));function mSn(t){return JSON.stringify(ar.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function hSn(t){return(0,Ome.safeParse)(t,e=>ar.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}ar.AgentsCompletionStreamRequest$inboundSchema=nt.object({max_tokens:nt.nullable(nt.number().int()).optional(),stream:nt.boolean().default(!0),stop:nt.union([nt.string(),nt.array(nt.string())]).optional(),random_seed:nt.nullable(nt.number().int()).optional(),messages:nt.array(nt.union([Pme.SystemMessage$inboundSchema.and(nt.object({role:nt.literal("system")}).transform(t=>({role:t.role}))),Mme.UserMessage$inboundSchema.and(nt.object({role:nt.literal("user")}).transform(t=>({role:t.role}))),Eme.AssistantMessage$inboundSchema.and(nt.object({role:nt.literal("assistant")}).transform(t=>({role:t.role}))),Ime.ToolMessage$inboundSchema.and(nt.object({role:nt.literal("tool")}).transform(t=>({role:t.role})))])),response_format:lKt.ResponseFormat$inboundSchema.optional(),tools:nt.nullable(nt.array(cKt.Tool$inboundSchema)).optional(),tool_choice:nt.union([Tme.ToolChoice$inboundSchema,Ame.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:nt.number().optional(),frequency_penalty:nt.number().optional(),n:nt.nullable(nt.number().int()).optional(),prediction:uKt.Prediction$inboundSchema.optional(),agent_id:nt.string()}).transform(t=>(0,sKt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));ar.AgentsCompletionStreamRequest$outboundSchema=nt.object({maxTokens:nt.nullable(nt.number().int()).optional(),stream:nt.boolean().default(!0),stop:nt.union([nt.string(),nt.array(nt.string())]).optional(),randomSeed:nt.nullable(nt.number().int()).optional(),messages:nt.array(nt.union([Pme.SystemMessage$outboundSchema.and(nt.object({role:nt.literal("system")}).transform(t=>({role:t.role}))),Mme.UserMessage$outboundSchema.and(nt.object({role:nt.literal("user")}).transform(t=>({role:t.role}))),Eme.AssistantMessage$outboundSchema.and(nt.object({role:nt.literal("assistant")}).transform(t=>({role:t.role}))),Ime.ToolMessage$outboundSchema.and(nt.object({role:nt.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:lKt.ResponseFormat$outboundSchema.optional(),tools:nt.nullable(nt.array(cKt.Tool$outboundSchema)).optional(),toolChoice:nt.union([Tme.ToolChoice$outboundSchema,Ame.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:nt.number().optional(),frequencyPenalty:nt.number().optional(),n:nt.nullable(nt.number().int()).optional(),prediction:uKt.Prediction$outboundSchema.optional(),agentId:nt.string()}).transform(t=>(0,sKt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var aKt;(function(t){t.inboundSchema=ar.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=ar.AgentsCompletionStreamRequest$outboundSchema})(aKt||(ar.AgentsCompletionStreamRequest$=aKt={}));function gSn(t){return JSON.stringify(ar.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function ySn(t){return(0,Ome.safeParse)(t,e=>ar.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var Y4e=x(Hu=>{"use strict";var bSn=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]}),_Sn=Hu&&Hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vSn=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)&&bSn(e,t,r);return _Sn(e,t),e};Object.defineProperty(Hu,"__esModule",{value:!0});Hu.ApiEndpoint$=Hu.ApiEndpoint$outboundSchema=Hu.ApiEndpoint$inboundSchema=Hu.ApiEndpoint=void 0;var Tk=vSn(Ie()),wSn=QR();Hu.ApiEndpoint={RootV1ChatCompletions:"/v1/chat/completions",RootV1Embeddings:"/v1/embeddings",RootV1FimCompletions:"/v1/fim/completions",RootV1Moderations:"/v1/moderations",RootV1ChatModerations:"/v1/chat/moderations"};Hu.ApiEndpoint$inboundSchema=Tk.union([Tk.nativeEnum(Hu.ApiEndpoint),Tk.string().transform(wSn.catchUnrecognizedEnum)]);Hu.ApiEndpoint$outboundSchema=Tk.union([Tk.nativeEnum(Hu.ApiEndpoint),Tk.string().and(Tk.custom())]);var fKt;(function(t){t.inboundSchema=Hu.ApiEndpoint$inboundSchema,t.outboundSchema=Hu.ApiEndpoint$outboundSchema})(fKt||(Hu.ApiEndpoint$=fKt={}))});var hKt=x(Vo=>{"use strict";var xSn=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]}),SSn=Vo&&Vo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CSn=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)&&xSn(e,t,r);return SSn(e,t),e};Object.defineProperty(Vo,"__esModule",{value:!0});Vo.ArchiveFTModelOut$=Vo.ArchiveFTModelOut$outboundSchema=Vo.ArchiveFTModelOut$inboundSchema=Vo.ArchiveFTModelOutObject$=Vo.ArchiveFTModelOutObject$outboundSchema=Vo.ArchiveFTModelOutObject$inboundSchema=Vo.ArchiveFTModelOutObject=void 0;Vo.archiveFTModelOutToJSON=ESn;Vo.archiveFTModelOutFromJSON=PSn;var cT=CSn(Ie()),OSn=Ce();Vo.ArchiveFTModelOutObject={Model:"model"};Vo.ArchiveFTModelOutObject$inboundSchema=cT.nativeEnum(Vo.ArchiveFTModelOutObject);Vo.ArchiveFTModelOutObject$outboundSchema=Vo.ArchiveFTModelOutObject$inboundSchema;var pKt;(function(t){t.inboundSchema=Vo.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=Vo.ArchiveFTModelOutObject$outboundSchema})(pKt||(Vo.ArchiveFTModelOutObject$=pKt={}));Vo.ArchiveFTModelOut$inboundSchema=cT.object({id:cT.string(),object:cT.literal("model").default("model"),archived:cT.boolean().default(!0)});Vo.ArchiveFTModelOut$outboundSchema=cT.object({id:cT.string(),object:cT.literal("model").default("model"),archived:cT.boolean().default(!0)});var mKt;(function(t){t.inboundSchema=Vo.ArchiveFTModelOut$inboundSchema,t.outboundSchema=Vo.ArchiveFTModelOut$outboundSchema})(mKt||(Vo.ArchiveFTModelOut$=mKt={}));function ESn(t){return JSON.stringify(Vo.ArchiveFTModelOut$outboundSchema.parse(t))}function PSn(t){return(0,OSn.safeParse)(t,e=>Vo.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var Rme=x(Vu=>{"use strict";var TSn=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]}),ASn=Vu&&Vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ISn=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)&&TSn(e,t,r);return ASn(e,t),e};Object.defineProperty(Vu,"__esModule",{value:!0});Vu.ModelCapabilities$=Vu.ModelCapabilities$outboundSchema=Vu.ModelCapabilities$inboundSchema=void 0;Vu.modelCapabilitiesToJSON=RSn;Vu.modelCapabilitiesFromJSON=NSn;var zy=ISn(Ie()),yKt=Ke(),MSn=Ce();Vu.ModelCapabilities$inboundSchema=zy.object({completion_chat:zy.boolean().default(!0),completion_fim:zy.boolean().default(!1),function_calling:zy.boolean().default(!0),fine_tuning:zy.boolean().default(!1),vision:zy.boolean().default(!1)}).transform(t=>(0,yKt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));Vu.ModelCapabilities$outboundSchema=zy.object({completionChat:zy.boolean().default(!0),completionFim:zy.boolean().default(!1),functionCalling:zy.boolean().default(!0),fineTuning:zy.boolean().default(!1),vision:zy.boolean().default(!1)}).transform(t=>(0,yKt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var gKt;(function(t){t.inboundSchema=Vu.ModelCapabilities$inboundSchema,t.outboundSchema=Vu.ModelCapabilities$outboundSchema})(gKt||(Vu.ModelCapabilities$=gKt={}));function RSn(t){return JSON.stringify(Vu.ModelCapabilities$outboundSchema.parse(t))}function NSn(t){return(0,MSn.safeParse)(t,e=>Vu.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var X4e=x(Wo=>{"use strict";var jSn=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]}),DSn=Wo&&Wo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LSn=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)&&jSn(e,t,r);return DSn(e,t),e};Object.defineProperty(Wo,"__esModule",{value:!0});Wo.BaseModelCard$=Wo.BaseModelCard$outboundSchema=Wo.BaseModelCard$inboundSchema=Wo.Type$=Wo.Type$outboundSchema=Wo.Type$inboundSchema=Wo.Type=void 0;Wo.baseModelCardToJSON=kSn;Wo.baseModelCardFromJSON=$Sn;var ho=LSn(Ie()),vKt=Ke(),FSn=Ce(),wKt=Rme();Wo.Type={Base:"base"};Wo.Type$inboundSchema=ho.nativeEnum(Wo.Type);Wo.Type$outboundSchema=Wo.Type$inboundSchema;var bKt;(function(t){t.inboundSchema=Wo.Type$inboundSchema,t.outboundSchema=Wo.Type$outboundSchema})(bKt||(Wo.Type$=bKt={}));Wo.BaseModelCard$inboundSchema=ho.object({id:ho.string(),object:ho.string().default("model"),created:ho.number().int().optional(),owned_by:ho.string().default("mistralai"),capabilities:wKt.ModelCapabilities$inboundSchema,name:ho.nullable(ho.string()).optional(),description:ho.nullable(ho.string()).optional(),max_context_length:ho.number().int().default(32768),aliases:ho.array(ho.string()).optional(),deprecation:ho.nullable(ho.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:ho.nullable(ho.number()).optional(),type:ho.literal("base").default("base")}).transform(t=>(0,vKt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Wo.BaseModelCard$outboundSchema=ho.object({id:ho.string(),object:ho.string().default("model"),created:ho.number().int().optional(),ownedBy:ho.string().default("mistralai"),capabilities:wKt.ModelCapabilities$outboundSchema,name:ho.nullable(ho.string()).optional(),description:ho.nullable(ho.string()).optional(),maxContextLength:ho.number().int().default(32768),aliases:ho.array(ho.string()).optional(),deprecation:ho.nullable(ho.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:ho.nullable(ho.number()).optional(),type:ho.literal("base").default("base")}).transform(t=>(0,vKt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var _Kt;(function(t){t.inboundSchema=Wo.BaseModelCard$inboundSchema,t.outboundSchema=Wo.BaseModelCard$outboundSchema})(_Kt||(Wo.BaseModelCard$=_Kt={}));function kSn(t){return JSON.stringify(Wo.BaseModelCard$outboundSchema.parse(t))}function $Sn(t){return(0,FSn.safeParse)(t,e=>Wo.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var Q4e=x(Wu=>{"use strict";var BSn=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]}),zSn=Wu&&Wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),USn=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)&&BSn(e,t,r);return zSn(e,t),e};Object.defineProperty(Wu,"__esModule",{value:!0});Wu.BatchError$=Wu.BatchError$outboundSchema=Wu.BatchError$inboundSchema=void 0;Wu.batchErrorToJSON=HSn;Wu.batchErrorFromJSON=VSn;var K3=USn(Ie()),qSn=Ce();Wu.BatchError$inboundSchema=K3.object({message:K3.string(),count:K3.number().int().default(1)});Wu.BatchError$outboundSchema=K3.object({message:K3.string(),count:K3.number().int().default(1)});var xKt;(function(t){t.inboundSchema=Wu.BatchError$inboundSchema,t.outboundSchema=Wu.BatchError$outboundSchema})(xKt||(Wu.BatchError$=xKt={}));function HSn(t){return JSON.stringify(Wu.BatchError$outboundSchema.parse(t))}function VSn(t){return(0,qSn.safeParse)(t,e=>Wu.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var EKt=x(Ku=>{"use strict";var WSn=Ku&&Ku.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KSn=Ku&&Ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GSn=Ku&&Ku.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WSn(e,t,r);return KSn(e,t),e};Object.defineProperty(Ku,"__esModule",{value:!0});Ku.BatchJobIn$=Ku.BatchJobIn$outboundSchema=Ku.BatchJobIn$inboundSchema=void 0;Ku.batchJobInToJSON=ZSn;Ku.batchJobInFromJSON=YSn;var rp=GSn(Ie()),CKt=Ke(),JSn=Ce(),OKt=Y4e();Ku.BatchJobIn$inboundSchema=rp.object({input_files:rp.array(rp.string()),endpoint:OKt.ApiEndpoint$inboundSchema,model:rp.string(),metadata:rp.nullable(rp.record(rp.string())).optional(),timeout_hours:rp.number().int().default(24)}).transform(t=>(0,CKt.remap)(t,{input_files:"inputFiles",timeout_hours:"timeoutHours"}));Ku.BatchJobIn$outboundSchema=rp.object({inputFiles:rp.array(rp.string()),endpoint:OKt.ApiEndpoint$outboundSchema,model:rp.string(),metadata:rp.nullable(rp.record(rp.string())).optional(),timeoutHours:rp.number().int().default(24)}).transform(t=>(0,CKt.remap)(t,{inputFiles:"input_files",timeoutHours:"timeout_hours"}));var SKt;(function(t){t.inboundSchema=Ku.BatchJobIn$inboundSchema,t.outboundSchema=Ku.BatchJobIn$outboundSchema})(SKt||(Ku.BatchJobIn$=SKt={}));function ZSn(t){return JSON.stringify(Ku.BatchJobIn$outboundSchema.parse(t))}function YSn(t){return(0,JSn.safeParse)(t,e=>Ku.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var e3e=x(Gu=>{"use strict";var XSn=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]}),QSn=Gu&&Gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eCn=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)&&XSn(e,t,r);return QSn(e,t),e};Object.defineProperty(Gu,"__esModule",{value:!0});Gu.BatchJobStatus$=Gu.BatchJobStatus$outboundSchema=Gu.BatchJobStatus$inboundSchema=Gu.BatchJobStatus=void 0;var tCn=eCn(Ie());Gu.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};Gu.BatchJobStatus$inboundSchema=tCn.nativeEnum(Gu.BatchJobStatus);Gu.BatchJobStatus$outboundSchema=Gu.BatchJobStatus$inboundSchema;var PKt;(function(t){t.inboundSchema=Gu.BatchJobStatus$inboundSchema,t.outboundSchema=Gu.BatchJobStatus$outboundSchema})(PKt||(Gu.BatchJobStatus$=PKt={}))});var t3e=x(Ko=>{"use strict";var rCn=Ko&&Ko.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nCn=Ko&&Ko.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oCn=Ko&&Ko.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rCn(e,t,r);return nCn(e,t),e};Object.defineProperty(Ko,"__esModule",{value:!0});Ko.BatchJobOut$=Ko.BatchJobOut$outboundSchema=Ko.BatchJobOut$inboundSchema=Ko.BatchJobOutObject$=Ko.BatchJobOutObject$outboundSchema=Ko.BatchJobOutObject$inboundSchema=Ko.BatchJobOutObject=void 0;Ko.batchJobOutToJSON=aCn;Ko.batchJobOutFromJSON=sCn;var Mr=oCn(Ie()),IKt=Ke(),iCn=Ce(),MKt=Q4e(),RKt=e3e();Ko.BatchJobOutObject={Batch:"batch"};Ko.BatchJobOutObject$inboundSchema=Mr.nativeEnum(Ko.BatchJobOutObject);Ko.BatchJobOutObject$outboundSchema=Ko.BatchJobOutObject$inboundSchema;var TKt;(function(t){t.inboundSchema=Ko.BatchJobOutObject$inboundSchema,t.outboundSchema=Ko.BatchJobOutObject$outboundSchema})(TKt||(Ko.BatchJobOutObject$=TKt={}));Ko.BatchJobOut$inboundSchema=Mr.object({id:Mr.string(),object:Mr.literal("batch").default("batch"),input_files:Mr.array(Mr.string()),metadata:Mr.nullable(Mr.record(Mr.any())).optional(),endpoint:Mr.string(),model:Mr.string(),output_file:Mr.nullable(Mr.string()).optional(),error_file:Mr.nullable(Mr.string()).optional(),errors:Mr.array(MKt.BatchError$inboundSchema),status:RKt.BatchJobStatus$inboundSchema,created_at:Mr.number().int(),total_requests:Mr.number().int(),completed_requests:Mr.number().int(),succeeded_requests:Mr.number().int(),failed_requests:Mr.number().int(),started_at:Mr.nullable(Mr.number().int()).optional(),completed_at:Mr.nullable(Mr.number().int()).optional()}).transform(t=>(0,IKt.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"}));Ko.BatchJobOut$outboundSchema=Mr.object({id:Mr.string(),object:Mr.literal("batch").default("batch"),inputFiles:Mr.array(Mr.string()),metadata:Mr.nullable(Mr.record(Mr.any())).optional(),endpoint:Mr.string(),model:Mr.string(),outputFile:Mr.nullable(Mr.string()).optional(),errorFile:Mr.nullable(Mr.string()).optional(),errors:Mr.array(MKt.BatchError$outboundSchema),status:RKt.BatchJobStatus$outboundSchema,createdAt:Mr.number().int(),totalRequests:Mr.number().int(),completedRequests:Mr.number().int(),succeededRequests:Mr.number().int(),failedRequests:Mr.number().int(),startedAt:Mr.nullable(Mr.number().int()).optional(),completedAt:Mr.nullable(Mr.number().int()).optional()}).transform(t=>(0,IKt.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 AKt;(function(t){t.inboundSchema=Ko.BatchJobOut$inboundSchema,t.outboundSchema=Ko.BatchJobOut$outboundSchema})(AKt||(Ko.BatchJobOut$=AKt={}));function aCn(t){return JSON.stringify(Ko.BatchJobOut$outboundSchema.parse(t))}function sCn(t){return(0,iCn.safeParse)(t,e=>Ko.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var LKt=x(Go=>{"use strict";var uCn=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]}),lCn=Go&&Go.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cCn=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)&&uCn(e,t,r);return lCn(e,t),e};Object.defineProperty(Go,"__esModule",{value:!0});Go.BatchJobsOut$=Go.BatchJobsOut$outboundSchema=Go.BatchJobsOut$inboundSchema=Go.BatchJobsOutObject$=Go.BatchJobsOutObject$outboundSchema=Go.BatchJobsOutObject$inboundSchema=Go.BatchJobsOutObject=void 0;Go.batchJobsOutToJSON=fCn;Go.batchJobsOutFromJSON=pCn;var dT=cCn(Ie()),dCn=Ce(),DKt=t3e();Go.BatchJobsOutObject={List:"list"};Go.BatchJobsOutObject$inboundSchema=dT.nativeEnum(Go.BatchJobsOutObject);Go.BatchJobsOutObject$outboundSchema=Go.BatchJobsOutObject$inboundSchema;var NKt;(function(t){t.inboundSchema=Go.BatchJobsOutObject$inboundSchema,t.outboundSchema=Go.BatchJobsOutObject$outboundSchema})(NKt||(Go.BatchJobsOutObject$=NKt={}));Go.BatchJobsOut$inboundSchema=dT.object({data:dT.array(DKt.BatchJobOut$inboundSchema).optional(),object:dT.literal("list").default("list"),total:dT.number().int()});Go.BatchJobsOut$outboundSchema=dT.object({data:dT.array(DKt.BatchJobOut$outboundSchema).optional(),object:dT.literal("list").default("list"),total:dT.number().int()});var jKt;(function(t){t.inboundSchema=Go.BatchJobsOut$inboundSchema,t.outboundSchema=Go.BatchJobsOut$outboundSchema})(jKt||(Go.BatchJobsOut$=jKt={}));function fCn(t){return JSON.stringify(Go.BatchJobsOut$outboundSchema.parse(t))}function pCn(t){return(0,dCn.safeParse)(t,e=>Go.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var UKt=x(sr=>{"use strict";var mCn=sr&&sr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hCn=sr&&sr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gCn=sr&&sr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mCn(e,t,r);return hCn(e,t),e};Object.defineProperty(sr,"__esModule",{value:!0});sr.ChatClassificationRequest$=sr.ChatClassificationRequest$outboundSchema=sr.ChatClassificationRequest$inboundSchema=sr.ChatClassificationRequestInputs$=sr.ChatClassificationRequestInputs$outboundSchema=sr.ChatClassificationRequestInputs$inboundSchema=sr.One$=sr.One$outboundSchema=sr.One$inboundSchema=sr.Two$=sr.Two$outboundSchema=sr.Two$inboundSchema=void 0;sr.twoToJSON=yCn;sr.twoFromJSON=bCn;sr.oneToJSON=_Cn;sr.oneFromJSON=vCn;sr.chatClassificationRequestInputsToJSON=wCn;sr.chatClassificationRequestInputsFromJSON=xCn;sr.chatClassificationRequestToJSON=SCn;sr.chatClassificationRequestFromJSON=CCn;var xe=gCn(Ie()),zKt=Ke(),Nme=Ce(),Uy=e1(),qy=Ok(),Hy=Ek(),Vy=Pk();sr.Two$inboundSchema=xe.union([qy.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Vy.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Uy.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Hy.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))]);sr.Two$outboundSchema=xe.union([qy.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Vy.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Uy.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Hy.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))]);var FKt;(function(t){t.inboundSchema=sr.Two$inboundSchema,t.outboundSchema=sr.Two$outboundSchema})(FKt||(sr.Two$=FKt={}));function yCn(t){return JSON.stringify(sr.Two$outboundSchema.parse(t))}function bCn(t){return(0,Nme.safeParse)(t,e=>sr.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}sr.One$inboundSchema=xe.union([qy.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Vy.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Uy.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Hy.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))]);sr.One$outboundSchema=xe.union([qy.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Vy.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Uy.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Hy.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))]);var kKt;(function(t){t.inboundSchema=sr.One$inboundSchema,t.outboundSchema=sr.One$outboundSchema})(kKt||(sr.One$=kKt={}));function _Cn(t){return JSON.stringify(sr.One$outboundSchema.parse(t))}function vCn(t){return(0,Nme.safeParse)(t,e=>sr.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}sr.ChatClassificationRequestInputs$inboundSchema=xe.union([xe.array(xe.union([qy.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Vy.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Uy.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Hy.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])),xe.array(xe.array(xe.union([qy.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Vy.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Uy.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Hy.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])))]);sr.ChatClassificationRequestInputs$outboundSchema=xe.union([xe.array(xe.union([qy.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Vy.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Uy.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Hy.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])),xe.array(xe.array(xe.union([qy.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Vy.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Uy.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Hy.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])))]);var $Kt;(function(t){t.inboundSchema=sr.ChatClassificationRequestInputs$inboundSchema,t.outboundSchema=sr.ChatClassificationRequestInputs$outboundSchema})($Kt||(sr.ChatClassificationRequestInputs$=$Kt={}));function wCn(t){return JSON.stringify(sr.ChatClassificationRequestInputs$outboundSchema.parse(t))}function xCn(t){return(0,Nme.safeParse)(t,e=>sr.ChatClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequestInputs' from JSON")}sr.ChatClassificationRequest$inboundSchema=xe.object({input:xe.union([xe.array(xe.union([qy.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Vy.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Uy.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Hy.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])),xe.array(xe.array(xe.union([qy.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Vy.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Uy.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Hy.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])))]),model:xe.nullable(xe.string())}).transform(t=>(0,zKt.remap)(t,{input:"inputs"}));sr.ChatClassificationRequest$outboundSchema=xe.object({inputs:xe.union([xe.array(xe.union([qy.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Vy.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Uy.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Hy.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])),xe.array(xe.array(xe.union([qy.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Vy.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Uy.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Hy.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])))]),model:xe.nullable(xe.string())}).transform(t=>(0,zKt.remap)(t,{inputs:"input"}));var BKt;(function(t){t.inboundSchema=sr.ChatClassificationRequest$inboundSchema,t.outboundSchema=sr.ChatClassificationRequest$outboundSchema})(BKt||(sr.ChatClassificationRequest$=BKt={}));function SCn(t){return JSON.stringify(sr.ChatClassificationRequest$outboundSchema.parse(t))}function CCn(t){return(0,Nme.safeParse)(t,e=>sr.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var jme=x(Po=>{"use strict";var OCn=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]}),ECn=Po&&Po.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PCn=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)&&OCn(e,t,r);return ECn(e,t),e};Object.defineProperty(Po,"__esModule",{value:!0});Po.ChatCompletionChoice$=Po.ChatCompletionChoice$outboundSchema=Po.ChatCompletionChoice$inboundSchema=Po.FinishReason$=Po.FinishReason$outboundSchema=Po.FinishReason$inboundSchema=Po.FinishReason=void 0;Po.chatCompletionChoiceToJSON=ICn;Po.chatCompletionChoiceFromJSON=MCn;var R_=PCn(Ie()),VKt=Ke(),TCn=Ce(),ACn=QR(),WKt=e1();Po.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};Po.FinishReason$inboundSchema=R_.union([R_.nativeEnum(Po.FinishReason),R_.string().transform(ACn.catchUnrecognizedEnum)]);Po.FinishReason$outboundSchema=R_.union([R_.nativeEnum(Po.FinishReason),R_.string().and(R_.custom())]);var qKt;(function(t){t.inboundSchema=Po.FinishReason$inboundSchema,t.outboundSchema=Po.FinishReason$outboundSchema})(qKt||(Po.FinishReason$=qKt={}));Po.ChatCompletionChoice$inboundSchema=R_.object({index:R_.number().int(),message:WKt.AssistantMessage$inboundSchema,finish_reason:Po.FinishReason$inboundSchema}).transform(t=>(0,VKt.remap)(t,{finish_reason:"finishReason"}));Po.ChatCompletionChoice$outboundSchema=R_.object({index:R_.number().int(),message:WKt.AssistantMessage$outboundSchema,finishReason:Po.FinishReason$outboundSchema}).transform(t=>(0,VKt.remap)(t,{finishReason:"finish_reason"}));var HKt;(function(t){t.inboundSchema=Po.ChatCompletionChoice$inboundSchema,t.outboundSchema=Po.ChatCompletionChoice$outboundSchema})(HKt||(Po.ChatCompletionChoice$=HKt={}));function ICn(t){return JSON.stringify(Po.ChatCompletionChoice$outboundSchema.parse(t))}function MCn(t){return(0,TCn.safeParse)(t,e=>Po.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var tGt=x(ur=>{"use strict";var RCn=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]}),NCn=ur&&ur.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jCn=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)&&RCn(e,t,r);return NCn(e,t),e};Object.defineProperty(ur,"__esModule",{value:!0});ur.ChatCompletionRequest$=ur.ChatCompletionRequest$outboundSchema=ur.ChatCompletionRequest$inboundSchema=ur.ChatCompletionRequestToolChoice$=ur.ChatCompletionRequestToolChoice$outboundSchema=ur.ChatCompletionRequestToolChoice$inboundSchema=ur.Messages$=ur.Messages$outboundSchema=ur.Messages$inboundSchema=ur.Stop$=ur.Stop$outboundSchema=ur.Stop$inboundSchema=void 0;ur.stopToJSON=DCn;ur.stopFromJSON=LCn;ur.messagesToJSON=FCn;ur.messagesFromJSON=kCn;ur.chatCompletionRequestToolChoiceToJSON=$Cn;ur.chatCompletionRequestToolChoiceFromJSON=BCn;ur.chatCompletionRequestToJSON=zCn;ur.chatCompletionRequestFromJSON=UCn;var He=jCn(Ie()),YKt=Ke(),Dme=Ce(),Lme=e1(),XKt=U3(),QKt=q3(),Fme=Ok(),eGt=H3(),kme=V3(),$me=W3(),Bme=Ek(),zme=Pk();ur.Stop$inboundSchema=He.union([He.string(),He.array(He.string())]);ur.Stop$outboundSchema=He.union([He.string(),He.array(He.string())]);var KKt;(function(t){t.inboundSchema=ur.Stop$inboundSchema,t.outboundSchema=ur.Stop$outboundSchema})(KKt||(ur.Stop$=KKt={}));function DCn(t){return JSON.stringify(ur.Stop$outboundSchema.parse(t))}function LCn(t){return(0,Dme.safeParse)(t,e=>ur.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}ur.Messages$inboundSchema=He.union([Fme.SystemMessage$inboundSchema.and(He.object({role:He.literal("system")}).transform(t=>({role:t.role}))),zme.UserMessage$inboundSchema.and(He.object({role:He.literal("user")}).transform(t=>({role:t.role}))),Lme.AssistantMessage$inboundSchema.and(He.object({role:He.literal("assistant")}).transform(t=>({role:t.role}))),Bme.ToolMessage$inboundSchema.and(He.object({role:He.literal("tool")}).transform(t=>({role:t.role})))]);ur.Messages$outboundSchema=He.union([Fme.SystemMessage$outboundSchema.and(He.object({role:He.literal("system")}).transform(t=>({role:t.role}))),zme.UserMessage$outboundSchema.and(He.object({role:He.literal("user")}).transform(t=>({role:t.role}))),Lme.AssistantMessage$outboundSchema.and(He.object({role:He.literal("assistant")}).transform(t=>({role:t.role}))),Bme.ToolMessage$outboundSchema.and(He.object({role:He.literal("tool")}).transform(t=>({role:t.role})))]);var GKt;(function(t){t.inboundSchema=ur.Messages$inboundSchema,t.outboundSchema=ur.Messages$outboundSchema})(GKt||(ur.Messages$=GKt={}));function FCn(t){return JSON.stringify(ur.Messages$outboundSchema.parse(t))}function kCn(t){return(0,Dme.safeParse)(t,e=>ur.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}ur.ChatCompletionRequestToolChoice$inboundSchema=He.union([kme.ToolChoice$inboundSchema,$me.ToolChoiceEnum$inboundSchema]);ur.ChatCompletionRequestToolChoice$outboundSchema=He.union([kme.ToolChoice$outboundSchema,$me.ToolChoiceEnum$outboundSchema]);var JKt;(function(t){t.inboundSchema=ur.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=ur.ChatCompletionRequestToolChoice$outboundSchema})(JKt||(ur.ChatCompletionRequestToolChoice$=JKt={}));function $Cn(t){return JSON.stringify(ur.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function BCn(t){return(0,Dme.safeParse)(t,e=>ur.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}ur.ChatCompletionRequest$inboundSchema=He.object({model:He.nullable(He.string()),temperature:He.nullable(He.number()).optional(),top_p:He.number().optional(),max_tokens:He.nullable(He.number().int()).optional(),stream:He.boolean().default(!1),stop:He.union([He.string(),He.array(He.string())]).optional(),random_seed:He.nullable(He.number().int()).optional(),messages:He.array(He.union([Fme.SystemMessage$inboundSchema.and(He.object({role:He.literal("system")}).transform(t=>({role:t.role}))),zme.UserMessage$inboundSchema.and(He.object({role:He.literal("user")}).transform(t=>({role:t.role}))),Lme.AssistantMessage$inboundSchema.and(He.object({role:He.literal("assistant")}).transform(t=>({role:t.role}))),Bme.ToolMessage$inboundSchema.and(He.object({role:He.literal("tool")}).transform(t=>({role:t.role})))])),response_format:QKt.ResponseFormat$inboundSchema.optional(),tools:He.nullable(He.array(eGt.Tool$inboundSchema)).optional(),tool_choice:He.union([kme.ToolChoice$inboundSchema,$me.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:He.number().optional(),frequency_penalty:He.number().optional(),n:He.nullable(He.number().int()).optional(),prediction:XKt.Prediction$inboundSchema.optional(),safe_prompt:He.boolean().optional()}).transform(t=>(0,YKt.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"}));ur.ChatCompletionRequest$outboundSchema=He.object({model:He.nullable(He.string()),temperature:He.nullable(He.number()).optional(),topP:He.number().optional(),maxTokens:He.nullable(He.number().int()).optional(),stream:He.boolean().default(!1),stop:He.union([He.string(),He.array(He.string())]).optional(),randomSeed:He.nullable(He.number().int()).optional(),messages:He.array(He.union([Fme.SystemMessage$outboundSchema.and(He.object({role:He.literal("system")}).transform(t=>({role:t.role}))),zme.UserMessage$outboundSchema.and(He.object({role:He.literal("user")}).transform(t=>({role:t.role}))),Lme.AssistantMessage$outboundSchema.and(He.object({role:He.literal("assistant")}).transform(t=>({role:t.role}))),Bme.ToolMessage$outboundSchema.and(He.object({role:He.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:QKt.ResponseFormat$outboundSchema.optional(),tools:He.nullable(He.array(eGt.Tool$outboundSchema)).optional(),toolChoice:He.union([kme.ToolChoice$outboundSchema,$me.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:He.number().optional(),frequencyPenalty:He.number().optional(),n:He.nullable(He.number().int()).optional(),prediction:XKt.Prediction$outboundSchema.optional(),safePrompt:He.boolean().optional()}).transform(t=>(0,YKt.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 ZKt;(function(t){t.inboundSchema=ur.ChatCompletionRequest$inboundSchema,t.outboundSchema=ur.ChatCompletionRequest$outboundSchema})(ZKt||(ur.ChatCompletionRequest$=ZKt={}));function zCn(t){return JSON.stringify(ur.ChatCompletionRequest$outboundSchema.parse(t))}function UCn(t){return(0,Dme.safeParse)(t,e=>ur.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var G3=x(Ju=>{"use strict";var qCn=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]}),HCn=Ju&&Ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VCn=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)&&qCn(e,t,r);return HCn(e,t),e};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.UsageInfo$=Ju.UsageInfo$outboundSchema=Ju.UsageInfo$inboundSchema=void 0;Ju.usageInfoToJSON=KCn;Ju.usageInfoFromJSON=GCn;var t1=VCn(Ie()),nGt=Ke(),WCn=Ce();Ju.UsageInfo$inboundSchema=t1.object({prompt_tokens:t1.number().int(),completion_tokens:t1.number().int(),total_tokens:t1.number().int()}).transform(t=>(0,nGt.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens"}));Ju.UsageInfo$outboundSchema=t1.object({promptTokens:t1.number().int(),completionTokens:t1.number().int(),totalTokens:t1.number().int()}).transform(t=>(0,nGt.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens"}));var rGt;(function(t){t.inboundSchema=Ju.UsageInfo$inboundSchema,t.outboundSchema=Ju.UsageInfo$outboundSchema})(rGt||(Ju.UsageInfo$=rGt={}));function KCn(t){return JSON.stringify(Ju.UsageInfo$outboundSchema.parse(t))}function GCn(t){return(0,WCn.safeParse)(t,e=>Ju.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var sGt=x(Zu=>{"use strict";var JCn=Zu&&Zu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZCn=Zu&&Zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YCn=Zu&&Zu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JCn(e,t,r);return ZCn(e,t),e};Object.defineProperty(Zu,"__esModule",{value:!0});Zu.ChatCompletionResponse$=Zu.ChatCompletionResponse$outboundSchema=Zu.ChatCompletionResponse$inboundSchema=void 0;Zu.chatCompletionResponseToJSON=QCn;Zu.chatCompletionResponseFromJSON=eOn;var Wy=YCn(Ie()),XCn=Ce(),iGt=jme(),aGt=G3();Zu.ChatCompletionResponse$inboundSchema=Wy.object({id:Wy.string(),object:Wy.string(),model:Wy.string(),usage:aGt.UsageInfo$inboundSchema,created:Wy.number().int().optional(),choices:Wy.array(iGt.ChatCompletionChoice$inboundSchema).optional()});Zu.ChatCompletionResponse$outboundSchema=Wy.object({id:Wy.string(),object:Wy.string(),model:Wy.string(),usage:aGt.UsageInfo$outboundSchema,created:Wy.number().int().optional(),choices:Wy.array(iGt.ChatCompletionChoice$outboundSchema).optional()});var oGt;(function(t){t.inboundSchema=Zu.ChatCompletionResponse$inboundSchema,t.outboundSchema=Zu.ChatCompletionResponse$outboundSchema})(oGt||(Zu.ChatCompletionResponse$=oGt={}));function QCn(t){return JSON.stringify(Zu.ChatCompletionResponse$outboundSchema.parse(t))}function eOn(t){return(0,XCn.safeParse)(t,e=>Zu.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var gGt=x(lr=>{"use strict";var tOn=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]}),rOn=lr&&lr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nOn=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)&&tOn(e,t,r);return rOn(e,t),e};Object.defineProperty(lr,"__esModule",{value:!0});lr.ChatCompletionStreamRequest$=lr.ChatCompletionStreamRequest$outboundSchema=lr.ChatCompletionStreamRequest$inboundSchema=lr.ChatCompletionStreamRequestToolChoice$=lr.ChatCompletionStreamRequestToolChoice$outboundSchema=lr.ChatCompletionStreamRequestToolChoice$inboundSchema=lr.ChatCompletionStreamRequestMessages$=lr.ChatCompletionStreamRequestMessages$outboundSchema=lr.ChatCompletionStreamRequestMessages$inboundSchema=lr.ChatCompletionStreamRequestStop$=lr.ChatCompletionStreamRequestStop$outboundSchema=lr.ChatCompletionStreamRequestStop$inboundSchema=void 0;lr.chatCompletionStreamRequestStopToJSON=oOn;lr.chatCompletionStreamRequestStopFromJSON=iOn;lr.chatCompletionStreamRequestMessagesToJSON=aOn;lr.chatCompletionStreamRequestMessagesFromJSON=sOn;lr.chatCompletionStreamRequestToolChoiceToJSON=uOn;lr.chatCompletionStreamRequestToolChoiceFromJSON=lOn;lr.chatCompletionStreamRequestToJSON=cOn;lr.chatCompletionStreamRequestFromJSON=dOn;var Ve=nOn(Ie()),fGt=Ke(),Ume=Ce(),qme=e1(),pGt=U3(),mGt=q3(),Hme=Ok(),hGt=H3(),Vme=V3(),Wme=W3(),Kme=Ek(),Gme=Pk();lr.ChatCompletionStreamRequestStop$inboundSchema=Ve.union([Ve.string(),Ve.array(Ve.string())]);lr.ChatCompletionStreamRequestStop$outboundSchema=Ve.union([Ve.string(),Ve.array(Ve.string())]);var uGt;(function(t){t.inboundSchema=lr.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=lr.ChatCompletionStreamRequestStop$outboundSchema})(uGt||(lr.ChatCompletionStreamRequestStop$=uGt={}));function oOn(t){return JSON.stringify(lr.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function iOn(t){return(0,Ume.safeParse)(t,e=>lr.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}lr.ChatCompletionStreamRequestMessages$inboundSchema=Ve.union([Hme.SystemMessage$inboundSchema.and(Ve.object({role:Ve.literal("system")}).transform(t=>({role:t.role}))),Gme.UserMessage$inboundSchema.and(Ve.object({role:Ve.literal("user")}).transform(t=>({role:t.role}))),qme.AssistantMessage$inboundSchema.and(Ve.object({role:Ve.literal("assistant")}).transform(t=>({role:t.role}))),Kme.ToolMessage$inboundSchema.and(Ve.object({role:Ve.literal("tool")}).transform(t=>({role:t.role})))]);lr.ChatCompletionStreamRequestMessages$outboundSchema=Ve.union([Hme.SystemMessage$outboundSchema.and(Ve.object({role:Ve.literal("system")}).transform(t=>({role:t.role}))),Gme.UserMessage$outboundSchema.and(Ve.object({role:Ve.literal("user")}).transform(t=>({role:t.role}))),qme.AssistantMessage$outboundSchema.and(Ve.object({role:Ve.literal("assistant")}).transform(t=>({role:t.role}))),Kme.ToolMessage$outboundSchema.and(Ve.object({role:Ve.literal("tool")}).transform(t=>({role:t.role})))]);var lGt;(function(t){t.inboundSchema=lr.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=lr.ChatCompletionStreamRequestMessages$outboundSchema})(lGt||(lr.ChatCompletionStreamRequestMessages$=lGt={}));function aOn(t){return JSON.stringify(lr.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function sOn(t){return(0,Ume.safeParse)(t,e=>lr.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}lr.ChatCompletionStreamRequestToolChoice$inboundSchema=Ve.union([Vme.ToolChoice$inboundSchema,Wme.ToolChoiceEnum$inboundSchema]);lr.ChatCompletionStreamRequestToolChoice$outboundSchema=Ve.union([Vme.ToolChoice$outboundSchema,Wme.ToolChoiceEnum$outboundSchema]);var cGt;(function(t){t.inboundSchema=lr.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=lr.ChatCompletionStreamRequestToolChoice$outboundSchema})(cGt||(lr.ChatCompletionStreamRequestToolChoice$=cGt={}));function uOn(t){return JSON.stringify(lr.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function lOn(t){return(0,Ume.safeParse)(t,e=>lr.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}lr.ChatCompletionStreamRequest$inboundSchema=Ve.object({model:Ve.nullable(Ve.string()),temperature:Ve.nullable(Ve.number()).optional(),top_p:Ve.number().optional(),max_tokens:Ve.nullable(Ve.number().int()).optional(),stream:Ve.boolean().default(!0),stop:Ve.union([Ve.string(),Ve.array(Ve.string())]).optional(),random_seed:Ve.nullable(Ve.number().int()).optional(),messages:Ve.array(Ve.union([Hme.SystemMessage$inboundSchema.and(Ve.object({role:Ve.literal("system")}).transform(t=>({role:t.role}))),Gme.UserMessage$inboundSchema.and(Ve.object({role:Ve.literal("user")}).transform(t=>({role:t.role}))),qme.AssistantMessage$inboundSchema.and(Ve.object({role:Ve.literal("assistant")}).transform(t=>({role:t.role}))),Kme.ToolMessage$inboundSchema.and(Ve.object({role:Ve.literal("tool")}).transform(t=>({role:t.role})))])),response_format:mGt.ResponseFormat$inboundSchema.optional(),tools:Ve.nullable(Ve.array(hGt.Tool$inboundSchema)).optional(),tool_choice:Ve.union([Vme.ToolChoice$inboundSchema,Wme.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Ve.number().optional(),frequency_penalty:Ve.number().optional(),n:Ve.nullable(Ve.number().int()).optional(),prediction:pGt.Prediction$inboundSchema.optional(),safe_prompt:Ve.boolean().optional()}).transform(t=>(0,fGt.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"}));lr.ChatCompletionStreamRequest$outboundSchema=Ve.object({model:Ve.nullable(Ve.string()),temperature:Ve.nullable(Ve.number()).optional(),topP:Ve.number().optional(),maxTokens:Ve.nullable(Ve.number().int()).optional(),stream:Ve.boolean().default(!0),stop:Ve.union([Ve.string(),Ve.array(Ve.string())]).optional(),randomSeed:Ve.nullable(Ve.number().int()).optional(),messages:Ve.array(Ve.union([Hme.SystemMessage$outboundSchema.and(Ve.object({role:Ve.literal("system")}).transform(t=>({role:t.role}))),Gme.UserMessage$outboundSchema.and(Ve.object({role:Ve.literal("user")}).transform(t=>({role:t.role}))),qme.AssistantMessage$outboundSchema.and(Ve.object({role:Ve.literal("assistant")}).transform(t=>({role:t.role}))),Kme.ToolMessage$outboundSchema.and(Ve.object({role:Ve.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:mGt.ResponseFormat$outboundSchema.optional(),tools:Ve.nullable(Ve.array(hGt.Tool$outboundSchema)).optional(),toolChoice:Ve.union([Vme.ToolChoice$outboundSchema,Wme.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Ve.number().optional(),frequencyPenalty:Ve.number().optional(),n:Ve.nullable(Ve.number().int()).optional(),prediction:pGt.Prediction$outboundSchema.optional(),safePrompt:Ve.boolean().optional()}).transform(t=>(0,fGt.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 dGt;(function(t){t.inboundSchema=lr.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=lr.ChatCompletionStreamRequest$outboundSchema})(dGt||(lr.ChatCompletionStreamRequest$=dGt={}));function cOn(t){return JSON.stringify(lr.ChatCompletionStreamRequest$outboundSchema.parse(t))}function dOn(t){return(0,Ume.safeParse)(t,e=>lr.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var r3e=x(Yu=>{"use strict";var fOn=Yu&&Yu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pOn=Yu&&Yu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mOn=Yu&&Yu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fOn(e,t,r);return pOn(e,t),e};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.MetricOut$=Yu.MetricOut$outboundSchema=Yu.MetricOut$inboundSchema=void 0;Yu.metricOutToJSON=gOn;Yu.metricOutFromJSON=yOn;var ch=mOn(Ie()),bGt=Ke(),hOn=Ce();Yu.MetricOut$inboundSchema=ch.object({train_loss:ch.nullable(ch.number()).optional(),valid_loss:ch.nullable(ch.number()).optional(),valid_mean_token_accuracy:ch.nullable(ch.number()).optional()}).transform(t=>(0,bGt.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));Yu.MetricOut$outboundSchema=ch.object({trainLoss:ch.nullable(ch.number()).optional(),validLoss:ch.nullable(ch.number()).optional(),validMeanTokenAccuracy:ch.nullable(ch.number()).optional()}).transform(t=>(0,bGt.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var yGt;(function(t){t.inboundSchema=Yu.MetricOut$inboundSchema,t.outboundSchema=Yu.MetricOut$outboundSchema})(yGt||(Yu.MetricOut$=yGt={}));function gOn(t){return JSON.stringify(Yu.MetricOut$outboundSchema.parse(t))}function yOn(t){return(0,hOn.safeParse)(t,e=>Yu.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var n3e=x(Xu=>{"use strict";var bOn=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]}),_On=Xu&&Xu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vOn=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)&&bOn(e,t,r);return _On(e,t),e};Object.defineProperty(Xu,"__esModule",{value:!0});Xu.CheckpointOut$=Xu.CheckpointOut$outboundSchema=Xu.CheckpointOut$inboundSchema=void 0;Xu.checkpointOutToJSON=xOn;Xu.checkpointOutFromJSON=SOn;var J3=vOn(Ie()),vGt=Ke(),wOn=Ce(),wGt=r3e();Xu.CheckpointOut$inboundSchema=J3.object({metrics:wGt.MetricOut$inboundSchema,step_number:J3.number().int(),created_at:J3.number().int()}).transform(t=>(0,vGt.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));Xu.CheckpointOut$outboundSchema=J3.object({metrics:wGt.MetricOut$outboundSchema,stepNumber:J3.number().int(),createdAt:J3.number().int()}).transform(t=>(0,vGt.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var _Gt;(function(t){t.inboundSchema=Xu.CheckpointOut$inboundSchema,t.outboundSchema=Xu.CheckpointOut$outboundSchema})(_Gt||(Xu.CheckpointOut$=_Gt={}));function xOn(t){return JSON.stringify(Xu.CheckpointOut$outboundSchema.parse(t))}function SOn(t){return(0,wOn.safeParse)(t,e=>Xu.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var o3e=x(Qu=>{"use strict";var COn=Qu&&Qu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OOn=Qu&&Qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EOn=Qu&&Qu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&COn(e,t,r);return OOn(e,t),e};Object.defineProperty(Qu,"__esModule",{value:!0});Qu.ClassificationObject$=Qu.ClassificationObject$outboundSchema=Qu.ClassificationObject$inboundSchema=void 0;Qu.classificationObjectToJSON=TOn;Qu.classificationObjectFromJSON=AOn;var EO=EOn(Ie()),SGt=Ke(),POn=Ce();Qu.ClassificationObject$inboundSchema=EO.object({categories:EO.record(EO.boolean()).optional(),category_scores:EO.record(EO.number()).optional()}).transform(t=>(0,SGt.remap)(t,{category_scores:"categoryScores"}));Qu.ClassificationObject$outboundSchema=EO.object({categories:EO.record(EO.boolean()).optional(),categoryScores:EO.record(EO.number()).optional()}).transform(t=>(0,SGt.remap)(t,{categoryScores:"category_scores"}));var xGt;(function(t){t.inboundSchema=Qu.ClassificationObject$inboundSchema,t.outboundSchema=Qu.ClassificationObject$outboundSchema})(xGt||(Qu.ClassificationObject$=xGt={}));function TOn(t){return JSON.stringify(Qu.ClassificationObject$outboundSchema.parse(t))}function AOn(t){return(0,POn.safeParse)(t,e=>Qu.ClassificationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationObject' from JSON")}});var TGt=x(Jo=>{"use strict";var IOn=Jo&&Jo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MOn=Jo&&Jo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ROn=Jo&&Jo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&IOn(e,t,r);return MOn(e,t),e};Object.defineProperty(Jo,"__esModule",{value:!0});Jo.ClassificationRequest$=Jo.ClassificationRequest$outboundSchema=Jo.ClassificationRequest$inboundSchema=Jo.ClassificationRequestInputs$=Jo.ClassificationRequestInputs$outboundSchema=Jo.ClassificationRequestInputs$inboundSchema=void 0;Jo.classificationRequestInputsToJSON=NOn;Jo.classificationRequestInputsFromJSON=jOn;Jo.classificationRequestToJSON=DOn;Jo.classificationRequestFromJSON=LOn;var zs=ROn(Ie()),EGt=Ke(),PGt=Ce();Jo.ClassificationRequestInputs$inboundSchema=zs.union([zs.string(),zs.array(zs.string())]);Jo.ClassificationRequestInputs$outboundSchema=zs.union([zs.string(),zs.array(zs.string())]);var CGt;(function(t){t.inboundSchema=Jo.ClassificationRequestInputs$inboundSchema,t.outboundSchema=Jo.ClassificationRequestInputs$outboundSchema})(CGt||(Jo.ClassificationRequestInputs$=CGt={}));function NOn(t){return JSON.stringify(Jo.ClassificationRequestInputs$outboundSchema.parse(t))}function jOn(t){return(0,PGt.safeParse)(t,e=>Jo.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}Jo.ClassificationRequest$inboundSchema=zs.object({input:zs.union([zs.string(),zs.array(zs.string())]),model:zs.nullable(zs.string()).optional()}).transform(t=>(0,EGt.remap)(t,{input:"inputs"}));Jo.ClassificationRequest$outboundSchema=zs.object({inputs:zs.union([zs.string(),zs.array(zs.string())]),model:zs.nullable(zs.string()).optional()}).transform(t=>(0,EGt.remap)(t,{inputs:"input"}));var OGt;(function(t){t.inboundSchema=Jo.ClassificationRequest$inboundSchema,t.outboundSchema=Jo.ClassificationRequest$outboundSchema})(OGt||(Jo.ClassificationRequest$=OGt={}));function DOn(t){return JSON.stringify(Jo.ClassificationRequest$outboundSchema.parse(t))}function LOn(t){return(0,PGt.safeParse)(t,e=>Jo.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var MGt=x(el=>{"use strict";var FOn=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]}),kOn=el&&el.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$On=el&&el.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FOn(e,t,r);return kOn(e,t),e};Object.defineProperty(el,"__esModule",{value:!0});el.ClassificationResponse$=el.ClassificationResponse$outboundSchema=el.ClassificationResponse$inboundSchema=void 0;el.classificationResponseToJSON=zOn;el.classificationResponseFromJSON=UOn;var r1=$On(Ie()),BOn=Ce(),IGt=o3e();el.ClassificationResponse$inboundSchema=r1.object({id:r1.string().optional(),model:r1.string().optional(),results:r1.array(IGt.ClassificationObject$inboundSchema).optional()});el.ClassificationResponse$outboundSchema=r1.object({id:r1.string().optional(),model:r1.string().optional(),results:r1.array(IGt.ClassificationObject$outboundSchema).optional()});var AGt;(function(t){t.inboundSchema=el.ClassificationResponse$inboundSchema,t.outboundSchema=el.ClassificationResponse$outboundSchema})(AGt||(el.ClassificationResponse$=AGt={}));function zOn(t){return JSON.stringify(el.ClassificationResponse$outboundSchema.parse(t))}function UOn(t){return(0,BOn.safeParse)(t,e=>el.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var i3e=x(Zo=>{"use strict";var qOn=Zo&&Zo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HOn=Zo&&Zo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VOn=Zo&&Zo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qOn(e,t,r);return HOn(e,t),e};Object.defineProperty(Zo,"__esModule",{value:!0});Zo.DeltaMessage$=Zo.DeltaMessage$outboundSchema=Zo.DeltaMessage$inboundSchema=Zo.Content$=Zo.Content$outboundSchema=Zo.Content$inboundSchema=void 0;Zo.contentToJSON=WOn;Zo.contentFromJSON=KOn;Zo.deltaMessageToJSON=GOn;Zo.deltaMessageFromJSON=JOn;var Ga=VOn(Ie()),jGt=Ke(),DGt=Ce(),Jme=B3(),LGt=dme();Zo.Content$inboundSchema=Ga.union([Ga.string(),Ga.array(Jme.ContentChunk$inboundSchema)]);Zo.Content$outboundSchema=Ga.union([Ga.string(),Ga.array(Jme.ContentChunk$outboundSchema)]);var RGt;(function(t){t.inboundSchema=Zo.Content$inboundSchema,t.outboundSchema=Zo.Content$outboundSchema})(RGt||(Zo.Content$=RGt={}));function WOn(t){return JSON.stringify(Zo.Content$outboundSchema.parse(t))}function KOn(t){return(0,DGt.safeParse)(t,e=>Zo.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}Zo.DeltaMessage$inboundSchema=Ga.object({role:Ga.nullable(Ga.string()).optional(),content:Ga.nullable(Ga.union([Ga.string(),Ga.array(Jme.ContentChunk$inboundSchema)])).optional(),tool_calls:Ga.nullable(Ga.array(LGt.ToolCall$inboundSchema)).optional()}).transform(t=>(0,jGt.remap)(t,{tool_calls:"toolCalls"}));Zo.DeltaMessage$outboundSchema=Ga.object({role:Ga.nullable(Ga.string()).optional(),content:Ga.nullable(Ga.union([Ga.string(),Ga.array(Jme.ContentChunk$outboundSchema)])).optional(),toolCalls:Ga.nullable(Ga.array(LGt.ToolCall$outboundSchema)).optional()}).transform(t=>(0,jGt.remap)(t,{toolCalls:"tool_calls"}));var NGt;(function(t){t.inboundSchema=Zo.DeltaMessage$inboundSchema,t.outboundSchema=Zo.DeltaMessage$outboundSchema})(NGt||(Zo.DeltaMessage$=NGt={}));function GOn(t){return JSON.stringify(Zo.DeltaMessage$outboundSchema.parse(t))}function JOn(t){return(0,DGt.safeParse)(t,e=>Zo.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var a3e=x(To=>{"use strict";var ZOn=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]}),YOn=To&&To.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XOn=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)&&ZOn(e,t,r);return YOn(e,t),e};Object.defineProperty(To,"__esModule",{value:!0});To.CompletionResponseStreamChoice$=To.CompletionResponseStreamChoice$outboundSchema=To.CompletionResponseStreamChoice$inboundSchema=To.CompletionResponseStreamChoiceFinishReason$=To.CompletionResponseStreamChoiceFinishReason$outboundSchema=To.CompletionResponseStreamChoiceFinishReason$inboundSchema=To.CompletionResponseStreamChoiceFinishReason=void 0;To.completionResponseStreamChoiceToJSON=tEn;To.completionResponseStreamChoiceFromJSON=rEn;var gg=XOn(Ie()),$Gt=Ke(),QOn=Ce(),eEn=QR(),BGt=i3e();To.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};To.CompletionResponseStreamChoiceFinishReason$inboundSchema=gg.union([gg.nativeEnum(To.CompletionResponseStreamChoiceFinishReason),gg.string().transform(eEn.catchUnrecognizedEnum)]);To.CompletionResponseStreamChoiceFinishReason$outboundSchema=gg.union([gg.nativeEnum(To.CompletionResponseStreamChoiceFinishReason),gg.string().and(gg.custom())]);var FGt;(function(t){t.inboundSchema=To.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=To.CompletionResponseStreamChoiceFinishReason$outboundSchema})(FGt||(To.CompletionResponseStreamChoiceFinishReason$=FGt={}));To.CompletionResponseStreamChoice$inboundSchema=gg.object({index:gg.number().int(),delta:BGt.DeltaMessage$inboundSchema,finish_reason:gg.nullable(To.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,$Gt.remap)(t,{finish_reason:"finishReason"}));To.CompletionResponseStreamChoice$outboundSchema=gg.object({index:gg.number().int(),delta:BGt.DeltaMessage$outboundSchema,finishReason:gg.nullable(To.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,$Gt.remap)(t,{finishReason:"finish_reason"}));var kGt;(function(t){t.inboundSchema=To.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=To.CompletionResponseStreamChoice$outboundSchema})(kGt||(To.CompletionResponseStreamChoice$=kGt={}));function tEn(t){return JSON.stringify(To.CompletionResponseStreamChoice$outboundSchema.parse(t))}function rEn(t){return(0,QOn.safeParse)(t,e=>To.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var s3e=x(tl=>{"use strict";var nEn=tl&&tl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oEn=tl&&tl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iEn=tl&&tl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nEn(e,t,r);return oEn(e,t),e};Object.defineProperty(tl,"__esModule",{value:!0});tl.CompletionChunk$=tl.CompletionChunk$outboundSchema=tl.CompletionChunk$inboundSchema=void 0;tl.completionChunkToJSON=sEn;tl.completionChunkFromJSON=uEn;var Ky=iEn(Ie()),aEn=Ce(),UGt=a3e(),qGt=G3();tl.CompletionChunk$inboundSchema=Ky.object({id:Ky.string(),object:Ky.string().optional(),created:Ky.number().int().optional(),model:Ky.string(),usage:qGt.UsageInfo$inboundSchema.optional(),choices:Ky.array(UGt.CompletionResponseStreamChoice$inboundSchema)});tl.CompletionChunk$outboundSchema=Ky.object({id:Ky.string(),object:Ky.string().optional(),created:Ky.number().int().optional(),model:Ky.string(),usage:qGt.UsageInfo$outboundSchema.optional(),choices:Ky.array(UGt.CompletionResponseStreamChoice$outboundSchema)});var zGt;(function(t){t.inboundSchema=tl.CompletionChunk$inboundSchema,t.outboundSchema=tl.CompletionChunk$outboundSchema})(zGt||(tl.CompletionChunk$=zGt={}));function sEn(t){return JSON.stringify(tl.CompletionChunk$outboundSchema.parse(t))}function uEn(t){return(0,aEn.safeParse)(t,e=>tl.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var WGt=x(rl=>{"use strict";var lEn=rl&&rl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cEn=rl&&rl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dEn=rl&&rl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lEn(e,t,r);return cEn(e,t),e};Object.defineProperty(rl,"__esModule",{value:!0});rl.CompletionEvent$=rl.CompletionEvent$outboundSchema=rl.CompletionEvent$inboundSchema=void 0;rl.completionEventToJSON=pEn;rl.completionEventFromJSON=mEn;var IJ=dEn(Ie()),fEn=Ce(),VGt=s3e();rl.CompletionEvent$inboundSchema=IJ.object({data:IJ.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:IJ.ZodIssueCode.custom,message:`malformed json: ${r}`}),IJ.NEVER}}).pipe(VGt.CompletionChunk$inboundSchema)});rl.CompletionEvent$outboundSchema=IJ.object({data:VGt.CompletionChunk$outboundSchema});var HGt;(function(t){t.inboundSchema=rl.CompletionEvent$inboundSchema,t.outboundSchema=rl.CompletionEvent$outboundSchema})(HGt||(rl.CompletionEvent$=HGt={}));function pEn(t){return JSON.stringify(rl.CompletionEvent$outboundSchema.parse(t))}function mEn(t){return(0,fEn.safeParse)(t,e=>rl.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var GGt=x(nl=>{"use strict";var hEn=nl&&nl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gEn=nl&&nl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yEn=nl&&nl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hEn(e,t,r);return gEn(e,t),e};Object.defineProperty(nl,"__esModule",{value:!0});nl.DeleteFileOut$=nl.DeleteFileOut$outboundSchema=nl.DeleteFileOut$inboundSchema=void 0;nl.deleteFileOutToJSON=_En;nl.deleteFileOutFromJSON=vEn;var n1=yEn(Ie()),bEn=Ce();nl.DeleteFileOut$inboundSchema=n1.object({id:n1.string(),object:n1.string(),deleted:n1.boolean()});nl.DeleteFileOut$outboundSchema=n1.object({id:n1.string(),object:n1.string(),deleted:n1.boolean()});var KGt;(function(t){t.inboundSchema=nl.DeleteFileOut$inboundSchema,t.outboundSchema=nl.DeleteFileOut$outboundSchema})(KGt||(nl.DeleteFileOut$=KGt={}));function _En(t){return JSON.stringify(nl.DeleteFileOut$outboundSchema.parse(t))}function vEn(t){return(0,bEn.safeParse)(t,e=>nl.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var ZGt=x(ol=>{"use strict";var wEn=ol&&ol.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=ol&&ol.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SEn=ol&&ol.__importStar||function(t){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 xEn(e,t),e};Object.defineProperty(ol,"__esModule",{value:!0});ol.DeleteModelOut$=ol.DeleteModelOut$outboundSchema=ol.DeleteModelOut$inboundSchema=void 0;ol.deleteModelOutToJSON=OEn;ol.deleteModelOutFromJSON=EEn;var o1=SEn(Ie()),CEn=Ce();ol.DeleteModelOut$inboundSchema=o1.object({id:o1.string(),object:o1.string().default("model"),deleted:o1.boolean().default(!0)});ol.DeleteModelOut$outboundSchema=o1.object({id:o1.string(),object:o1.string().default("model"),deleted:o1.boolean().default(!0)});var JGt;(function(t){t.inboundSchema=ol.DeleteModelOut$inboundSchema,t.outboundSchema=ol.DeleteModelOut$outboundSchema})(JGt||(ol.DeleteModelOut$=JGt={}));function OEn(t){return JSON.stringify(ol.DeleteModelOut$outboundSchema.parse(t))}function EEn(t){return(0,CEn.safeParse)(t,e=>ol.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var u3e=x(il=>{"use strict";var PEn=il&&il.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TEn=il&&il.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AEn=il&&il.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PEn(e,t,r);return TEn(e,t),e};Object.defineProperty(il,"__esModule",{value:!0});il.EventOut$=il.EventOut$outboundSchema=il.EventOut$inboundSchema=void 0;il.eventOutToJSON=MEn;il.eventOutFromJSON=REn;var Gy=AEn(Ie()),XGt=Ke(),IEn=Ce();il.EventOut$inboundSchema=Gy.object({name:Gy.string(),data:Gy.nullable(Gy.record(Gy.any())).optional(),created_at:Gy.number().int()}).transform(t=>(0,XGt.remap)(t,{created_at:"createdAt"}));il.EventOut$outboundSchema=Gy.object({name:Gy.string(),data:Gy.nullable(Gy.record(Gy.any())).optional(),createdAt:Gy.number().int()}).transform(t=>(0,XGt.remap)(t,{createdAt:"created_at"}));var YGt;(function(t){t.inboundSchema=il.EventOut$inboundSchema,t.outboundSchema=il.EventOut$outboundSchema})(YGt||(il.EventOut$=YGt={}));function MEn(t){return JSON.stringify(il.EventOut$outboundSchema.parse(t))}function REn(t){return(0,IEn.safeParse)(t,e=>il.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var Zme=x(Yo=>{"use strict";var NEn=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]}),jEn=Yo&&Yo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DEn=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)&&NEn(e,t,r);return jEn(e,t),e};Object.defineProperty(Yo,"__esModule",{value:!0});Yo.GithubRepositoryOut$=Yo.GithubRepositoryOut$outboundSchema=Yo.GithubRepositoryOut$inboundSchema=Yo.GithubRepositoryOutType$=Yo.GithubRepositoryOutType$outboundSchema=Yo.GithubRepositoryOutType$inboundSchema=Yo.GithubRepositoryOutType=void 0;Yo.githubRepositoryOutToJSON=FEn;Yo.githubRepositoryOutFromJSON=kEn;var Zd=DEn(Ie()),tJt=Ke(),LEn=Ce();Yo.GithubRepositoryOutType={Github:"github"};Yo.GithubRepositoryOutType$inboundSchema=Zd.nativeEnum(Yo.GithubRepositoryOutType);Yo.GithubRepositoryOutType$outboundSchema=Yo.GithubRepositoryOutType$inboundSchema;var QGt;(function(t){t.inboundSchema=Yo.GithubRepositoryOutType$inboundSchema,t.outboundSchema=Yo.GithubRepositoryOutType$outboundSchema})(QGt||(Yo.GithubRepositoryOutType$=QGt={}));Yo.GithubRepositoryOut$inboundSchema=Zd.object({type:Zd.literal("github").default("github"),name:Zd.string(),owner:Zd.string(),ref:Zd.nullable(Zd.string()).optional(),weight:Zd.number().default(1),commit_id:Zd.string()}).transform(t=>(0,tJt.remap)(t,{commit_id:"commitId"}));Yo.GithubRepositoryOut$outboundSchema=Zd.object({type:Zd.literal("github").default("github"),name:Zd.string(),owner:Zd.string(),ref:Zd.nullable(Zd.string()).optional(),weight:Zd.number().default(1),commitId:Zd.string()}).transform(t=>(0,tJt.remap)(t,{commitId:"commit_id"}));var eJt;(function(t){t.inboundSchema=Yo.GithubRepositoryOut$inboundSchema,t.outboundSchema=Yo.GithubRepositoryOut$outboundSchema})(eJt||(Yo.GithubRepositoryOut$=eJt={}));function FEn(t){return JSON.stringify(Yo.GithubRepositoryOut$outboundSchema.parse(t))}function kEn(t){return(0,LEn.safeParse)(t,e=>Yo.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var Yme=x(al=>{"use strict";var $En=al&&al.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BEn=al&&al.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zEn=al&&al.__importStar||function(t){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 BEn(e,t),e};Object.defineProperty(al,"__esModule",{value:!0});al.JobMetadataOut$=al.JobMetadataOut$outboundSchema=al.JobMetadataOut$inboundSchema=void 0;al.jobMetadataOutToJSON=qEn;al.jobMetadataOutFromJSON=HEn;var Mi=zEn(Ie()),nJt=Ke(),UEn=Ce();al.JobMetadataOut$inboundSchema=Mi.object({expected_duration_seconds:Mi.nullable(Mi.number().int()).optional(),cost:Mi.nullable(Mi.number()).optional(),cost_currency:Mi.nullable(Mi.string()).optional(),train_tokens_per_step:Mi.nullable(Mi.number().int()).optional(),train_tokens:Mi.nullable(Mi.number().int()).optional(),data_tokens:Mi.nullable(Mi.number().int()).optional(),estimated_start_time:Mi.nullable(Mi.number().int()).optional()}).transform(t=>(0,nJt.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));al.JobMetadataOut$outboundSchema=Mi.object({expectedDurationSeconds:Mi.nullable(Mi.number().int()).optional(),cost:Mi.nullable(Mi.number()).optional(),costCurrency:Mi.nullable(Mi.string()).optional(),trainTokensPerStep:Mi.nullable(Mi.number().int()).optional(),trainTokens:Mi.nullable(Mi.number().int()).optional(),dataTokens:Mi.nullable(Mi.number().int()).optional(),estimatedStartTime:Mi.nullable(Mi.number().int()).optional()}).transform(t=>(0,nJt.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 rJt;(function(t){t.inboundSchema=al.JobMetadataOut$inboundSchema,t.outboundSchema=al.JobMetadataOut$outboundSchema})(rJt||(al.JobMetadataOut$=rJt={}));function qEn(t){return JSON.stringify(al.JobMetadataOut$outboundSchema.parse(t))}function HEn(t){return(0,UEn.safeParse)(t,e=>al.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var Xme=x(sl=>{"use strict";var VEn=sl&&sl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WEn=sl&&sl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KEn=sl&&sl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VEn(e,t,r);return WEn(e,t),e};Object.defineProperty(sl,"__esModule",{value:!0});sl.TrainingParameters$=sl.TrainingParameters$outboundSchema=sl.TrainingParameters$inboundSchema=void 0;sl.trainingParametersToJSON=JEn;sl.trainingParametersFromJSON=ZEn;var Zi=KEn(Ie()),iJt=Ke(),GEn=Ce();sl.TrainingParameters$inboundSchema=Zi.object({training_steps:Zi.nullable(Zi.number().int()).optional(),learning_rate:Zi.number().default(1e-4),weight_decay:Zi.nullable(Zi.number()).optional(),warmup_fraction:Zi.nullable(Zi.number()).optional(),epochs:Zi.nullable(Zi.number()).optional(),fim_ratio:Zi.nullable(Zi.number()).optional(),seq_len:Zi.nullable(Zi.number().int()).optional()}).transform(t=>(0,iJt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));sl.TrainingParameters$outboundSchema=Zi.object({trainingSteps:Zi.nullable(Zi.number().int()).optional(),learningRate:Zi.number().default(1e-4),weightDecay:Zi.nullable(Zi.number()).optional(),warmupFraction:Zi.nullable(Zi.number()).optional(),epochs:Zi.nullable(Zi.number()).optional(),fimRatio:Zi.nullable(Zi.number()).optional(),seqLen:Zi.nullable(Zi.number().int()).optional()}).transform(t=>(0,iJt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var oJt;(function(t){t.inboundSchema=sl.TrainingParameters$inboundSchema,t.outboundSchema=sl.TrainingParameters$outboundSchema})(oJt||(sl.TrainingParameters$=oJt={}));function JEn(t){return JSON.stringify(sl.TrainingParameters$outboundSchema.parse(t))}function ZEn(t){return(0,GEn.safeParse)(t,e=>sl.TrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParameters' from JSON")}});var Qme=x(Xo=>{"use strict";var YEn=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]}),XEn=Xo&&Xo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QEn=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)&&YEn(e,t,r);return XEn(e,t),e};Object.defineProperty(Xo,"__esModule",{value:!0});Xo.WandbIntegrationOut$=Xo.WandbIntegrationOut$outboundSchema=Xo.WandbIntegrationOut$inboundSchema=Xo.WandbIntegrationOutType$=Xo.WandbIntegrationOutType$outboundSchema=Xo.WandbIntegrationOutType$inboundSchema=Xo.WandbIntegrationOutType=void 0;Xo.wandbIntegrationOutToJSON=tPn;Xo.wandbIntegrationOutFromJSON=rPn;var Gp=QEn(Ie()),uJt=Ke(),ePn=Ce();Xo.WandbIntegrationOutType={Wandb:"wandb"};Xo.WandbIntegrationOutType$inboundSchema=Gp.nativeEnum(Xo.WandbIntegrationOutType);Xo.WandbIntegrationOutType$outboundSchema=Xo.WandbIntegrationOutType$inboundSchema;var aJt;(function(t){t.inboundSchema=Xo.WandbIntegrationOutType$inboundSchema,t.outboundSchema=Xo.WandbIntegrationOutType$outboundSchema})(aJt||(Xo.WandbIntegrationOutType$=aJt={}));Xo.WandbIntegrationOut$inboundSchema=Gp.object({type:Gp.literal("wandb").default("wandb"),project:Gp.string(),name:Gp.nullable(Gp.string()).optional(),run_name:Gp.nullable(Gp.string()).optional()}).transform(t=>(0,uJt.remap)(t,{run_name:"runName"}));Xo.WandbIntegrationOut$outboundSchema=Gp.object({type:Gp.literal("wandb").default("wandb"),project:Gp.string(),name:Gp.nullable(Gp.string()).optional(),runName:Gp.nullable(Gp.string()).optional()}).transform(t=>(0,uJt.remap)(t,{runName:"run_name"}));var sJt;(function(t){t.inboundSchema=Xo.WandbIntegrationOut$inboundSchema,t.outboundSchema=Xo.WandbIntegrationOut$outboundSchema})(sJt||(Xo.WandbIntegrationOut$=sJt={}));function tPn(t){return JSON.stringify(Xo.WandbIntegrationOut$outboundSchema.parse(t))}function rPn(t){return(0,ePn.safeParse)(t,e=>Xo.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var _Jt=x(vt=>{"use strict";var nPn=vt&&vt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oPn=vt&&vt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iPn=vt&&vt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nPn(e,t,r);return oPn(e,t),e};Object.defineProperty(vt,"__esModule",{value:!0});vt.DetailedJobOut$=vt.DetailedJobOut$outboundSchema=vt.DetailedJobOut$inboundSchema=vt.DetailedJobOutRepositories$=vt.DetailedJobOutRepositories$outboundSchema=vt.DetailedJobOutRepositories$inboundSchema=vt.DetailedJobOutIntegrations$=vt.DetailedJobOutIntegrations$outboundSchema=vt.DetailedJobOutIntegrations$inboundSchema=vt.DetailedJobOutObject$=vt.DetailedJobOutObject$outboundSchema=vt.DetailedJobOutObject$inboundSchema=vt.DetailedJobOutStatus$=vt.DetailedJobOutStatus$outboundSchema=vt.DetailedJobOutStatus$inboundSchema=vt.DetailedJobOutObject=vt.DetailedJobOutStatus=void 0;vt.detailedJobOutIntegrationsToJSON=aPn;vt.detailedJobOutIntegrationsFromJSON=sPn;vt.detailedJobOutRepositoriesToJSON=uPn;vt.detailedJobOutRepositoriesFromJSON=lPn;vt.detailedJobOutToJSON=cPn;vt.detailedJobOutFromJSON=dPn;var br=iPn(Ie()),mJt=Ke(),l3e=Ce(),hJt=n3e(),gJt=u3e(),ehe=Zme(),yJt=Yme(),bJt=Xme(),the=Qme();vt.DetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};vt.DetailedJobOutObject={Job:"job"};vt.DetailedJobOutStatus$inboundSchema=br.nativeEnum(vt.DetailedJobOutStatus);vt.DetailedJobOutStatus$outboundSchema=vt.DetailedJobOutStatus$inboundSchema;var lJt;(function(t){t.inboundSchema=vt.DetailedJobOutStatus$inboundSchema,t.outboundSchema=vt.DetailedJobOutStatus$outboundSchema})(lJt||(vt.DetailedJobOutStatus$=lJt={}));vt.DetailedJobOutObject$inboundSchema=br.nativeEnum(vt.DetailedJobOutObject);vt.DetailedJobOutObject$outboundSchema=vt.DetailedJobOutObject$inboundSchema;var cJt;(function(t){t.inboundSchema=vt.DetailedJobOutObject$inboundSchema,t.outboundSchema=vt.DetailedJobOutObject$outboundSchema})(cJt||(vt.DetailedJobOutObject$=cJt={}));vt.DetailedJobOutIntegrations$inboundSchema=the.WandbIntegrationOut$inboundSchema;vt.DetailedJobOutIntegrations$outboundSchema=the.WandbIntegrationOut$outboundSchema;var dJt;(function(t){t.inboundSchema=vt.DetailedJobOutIntegrations$inboundSchema,t.outboundSchema=vt.DetailedJobOutIntegrations$outboundSchema})(dJt||(vt.DetailedJobOutIntegrations$=dJt={}));function aPn(t){return JSON.stringify(vt.DetailedJobOutIntegrations$outboundSchema.parse(t))}function sPn(t){return(0,l3e.safeParse)(t,e=>vt.DetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutIntegrations' from JSON")}vt.DetailedJobOutRepositories$inboundSchema=ehe.GithubRepositoryOut$inboundSchema;vt.DetailedJobOutRepositories$outboundSchema=ehe.GithubRepositoryOut$outboundSchema;var fJt;(function(t){t.inboundSchema=vt.DetailedJobOutRepositories$inboundSchema,t.outboundSchema=vt.DetailedJobOutRepositories$outboundSchema})(fJt||(vt.DetailedJobOutRepositories$=fJt={}));function uPn(t){return JSON.stringify(vt.DetailedJobOutRepositories$outboundSchema.parse(t))}function lPn(t){return(0,l3e.safeParse)(t,e=>vt.DetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutRepositories' from JSON")}vt.DetailedJobOut$inboundSchema=br.object({id:br.string(),auto_start:br.boolean(),hyperparameters:bJt.TrainingParameters$inboundSchema,model:br.string(),status:vt.DetailedJobOutStatus$inboundSchema,job_type:br.string(),created_at:br.number().int(),modified_at:br.number().int(),training_files:br.array(br.string()),validation_files:br.nullable(br.array(br.string())).optional(),object:br.literal("job").default("job"),fine_tuned_model:br.nullable(br.string()).optional(),suffix:br.nullable(br.string()).optional(),integrations:br.nullable(br.array(the.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:br.nullable(br.number().int()).optional(),repositories:br.array(ehe.GithubRepositoryOut$inboundSchema).optional(),metadata:br.nullable(yJt.JobMetadataOut$inboundSchema).optional(),events:br.array(gJt.EventOut$inboundSchema).optional(),checkpoints:br.array(hJt.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,mJt.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"}));vt.DetailedJobOut$outboundSchema=br.object({id:br.string(),autoStart:br.boolean(),hyperparameters:bJt.TrainingParameters$outboundSchema,model:br.string(),status:vt.DetailedJobOutStatus$outboundSchema,jobType:br.string(),createdAt:br.number().int(),modifiedAt:br.number().int(),trainingFiles:br.array(br.string()),validationFiles:br.nullable(br.array(br.string())).optional(),object:br.literal("job").default("job"),fineTunedModel:br.nullable(br.string()).optional(),suffix:br.nullable(br.string()).optional(),integrations:br.nullable(br.array(the.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:br.nullable(br.number().int()).optional(),repositories:br.array(ehe.GithubRepositoryOut$outboundSchema).optional(),metadata:br.nullable(yJt.JobMetadataOut$outboundSchema).optional(),events:br.array(gJt.EventOut$outboundSchema).optional(),checkpoints:br.array(hJt.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,mJt.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 pJt;(function(t){t.inboundSchema=vt.DetailedJobOut$inboundSchema,t.outboundSchema=vt.DetailedJobOut$outboundSchema})(pJt||(vt.DetailedJobOut$=pJt={}));function cPn(t){return JSON.stringify(vt.DetailedJobOut$outboundSchema.parse(t))}function dPn(t){return(0,l3e.safeParse)(t,e=>vt.DetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOut' from JSON")}});var CJt=x(Qo=>{"use strict";var fPn=Qo&&Qo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pPn=Qo&&Qo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mPn=Qo&&Qo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fPn(e,t,r);return pPn(e,t),e};Object.defineProperty(Qo,"__esModule",{value:!0});Qo.EmbeddingRequest$=Qo.EmbeddingRequest$outboundSchema=Qo.EmbeddingRequest$inboundSchema=Qo.Inputs$=Qo.Inputs$outboundSchema=Qo.Inputs$inboundSchema=void 0;Qo.inputsToJSON=hPn;Qo.inputsFromJSON=gPn;Qo.embeddingRequestToJSON=yPn;Qo.embeddingRequestFromJSON=bPn;var Ja=mPn(Ie()),xJt=Ke(),SJt=Ce();Qo.Inputs$inboundSchema=Ja.union([Ja.string(),Ja.array(Ja.string())]);Qo.Inputs$outboundSchema=Ja.union([Ja.string(),Ja.array(Ja.string())]);var vJt;(function(t){t.inboundSchema=Qo.Inputs$inboundSchema,t.outboundSchema=Qo.Inputs$outboundSchema})(vJt||(Qo.Inputs$=vJt={}));function hPn(t){return JSON.stringify(Qo.Inputs$outboundSchema.parse(t))}function gPn(t){return(0,SJt.safeParse)(t,e=>Qo.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}Qo.EmbeddingRequest$inboundSchema=Ja.object({input:Ja.union([Ja.string(),Ja.array(Ja.string())]),model:Ja.string().default("mistral-embed"),encoding_format:Ja.nullable(Ja.string()).optional()}).transform(t=>(0,xJt.remap)(t,{input:"inputs",encoding_format:"encodingFormat"}));Qo.EmbeddingRequest$outboundSchema=Ja.object({inputs:Ja.union([Ja.string(),Ja.array(Ja.string())]),model:Ja.string().default("mistral-embed"),encodingFormat:Ja.nullable(Ja.string()).optional()}).transform(t=>(0,xJt.remap)(t,{inputs:"input",encodingFormat:"encoding_format"}));var wJt;(function(t){t.inboundSchema=Qo.EmbeddingRequest$inboundSchema,t.outboundSchema=Qo.EmbeddingRequest$outboundSchema})(wJt||(Qo.EmbeddingRequest$=wJt={}));function yPn(t){return JSON.stringify(Qo.EmbeddingRequest$outboundSchema.parse(t))}function bPn(t){return(0,SJt.safeParse)(t,e=>Qo.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var c3e=x(ul=>{"use strict";var _Pn=ul&&ul.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vPn=ul&&ul.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wPn=ul&&ul.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Pn(e,t,r);return vPn(e,t),e};Object.defineProperty(ul,"__esModule",{value:!0});ul.EmbeddingResponseData$=ul.EmbeddingResponseData$outboundSchema=ul.EmbeddingResponseData$inboundSchema=void 0;ul.embeddingResponseDataToJSON=SPn;ul.embeddingResponseDataFromJSON=CPn;var PO=wPn(Ie()),xPn=Ce();ul.EmbeddingResponseData$inboundSchema=PO.object({object:PO.string().optional(),embedding:PO.array(PO.number()).optional(),index:PO.number().int().optional()});ul.EmbeddingResponseData$outboundSchema=PO.object({object:PO.string().optional(),embedding:PO.array(PO.number()).optional(),index:PO.number().int().optional()});var OJt;(function(t){t.inboundSchema=ul.EmbeddingResponseData$inboundSchema,t.outboundSchema=ul.EmbeddingResponseData$outboundSchema})(OJt||(ul.EmbeddingResponseData$=OJt={}));function SPn(t){return JSON.stringify(ul.EmbeddingResponseData$outboundSchema.parse(t))}function CPn(t){return(0,xPn.safeParse)(t,e=>ul.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var AJt=x(ll=>{"use strict";var OPn=ll&&ll.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EPn=ll&&ll.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PPn=ll&&ll.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OPn(e,t,r);return EPn(e,t),e};Object.defineProperty(ll,"__esModule",{value:!0});ll.EmbeddingResponse$=ll.EmbeddingResponse$outboundSchema=ll.EmbeddingResponse$inboundSchema=void 0;ll.embeddingResponseToJSON=APn;ll.embeddingResponseFromJSON=IPn;var TO=PPn(Ie()),TPn=Ce(),PJt=c3e(),TJt=G3();ll.EmbeddingResponse$inboundSchema=TO.object({id:TO.string(),object:TO.string(),model:TO.string(),usage:TJt.UsageInfo$inboundSchema,data:TO.array(PJt.EmbeddingResponseData$inboundSchema)});ll.EmbeddingResponse$outboundSchema=TO.object({id:TO.string(),object:TO.string(),model:TO.string(),usage:TJt.UsageInfo$outboundSchema,data:TO.array(PJt.EmbeddingResponseData$outboundSchema)});var EJt;(function(t){t.inboundSchema=ll.EmbeddingResponse$inboundSchema,t.outboundSchema=ll.EmbeddingResponse$outboundSchema})(EJt||(ll.EmbeddingResponse$=EJt={}));function APn(t){return JSON.stringify(ll.EmbeddingResponse$outboundSchema.parse(t))}function IPn(t){return(0,TPn.safeParse)(t,e=>ll.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var MJ=x(cl=>{"use strict";var MPn=cl&&cl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RPn=cl&&cl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NPn=cl&&cl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MPn(e,t,r);return RPn(e,t),e};Object.defineProperty(cl,"__esModule",{value:!0});cl.FilePurpose$=cl.FilePurpose$outboundSchema=cl.FilePurpose$inboundSchema=cl.FilePurpose=void 0;var Ak=NPn(Ie()),jPn=QR();cl.FilePurpose={FineTune:"fine-tune",Batch:"batch"};cl.FilePurpose$inboundSchema=Ak.union([Ak.nativeEnum(cl.FilePurpose),Ak.string().transform(jPn.catchUnrecognizedEnum)]);cl.FilePurpose$outboundSchema=Ak.union([Ak.nativeEnum(cl.FilePurpose),Ak.string().and(Ak.custom())]);var IJt;(function(t){t.inboundSchema=cl.FilePurpose$inboundSchema,t.outboundSchema=cl.FilePurpose$outboundSchema})(IJt||(cl.FilePurpose$=IJt={}))});var RJ=x(dl=>{"use strict";var DPn=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]}),LPn=dl&&dl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FPn=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)&&DPn(e,t,r);return LPn(e,t),e};Object.defineProperty(dl,"__esModule",{value:!0});dl.SampleType$=dl.SampleType$outboundSchema=dl.SampleType$inboundSchema=dl.SampleType=void 0;var Ik=FPn(Ie()),kPn=QR();dl.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};dl.SampleType$inboundSchema=Ik.union([Ik.nativeEnum(dl.SampleType),Ik.string().transform(kPn.catchUnrecognizedEnum)]);dl.SampleType$outboundSchema=Ik.union([Ik.nativeEnum(dl.SampleType),Ik.string().and(Ik.custom())]);var MJt;(function(t){t.inboundSchema=dl.SampleType$inboundSchema,t.outboundSchema=dl.SampleType$outboundSchema})(MJt||(dl.SampleType$=MJt={}))});var NJ=x(fl=>{"use strict";var $Pn=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]}),BPn=fl&&fl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zPn=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)&&$Pn(e,t,r);return BPn(e,t),e};Object.defineProperty(fl,"__esModule",{value:!0});fl.Source$=fl.Source$outboundSchema=fl.Source$inboundSchema=fl.Source=void 0;var Mk=zPn(Ie()),UPn=QR();fl.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};fl.Source$inboundSchema=Mk.union([Mk.nativeEnum(fl.Source),Mk.string().transform(UPn.catchUnrecognizedEnum)]);fl.Source$outboundSchema=Mk.union([Mk.nativeEnum(fl.Source),Mk.string().and(Mk.custom())]);var RJt;(function(t){t.inboundSchema=fl.Source$inboundSchema,t.outboundSchema=fl.Source$outboundSchema})(RJt||(fl.Source$=RJt={}))});var d3e=x(pl=>{"use strict";var qPn=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]}),HPn=pl&&pl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VPn=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)&&qPn(e,t,r);return HPn(e,t),e};Object.defineProperty(pl,"__esModule",{value:!0});pl.FileSchema$=pl.FileSchema$outboundSchema=pl.FileSchema$inboundSchema=void 0;pl.fileSchemaToJSON=KPn;pl.fileSchemaFromJSON=GPn;var np=VPn(Ie()),jJt=Ke(),WPn=Ce(),DJt=MJ(),LJt=RJ(),FJt=NJ();pl.FileSchema$inboundSchema=np.object({id:np.string(),object:np.string(),bytes:np.number().int(),created_at:np.number().int(),filename:np.string(),purpose:DJt.FilePurpose$inboundSchema,sample_type:LJt.SampleType$inboundSchema,num_lines:np.nullable(np.number().int()).optional(),source:FJt.Source$inboundSchema}).transform(t=>(0,jJt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));pl.FileSchema$outboundSchema=np.object({id:np.string(),object:np.string(),sizeBytes:np.number().int(),createdAt:np.number().int(),filename:np.string(),purpose:DJt.FilePurpose$outboundSchema,sampleType:LJt.SampleType$outboundSchema,numLines:np.nullable(np.number().int()).optional(),source:FJt.Source$outboundSchema}).transform(t=>(0,jJt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var NJt;(function(t){t.inboundSchema=pl.FileSchema$inboundSchema,t.outboundSchema=pl.FileSchema$outboundSchema})(NJt||(pl.FileSchema$=NJt={}));function KPn(t){return JSON.stringify(pl.FileSchema$outboundSchema.parse(t))}function GPn(t){return(0,WPn.safeParse)(t,e=>pl.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var $Jt=x(ml=>{"use strict";var JPn=ml&&ml.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZPn=ml&&ml.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YPn=ml&&ml.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JPn(e,t,r);return ZPn(e,t),e};Object.defineProperty(ml,"__esModule",{value:!0});ml.FileSignedURL$=ml.FileSignedURL$outboundSchema=ml.FileSignedURL$inboundSchema=void 0;ml.fileSignedURLToJSON=QPn;ml.fileSignedURLFromJSON=eTn;var rhe=YPn(Ie()),XPn=Ce();ml.FileSignedURL$inboundSchema=rhe.object({url:rhe.string()});ml.FileSignedURL$outboundSchema=rhe.object({url:rhe.string()});var kJt;(function(t){t.inboundSchema=ml.FileSignedURL$inboundSchema,t.outboundSchema=ml.FileSignedURL$outboundSchema})(kJt||(ml.FileSignedURL$=kJt={}));function QPn(t){return JSON.stringify(ml.FileSignedURL$outboundSchema.parse(t))}function eTn(t){return(0,XPn.safeParse)(t,e=>ml.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var HJt=x(ei=>{"use strict";var tTn=ei&&ei.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rTn=ei&&ei.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nTn=ei&&ei.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tTn(e,t,r);return rTn(e,t),e};Object.defineProperty(ei,"__esModule",{value:!0});ei.FIMCompletionRequest$=ei.FIMCompletionRequest$outboundSchema=ei.FIMCompletionRequest$inboundSchema=ei.FIMCompletionRequestStop$=ei.FIMCompletionRequestStop$outboundSchema=ei.FIMCompletionRequestStop$inboundSchema=void 0;ei.fimCompletionRequestStopToJSON=oTn;ei.fimCompletionRequestStopFromJSON=iTn;ei.fimCompletionRequestToJSON=aTn;ei.fimCompletionRequestFromJSON=sTn;var Lr=nTn(Ie()),UJt=Ke(),qJt=Ce();ei.FIMCompletionRequestStop$inboundSchema=Lr.union([Lr.string(),Lr.array(Lr.string())]);ei.FIMCompletionRequestStop$outboundSchema=Lr.union([Lr.string(),Lr.array(Lr.string())]);var BJt;(function(t){t.inboundSchema=ei.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=ei.FIMCompletionRequestStop$outboundSchema})(BJt||(ei.FIMCompletionRequestStop$=BJt={}));function oTn(t){return JSON.stringify(ei.FIMCompletionRequestStop$outboundSchema.parse(t))}function iTn(t){return(0,qJt.safeParse)(t,e=>ei.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}ei.FIMCompletionRequest$inboundSchema=Lr.object({model:Lr.nullable(Lr.string()),temperature:Lr.nullable(Lr.number()).optional(),top_p:Lr.number().default(1),max_tokens:Lr.nullable(Lr.number().int()).optional(),stream:Lr.boolean().default(!1),stop:Lr.union([Lr.string(),Lr.array(Lr.string())]).optional(),random_seed:Lr.nullable(Lr.number().int()).optional(),prompt:Lr.string(),suffix:Lr.nullable(Lr.string()).optional(),min_tokens:Lr.nullable(Lr.number().int()).optional()}).transform(t=>(0,UJt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));ei.FIMCompletionRequest$outboundSchema=Lr.object({model:Lr.nullable(Lr.string()),temperature:Lr.nullable(Lr.number()).optional(),topP:Lr.number().default(1),maxTokens:Lr.nullable(Lr.number().int()).optional(),stream:Lr.boolean().default(!1),stop:Lr.union([Lr.string(),Lr.array(Lr.string())]).optional(),randomSeed:Lr.nullable(Lr.number().int()).optional(),prompt:Lr.string(),suffix:Lr.nullable(Lr.string()).optional(),minTokens:Lr.nullable(Lr.number().int()).optional()}).transform(t=>(0,UJt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var zJt;(function(t){t.inboundSchema=ei.FIMCompletionRequest$inboundSchema,t.outboundSchema=ei.FIMCompletionRequest$outboundSchema})(zJt||(ei.FIMCompletionRequest$=zJt={}));function aTn(t){return JSON.stringify(ei.FIMCompletionRequest$outboundSchema.parse(t))}function sTn(t){return(0,qJt.safeParse)(t,e=>ei.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var GJt=x(hl=>{"use strict";var uTn=hl&&hl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lTn=hl&&hl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cTn=hl&&hl.__importStar||function(t){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 lTn(e,t),e};Object.defineProperty(hl,"__esModule",{value:!0});hl.FIMCompletionResponse$=hl.FIMCompletionResponse$outboundSchema=hl.FIMCompletionResponse$inboundSchema=void 0;hl.fimCompletionResponseToJSON=fTn;hl.fimCompletionResponseFromJSON=pTn;var Jy=cTn(Ie()),dTn=Ce(),WJt=jme(),KJt=G3();hl.FIMCompletionResponse$inboundSchema=Jy.object({id:Jy.string(),object:Jy.string(),model:Jy.string(),usage:KJt.UsageInfo$inboundSchema,created:Jy.number().int().optional(),choices:Jy.array(WJt.ChatCompletionChoice$inboundSchema).optional()});hl.FIMCompletionResponse$outboundSchema=Jy.object({id:Jy.string(),object:Jy.string(),model:Jy.string(),usage:KJt.UsageInfo$outboundSchema,created:Jy.number().int().optional(),choices:Jy.array(WJt.ChatCompletionChoice$outboundSchema).optional()});var VJt;(function(t){t.inboundSchema=hl.FIMCompletionResponse$inboundSchema,t.outboundSchema=hl.FIMCompletionResponse$outboundSchema})(VJt||(hl.FIMCompletionResponse$=VJt={}));function fTn(t){return JSON.stringify(hl.FIMCompletionResponse$outboundSchema.parse(t))}function pTn(t){return(0,dTn.safeParse)(t,e=>hl.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var QJt=x(ti=>{"use strict";var mTn=ti&&ti.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hTn=ti&&ti.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gTn=ti&&ti.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mTn(e,t,r);return hTn(e,t),e};Object.defineProperty(ti,"__esModule",{value:!0});ti.FIMCompletionStreamRequest$=ti.FIMCompletionStreamRequest$outboundSchema=ti.FIMCompletionStreamRequest$inboundSchema=ti.FIMCompletionStreamRequestStop$=ti.FIMCompletionStreamRequestStop$outboundSchema=ti.FIMCompletionStreamRequestStop$inboundSchema=void 0;ti.fimCompletionStreamRequestStopToJSON=yTn;ti.fimCompletionStreamRequestStopFromJSON=bTn;ti.fimCompletionStreamRequestToJSON=_Tn;ti.fimCompletionStreamRequestFromJSON=vTn;var Fr=gTn(Ie()),YJt=Ke(),XJt=Ce();ti.FIMCompletionStreamRequestStop$inboundSchema=Fr.union([Fr.string(),Fr.array(Fr.string())]);ti.FIMCompletionStreamRequestStop$outboundSchema=Fr.union([Fr.string(),Fr.array(Fr.string())]);var JJt;(function(t){t.inboundSchema=ti.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=ti.FIMCompletionStreamRequestStop$outboundSchema})(JJt||(ti.FIMCompletionStreamRequestStop$=JJt={}));function yTn(t){return JSON.stringify(ti.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function bTn(t){return(0,XJt.safeParse)(t,e=>ti.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}ti.FIMCompletionStreamRequest$inboundSchema=Fr.object({model:Fr.nullable(Fr.string()),temperature:Fr.nullable(Fr.number()).optional(),top_p:Fr.number().default(1),max_tokens:Fr.nullable(Fr.number().int()).optional(),stream:Fr.boolean().default(!0),stop:Fr.union([Fr.string(),Fr.array(Fr.string())]).optional(),random_seed:Fr.nullable(Fr.number().int()).optional(),prompt:Fr.string(),suffix:Fr.nullable(Fr.string()).optional(),min_tokens:Fr.nullable(Fr.number().int()).optional()}).transform(t=>(0,YJt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));ti.FIMCompletionStreamRequest$outboundSchema=Fr.object({model:Fr.nullable(Fr.string()),temperature:Fr.nullable(Fr.number()).optional(),topP:Fr.number().default(1),maxTokens:Fr.nullable(Fr.number().int()).optional(),stream:Fr.boolean().default(!0),stop:Fr.union([Fr.string(),Fr.array(Fr.string())]).optional(),randomSeed:Fr.nullable(Fr.number().int()).optional(),prompt:Fr.string(),suffix:Fr.nullable(Fr.string()).optional(),minTokens:Fr.nullable(Fr.number().int()).optional()}).transform(t=>(0,YJt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var ZJt;(function(t){t.inboundSchema=ti.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=ti.FIMCompletionStreamRequest$outboundSchema})(ZJt||(ti.FIMCompletionStreamRequest$=ZJt={}));function _Tn(t){return JSON.stringify(ti.FIMCompletionStreamRequest$outboundSchema.parse(t))}function vTn(t){return(0,XJt.safeParse)(t,e=>ti.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var f3e=x(gl=>{"use strict";var wTn=gl&&gl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xTn=gl&&gl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),STn=gl&&gl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wTn(e,t,r);return xTn(e,t),e};Object.defineProperty(gl,"__esModule",{value:!0});gl.FTModelCapabilitiesOut$=gl.FTModelCapabilitiesOut$outboundSchema=gl.FTModelCapabilitiesOut$inboundSchema=void 0;gl.ftModelCapabilitiesOutToJSON=OTn;gl.ftModelCapabilitiesOutFromJSON=ETn;var AO=STn(Ie()),t7t=Ke(),CTn=Ce();gl.FTModelCapabilitiesOut$inboundSchema=AO.object({completion_chat:AO.boolean().default(!0),completion_fim:AO.boolean().default(!1),function_calling:AO.boolean().default(!1),fine_tuning:AO.boolean().default(!1)}).transform(t=>(0,t7t.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));gl.FTModelCapabilitiesOut$outboundSchema=AO.object({completionChat:AO.boolean().default(!0),completionFim:AO.boolean().default(!1),functionCalling:AO.boolean().default(!1),fineTuning:AO.boolean().default(!1)}).transform(t=>(0,t7t.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var e7t;(function(t){t.inboundSchema=gl.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=gl.FTModelCapabilitiesOut$outboundSchema})(e7t||(gl.FTModelCapabilitiesOut$=e7t={}));function OTn(t){return JSON.stringify(gl.FTModelCapabilitiesOut$outboundSchema.parse(t))}function ETn(t){return(0,CTn.safeParse)(t,e=>gl.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var p3e=x(ri=>{"use strict";var PTn=ri&&ri.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TTn=ri&&ri.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ATn=ri&&ri.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PTn(e,t,r);return TTn(e,t),e};Object.defineProperty(ri,"__esModule",{value:!0});ri.FTModelCard$=ri.FTModelCard$outboundSchema=ri.FTModelCard$inboundSchema=ri.FTModelCardType$=ri.FTModelCardType$outboundSchema=ri.FTModelCardType$inboundSchema=ri.FTModelCardType=void 0;ri.ftModelCardToJSON=MTn;ri.ftModelCardFromJSON=RTn;var On=ATn(Ie()),o7t=Ke(),ITn=Ce(),i7t=Rme();ri.FTModelCardType={FineTuned:"fine-tuned"};ri.FTModelCardType$inboundSchema=On.nativeEnum(ri.FTModelCardType);ri.FTModelCardType$outboundSchema=ri.FTModelCardType$inboundSchema;var r7t;(function(t){t.inboundSchema=ri.FTModelCardType$inboundSchema,t.outboundSchema=ri.FTModelCardType$outboundSchema})(r7t||(ri.FTModelCardType$=r7t={}));ri.FTModelCard$inboundSchema=On.object({id:On.string(),object:On.string().default("model"),created:On.number().int().optional(),owned_by:On.string().default("mistralai"),capabilities:i7t.ModelCapabilities$inboundSchema,name:On.nullable(On.string()).optional(),description:On.nullable(On.string()).optional(),max_context_length:On.number().int().default(32768),aliases:On.array(On.string()).optional(),deprecation:On.nullable(On.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:On.nullable(On.number()).optional(),type:On.literal("fine-tuned").default("fine-tuned"),job:On.string(),root:On.string(),archived:On.boolean().default(!1)}).transform(t=>(0,o7t.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));ri.FTModelCard$outboundSchema=On.object({id:On.string(),object:On.string().default("model"),created:On.number().int().optional(),ownedBy:On.string().default("mistralai"),capabilities:i7t.ModelCapabilities$outboundSchema,name:On.nullable(On.string()).optional(),description:On.nullable(On.string()).optional(),maxContextLength:On.number().int().default(32768),aliases:On.array(On.string()).optional(),deprecation:On.nullable(On.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:On.nullable(On.number()).optional(),type:On.literal("fine-tuned").default("fine-tuned"),job:On.string(),root:On.string(),archived:On.boolean().default(!1)}).transform(t=>(0,o7t.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var n7t;(function(t){t.inboundSchema=ri.FTModelCard$inboundSchema,t.outboundSchema=ri.FTModelCard$outboundSchema})(n7t||(ri.FTModelCard$=n7t={}));function MTn(t){return JSON.stringify(ri.FTModelCard$outboundSchema.parse(t))}function RTn(t){return(0,ITn.safeParse)(t,e=>ri.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var c7t=x(ni=>{"use strict";var NTn=ni&&ni.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=ni&&ni.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DTn=ni&&ni.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NTn(e,t,r);return jTn(e,t),e};Object.defineProperty(ni,"__esModule",{value:!0});ni.FTModelOut$=ni.FTModelOut$outboundSchema=ni.FTModelOut$inboundSchema=ni.FTModelOutObject$=ni.FTModelOutObject$outboundSchema=ni.FTModelOutObject$inboundSchema=ni.FTModelOutObject=void 0;ni.ftModelOutToJSON=FTn;ni.ftModelOutFromJSON=kTn;var Ci=DTn(Ie()),u7t=Ke(),LTn=Ce(),l7t=f3e();ni.FTModelOutObject={Model:"model"};ni.FTModelOutObject$inboundSchema=Ci.nativeEnum(ni.FTModelOutObject);ni.FTModelOutObject$outboundSchema=ni.FTModelOutObject$inboundSchema;var a7t;(function(t){t.inboundSchema=ni.FTModelOutObject$inboundSchema,t.outboundSchema=ni.FTModelOutObject$outboundSchema})(a7t||(ni.FTModelOutObject$=a7t={}));ni.FTModelOut$inboundSchema=Ci.object({id:Ci.string(),object:Ci.literal("model").default("model"),created:Ci.number().int(),owned_by:Ci.string(),root:Ci.string(),archived:Ci.boolean(),name:Ci.nullable(Ci.string()).optional(),description:Ci.nullable(Ci.string()).optional(),capabilities:l7t.FTModelCapabilitiesOut$inboundSchema,max_context_length:Ci.number().int().default(32768),aliases:Ci.array(Ci.string()).optional(),job:Ci.string()}).transform(t=>(0,u7t.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength"}));ni.FTModelOut$outboundSchema=Ci.object({id:Ci.string(),object:Ci.literal("model").default("model"),created:Ci.number().int(),ownedBy:Ci.string(),root:Ci.string(),archived:Ci.boolean(),name:Ci.nullable(Ci.string()).optional(),description:Ci.nullable(Ci.string()).optional(),capabilities:l7t.FTModelCapabilitiesOut$outboundSchema,maxContextLength:Ci.number().int().default(32768),aliases:Ci.array(Ci.string()).optional(),job:Ci.string()}).transform(t=>(0,u7t.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length"}));var s7t;(function(t){t.inboundSchema=ni.FTModelOut$inboundSchema,t.outboundSchema=ni.FTModelOut$outboundSchema})(s7t||(ni.FTModelOut$=s7t={}));function FTn(t){return JSON.stringify(ni.FTModelOut$outboundSchema.parse(t))}function kTn(t){return(0,LTn.safeParse)(t,e=>ni.FTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelOut' from JSON")}});var m3e=x(oi=>{"use strict";var $Tn=oi&&oi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BTn=oi&&oi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zTn=oi&&oi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Tn(e,t,r);return BTn(e,t),e};Object.defineProperty(oi,"__esModule",{value:!0});oi.GithubRepositoryIn$=oi.GithubRepositoryIn$outboundSchema=oi.GithubRepositoryIn$inboundSchema=oi.GithubRepositoryInType$=oi.GithubRepositoryInType$outboundSchema=oi.GithubRepositoryInType$inboundSchema=oi.GithubRepositoryInType=void 0;oi.githubRepositoryInToJSON=qTn;oi.githubRepositoryInFromJSON=HTn;var Yd=zTn(Ie()),UTn=Ce();oi.GithubRepositoryInType={Github:"github"};oi.GithubRepositoryInType$inboundSchema=Yd.nativeEnum(oi.GithubRepositoryInType);oi.GithubRepositoryInType$outboundSchema=oi.GithubRepositoryInType$inboundSchema;var d7t;(function(t){t.inboundSchema=oi.GithubRepositoryInType$inboundSchema,t.outboundSchema=oi.GithubRepositoryInType$outboundSchema})(d7t||(oi.GithubRepositoryInType$=d7t={}));oi.GithubRepositoryIn$inboundSchema=Yd.object({type:Yd.literal("github").default("github"),name:Yd.string(),owner:Yd.string(),ref:Yd.nullable(Yd.string()).optional(),weight:Yd.number().default(1),token:Yd.string()});oi.GithubRepositoryIn$outboundSchema=Yd.object({type:Yd.literal("github").default("github"),name:Yd.string(),owner:Yd.string(),ref:Yd.nullable(Yd.string()).optional(),weight:Yd.number().default(1),token:Yd.string()});var f7t;(function(t){t.inboundSchema=oi.GithubRepositoryIn$inboundSchema,t.outboundSchema=oi.GithubRepositoryIn$outboundSchema})(f7t||(oi.GithubRepositoryIn$=f7t={}));function qTn(t){return JSON.stringify(oi.GithubRepositoryIn$outboundSchema.parse(t))}function HTn(t){return(0,UTn.safeParse)(t,e=>oi.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var h3e=x(yl=>{"use strict";var VTn=yl&&yl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WTn=yl&&yl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KTn=yl&&yl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VTn(e,t,r);return WTn(e,t),e};Object.defineProperty(yl,"__esModule",{value:!0});yl.TrainingFile$=yl.TrainingFile$outboundSchema=yl.TrainingFile$inboundSchema=void 0;yl.trainingFileToJSON=JTn;yl.trainingFileFromJSON=ZTn;var Z3=KTn(Ie()),m7t=Ke(),GTn=Ce();yl.TrainingFile$inboundSchema=Z3.object({file_id:Z3.string(),weight:Z3.number().default(1)}).transform(t=>(0,m7t.remap)(t,{file_id:"fileId"}));yl.TrainingFile$outboundSchema=Z3.object({fileId:Z3.string(),weight:Z3.number().default(1)}).transform(t=>(0,m7t.remap)(t,{fileId:"file_id"}));var p7t;(function(t){t.inboundSchema=yl.TrainingFile$inboundSchema,t.outboundSchema=yl.TrainingFile$outboundSchema})(p7t||(yl.TrainingFile$=p7t={}));function JTn(t){return JSON.stringify(yl.TrainingFile$outboundSchema.parse(t))}function ZTn(t){return(0,GTn.safeParse)(t,e=>yl.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var g3e=x(bl=>{"use strict";var YTn=bl&&bl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XTn=bl&&bl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QTn=bl&&bl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YTn(e,t,r);return XTn(e,t),e};Object.defineProperty(bl,"__esModule",{value:!0});bl.TrainingParametersIn$=bl.TrainingParametersIn$outboundSchema=bl.TrainingParametersIn$inboundSchema=void 0;bl.trainingParametersInToJSON=tAn;bl.trainingParametersInFromJSON=rAn;var Yi=QTn(Ie()),g7t=Ke(),eAn=Ce();bl.TrainingParametersIn$inboundSchema=Yi.object({training_steps:Yi.nullable(Yi.number().int()).optional(),learning_rate:Yi.number().default(1e-4),weight_decay:Yi.nullable(Yi.number()).optional(),warmup_fraction:Yi.nullable(Yi.number()).optional(),epochs:Yi.nullable(Yi.number()).optional(),fim_ratio:Yi.nullable(Yi.number()).optional(),seq_len:Yi.nullable(Yi.number().int()).optional()}).transform(t=>(0,g7t.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));bl.TrainingParametersIn$outboundSchema=Yi.object({trainingSteps:Yi.nullable(Yi.number().int()).optional(),learningRate:Yi.number().default(1e-4),weightDecay:Yi.nullable(Yi.number()).optional(),warmupFraction:Yi.nullable(Yi.number()).optional(),epochs:Yi.nullable(Yi.number()).optional(),fimRatio:Yi.nullable(Yi.number()).optional(),seqLen:Yi.nullable(Yi.number().int()).optional()}).transform(t=>(0,g7t.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var h7t;(function(t){t.inboundSchema=bl.TrainingParametersIn$inboundSchema,t.outboundSchema=bl.TrainingParametersIn$outboundSchema})(h7t||(bl.TrainingParametersIn$=h7t={}));function tAn(t){return JSON.stringify(bl.TrainingParametersIn$outboundSchema.parse(t))}function rAn(t){return(0,eAn.safeParse)(t,e=>bl.TrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParametersIn' from JSON")}});var y3e=x(ii=>{"use strict";var nAn=ii&&ii.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oAn=ii&&ii.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iAn=ii&&ii.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nAn(e,t,r);return oAn(e,t),e};Object.defineProperty(ii,"__esModule",{value:!0});ii.WandbIntegration$=ii.WandbIntegration$outboundSchema=ii.WandbIntegration$inboundSchema=ii.WandbIntegrationType$=ii.WandbIntegrationType$outboundSchema=ii.WandbIntegrationType$inboundSchema=ii.WandbIntegrationType=void 0;ii.wandbIntegrationToJSON=sAn;ii.wandbIntegrationFromJSON=uAn;var Xd=iAn(Ie()),_7t=Ke(),aAn=Ce();ii.WandbIntegrationType={Wandb:"wandb"};ii.WandbIntegrationType$inboundSchema=Xd.nativeEnum(ii.WandbIntegrationType);ii.WandbIntegrationType$outboundSchema=ii.WandbIntegrationType$inboundSchema;var y7t;(function(t){t.inboundSchema=ii.WandbIntegrationType$inboundSchema,t.outboundSchema=ii.WandbIntegrationType$outboundSchema})(y7t||(ii.WandbIntegrationType$=y7t={}));ii.WandbIntegration$inboundSchema=Xd.object({type:Xd.literal("wandb").default("wandb"),project:Xd.string(),name:Xd.nullable(Xd.string()).optional(),api_key:Xd.string(),run_name:Xd.nullable(Xd.string()).optional()}).transform(t=>(0,_7t.remap)(t,{api_key:"apiKey",run_name:"runName"}));ii.WandbIntegration$outboundSchema=Xd.object({type:Xd.literal("wandb").default("wandb"),project:Xd.string(),name:Xd.nullable(Xd.string()).optional(),apiKey:Xd.string(),runName:Xd.nullable(Xd.string()).optional()}).transform(t=>(0,_7t.remap)(t,{apiKey:"api_key",runName:"run_name"}));var b7t;(function(t){t.inboundSchema=ii.WandbIntegration$inboundSchema,t.outboundSchema=ii.WandbIntegration$outboundSchema})(b7t||(ii.WandbIntegration$=b7t={}));function sAn(t){return JSON.stringify(ii.WandbIntegration$outboundSchema.parse(t))}function uAn(t){return(0,aAn.safeParse)(t,e=>ii.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var E7t=x(nn=>{"use strict";var lAn=nn&&nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cAn=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dAn=nn&&nn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lAn(e,t,r);return cAn(e,t),e};Object.defineProperty(nn,"__esModule",{value:!0});nn.JobIn$=nn.JobIn$outboundSchema=nn.JobIn$inboundSchema=nn.JobInRepositories$=nn.JobInRepositories$outboundSchema=nn.JobInRepositories$inboundSchema=nn.JobInIntegrations$=nn.JobInIntegrations$outboundSchema=nn.JobInIntegrations$inboundSchema=void 0;nn.jobInIntegrationsToJSON=fAn;nn.jobInIntegrationsFromJSON=pAn;nn.jobInRepositoriesToJSON=mAn;nn.jobInRepositoriesFromJSON=hAn;nn.jobInToJSON=gAn;nn.jobInFromJSON=yAn;var Za=dAn(Ie()),S7t=Ke(),b3e=Ce(),nhe=m3e(),C7t=h3e(),O7t=g3e(),ohe=y3e();nn.JobInIntegrations$inboundSchema=ohe.WandbIntegration$inboundSchema;nn.JobInIntegrations$outboundSchema=ohe.WandbIntegration$outboundSchema;var v7t;(function(t){t.inboundSchema=nn.JobInIntegrations$inboundSchema,t.outboundSchema=nn.JobInIntegrations$outboundSchema})(v7t||(nn.JobInIntegrations$=v7t={}));function fAn(t){return JSON.stringify(nn.JobInIntegrations$outboundSchema.parse(t))}function pAn(t){return(0,b3e.safeParse)(t,e=>nn.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}nn.JobInRepositories$inboundSchema=nhe.GithubRepositoryIn$inboundSchema;nn.JobInRepositories$outboundSchema=nhe.GithubRepositoryIn$outboundSchema;var w7t;(function(t){t.inboundSchema=nn.JobInRepositories$inboundSchema,t.outboundSchema=nn.JobInRepositories$outboundSchema})(w7t||(nn.JobInRepositories$=w7t={}));function mAn(t){return JSON.stringify(nn.JobInRepositories$outboundSchema.parse(t))}function hAn(t){return(0,b3e.safeParse)(t,e=>nn.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}nn.JobIn$inboundSchema=Za.object({model:Za.string(),training_files:Za.array(C7t.TrainingFile$inboundSchema).optional(),validation_files:Za.nullable(Za.array(Za.string())).optional(),hyperparameters:O7t.TrainingParametersIn$inboundSchema,suffix:Za.nullable(Za.string()).optional(),integrations:Za.nullable(Za.array(ohe.WandbIntegration$inboundSchema)).optional(),repositories:Za.array(nhe.GithubRepositoryIn$inboundSchema).optional(),auto_start:Za.boolean().optional()}).transform(t=>(0,S7t.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart"}));nn.JobIn$outboundSchema=Za.object({model:Za.string(),trainingFiles:Za.array(C7t.TrainingFile$outboundSchema).optional(),validationFiles:Za.nullable(Za.array(Za.string())).optional(),hyperparameters:O7t.TrainingParametersIn$outboundSchema,suffix:Za.nullable(Za.string()).optional(),integrations:Za.nullable(Za.array(ohe.WandbIntegration$outboundSchema)).optional(),repositories:Za.array(nhe.GithubRepositoryIn$outboundSchema).optional(),autoStart:Za.boolean().optional()}).transform(t=>(0,S7t.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start"}));var x7t;(function(t){t.inboundSchema=nn.JobIn$inboundSchema,t.outboundSchema=nn.JobIn$outboundSchema})(x7t||(nn.JobIn$=x7t={}));function gAn(t){return JSON.stringify(nn.JobIn$outboundSchema.parse(t))}function yAn(t){return(0,b3e.safeParse)(t,e=>nn.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var v3e=x(wt=>{"use strict";var bAn=wt&&wt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_An=wt&&wt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vAn=wt&&wt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bAn(e,t,r);return _An(e,t),e};Object.defineProperty(wt,"__esModule",{value:!0});wt.JobOut$=wt.JobOut$outboundSchema=wt.JobOut$inboundSchema=wt.Repositories$=wt.Repositories$outboundSchema=wt.Repositories$inboundSchema=wt.Integrations$=wt.Integrations$outboundSchema=wt.Integrations$inboundSchema=wt.ObjectT$=wt.ObjectT$outboundSchema=wt.ObjectT$inboundSchema=wt.Status$=wt.Status$outboundSchema=wt.Status$inboundSchema=wt.ObjectT=wt.Status=void 0;wt.integrationsToJSON=wAn;wt.integrationsFromJSON=xAn;wt.repositoriesToJSON=SAn;wt.repositoriesFromJSON=CAn;wt.jobOutToJSON=OAn;wt.jobOutFromJSON=EAn;var kr=vAn(Ie()),R7t=Ke(),_3e=Ce(),ihe=Zme(),N7t=Yme(),j7t=Xme(),ahe=Qme();wt.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};wt.ObjectT={Job:"job"};wt.Status$inboundSchema=kr.nativeEnum(wt.Status);wt.Status$outboundSchema=wt.Status$inboundSchema;var P7t;(function(t){t.inboundSchema=wt.Status$inboundSchema,t.outboundSchema=wt.Status$outboundSchema})(P7t||(wt.Status$=P7t={}));wt.ObjectT$inboundSchema=kr.nativeEnum(wt.ObjectT);wt.ObjectT$outboundSchema=wt.ObjectT$inboundSchema;var T7t;(function(t){t.inboundSchema=wt.ObjectT$inboundSchema,t.outboundSchema=wt.ObjectT$outboundSchema})(T7t||(wt.ObjectT$=T7t={}));wt.Integrations$inboundSchema=ahe.WandbIntegrationOut$inboundSchema;wt.Integrations$outboundSchema=ahe.WandbIntegrationOut$outboundSchema;var A7t;(function(t){t.inboundSchema=wt.Integrations$inboundSchema,t.outboundSchema=wt.Integrations$outboundSchema})(A7t||(wt.Integrations$=A7t={}));function wAn(t){return JSON.stringify(wt.Integrations$outboundSchema.parse(t))}function xAn(t){return(0,_3e.safeParse)(t,e=>wt.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}wt.Repositories$inboundSchema=ihe.GithubRepositoryOut$inboundSchema;wt.Repositories$outboundSchema=ihe.GithubRepositoryOut$outboundSchema;var I7t;(function(t){t.inboundSchema=wt.Repositories$inboundSchema,t.outboundSchema=wt.Repositories$outboundSchema})(I7t||(wt.Repositories$=I7t={}));function SAn(t){return JSON.stringify(wt.Repositories$outboundSchema.parse(t))}function CAn(t){return(0,_3e.safeParse)(t,e=>wt.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}wt.JobOut$inboundSchema=kr.object({id:kr.string(),auto_start:kr.boolean(),hyperparameters:j7t.TrainingParameters$inboundSchema,model:kr.string(),status:wt.Status$inboundSchema,job_type:kr.string(),created_at:kr.number().int(),modified_at:kr.number().int(),training_files:kr.array(kr.string()),validation_files:kr.nullable(kr.array(kr.string())).optional(),object:kr.literal("job").default("job"),fine_tuned_model:kr.nullable(kr.string()).optional(),suffix:kr.nullable(kr.string()).optional(),integrations:kr.nullable(kr.array(ahe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:kr.nullable(kr.number().int()).optional(),repositories:kr.array(ihe.GithubRepositoryOut$inboundSchema).optional(),metadata:kr.nullable(N7t.JobMetadataOut$inboundSchema).optional()}).transform(t=>(0,R7t.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"}));wt.JobOut$outboundSchema=kr.object({id:kr.string(),autoStart:kr.boolean(),hyperparameters:j7t.TrainingParameters$outboundSchema,model:kr.string(),status:wt.Status$outboundSchema,jobType:kr.string(),createdAt:kr.number().int(),modifiedAt:kr.number().int(),trainingFiles:kr.array(kr.string()),validationFiles:kr.nullable(kr.array(kr.string())).optional(),object:kr.literal("job").default("job"),fineTunedModel:kr.nullable(kr.string()).optional(),suffix:kr.nullable(kr.string()).optional(),integrations:kr.nullable(kr.array(ahe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:kr.nullable(kr.number().int()).optional(),repositories:kr.array(ihe.GithubRepositoryOut$outboundSchema).optional(),metadata:kr.nullable(N7t.JobMetadataOut$outboundSchema).optional()}).transform(t=>(0,R7t.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 M7t;(function(t){t.inboundSchema=wt.JobOut$inboundSchema,t.outboundSchema=wt.JobOut$outboundSchema})(M7t||(wt.JobOut$=M7t={}));function OAn(t){return JSON.stringify(wt.JobOut$outboundSchema.parse(t))}function EAn(t){return(0,_3e.safeParse)(t,e=>wt.JobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobOut' from JSON")}});var k7t=x(ai=>{"use strict";var PAn=ai&&ai.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TAn=ai&&ai.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AAn=ai&&ai.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PAn(e,t,r);return TAn(e,t),e};Object.defineProperty(ai,"__esModule",{value:!0});ai.JobsOut$=ai.JobsOut$outboundSchema=ai.JobsOut$inboundSchema=ai.JobsOutObject$=ai.JobsOutObject$outboundSchema=ai.JobsOutObject$inboundSchema=ai.JobsOutObject=void 0;ai.jobsOutToJSON=MAn;ai.jobsOutFromJSON=RAn;var fT=AAn(Ie()),IAn=Ce(),F7t=v3e();ai.JobsOutObject={List:"list"};ai.JobsOutObject$inboundSchema=fT.nativeEnum(ai.JobsOutObject);ai.JobsOutObject$outboundSchema=ai.JobsOutObject$inboundSchema;var D7t;(function(t){t.inboundSchema=ai.JobsOutObject$inboundSchema,t.outboundSchema=ai.JobsOutObject$outboundSchema})(D7t||(ai.JobsOutObject$=D7t={}));ai.JobsOut$inboundSchema=fT.object({data:fT.array(F7t.JobOut$inboundSchema).optional(),object:fT.literal("list").default("list"),total:fT.number().int()});ai.JobsOut$outboundSchema=fT.object({data:fT.array(F7t.JobOut$outboundSchema).optional(),object:fT.literal("list").default("list"),total:fT.number().int()});var L7t;(function(t){t.inboundSchema=ai.JobsOut$inboundSchema,t.outboundSchema=ai.JobsOut$outboundSchema})(L7t||(ai.JobsOut$=L7t={}));function MAn(t){return JSON.stringify(ai.JobsOut$outboundSchema.parse(t))}function RAn(t){return(0,IAn.safeParse)(t,e=>ai.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var U7t=x(si=>{"use strict";var NAn=si&&si.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jAn=si&&si.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DAn=si&&si.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NAn(e,t,r);return jAn(e,t),e};Object.defineProperty(si,"__esModule",{value:!0});si.LegacyJobMetadataOut$=si.LegacyJobMetadataOut$outboundSchema=si.LegacyJobMetadataOut$inboundSchema=si.LegacyJobMetadataOutObject$=si.LegacyJobMetadataOutObject$outboundSchema=si.LegacyJobMetadataOutObject$inboundSchema=si.LegacyJobMetadataOutObject=void 0;si.legacyJobMetadataOutToJSON=FAn;si.legacyJobMetadataOutFromJSON=kAn;var Qr=DAn(Ie()),z7t=Ke(),LAn=Ce();si.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};si.LegacyJobMetadataOutObject$inboundSchema=Qr.nativeEnum(si.LegacyJobMetadataOutObject);si.LegacyJobMetadataOutObject$outboundSchema=si.LegacyJobMetadataOutObject$inboundSchema;var $7t;(function(t){t.inboundSchema=si.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=si.LegacyJobMetadataOutObject$outboundSchema})($7t||(si.LegacyJobMetadataOutObject$=$7t={}));si.LegacyJobMetadataOut$inboundSchema=Qr.object({expected_duration_seconds:Qr.nullable(Qr.number().int()).optional(),cost:Qr.nullable(Qr.number()).optional(),cost_currency:Qr.nullable(Qr.string()).optional(),train_tokens_per_step:Qr.nullable(Qr.number().int()).optional(),train_tokens:Qr.nullable(Qr.number().int()).optional(),data_tokens:Qr.nullable(Qr.number().int()).optional(),estimated_start_time:Qr.nullable(Qr.number().int()).optional(),deprecated:Qr.boolean().default(!0),details:Qr.string(),epochs:Qr.nullable(Qr.number()).optional(),training_steps:Qr.nullable(Qr.number().int()).optional(),object:Qr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,z7t.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"}));si.LegacyJobMetadataOut$outboundSchema=Qr.object({expectedDurationSeconds:Qr.nullable(Qr.number().int()).optional(),cost:Qr.nullable(Qr.number()).optional(),costCurrency:Qr.nullable(Qr.string()).optional(),trainTokensPerStep:Qr.nullable(Qr.number().int()).optional(),trainTokens:Qr.nullable(Qr.number().int()).optional(),dataTokens:Qr.nullable(Qr.number().int()).optional(),estimatedStartTime:Qr.nullable(Qr.number().int()).optional(),deprecated:Qr.boolean().default(!0),details:Qr.string(),epochs:Qr.nullable(Qr.number()).optional(),trainingSteps:Qr.nullable(Qr.number().int()).optional(),object:Qr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,z7t.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 B7t;(function(t){t.inboundSchema=si.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=si.LegacyJobMetadataOut$outboundSchema})(B7t||(si.LegacyJobMetadataOut$=B7t={}));function FAn(t){return JSON.stringify(si.LegacyJobMetadataOut$outboundSchema.parse(t))}function kAn(t){return(0,LAn.safeParse)(t,e=>si.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var V7t=x(_l=>{"use strict";var $An=_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]}),BAn=_l&&_l.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zAn=_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)&&$An(e,t,r);return BAn(e,t),e};Object.defineProperty(_l,"__esModule",{value:!0});_l.ListFilesOut$=_l.ListFilesOut$outboundSchema=_l.ListFilesOut$inboundSchema=void 0;_l.listFilesOutToJSON=qAn;_l.listFilesOutFromJSON=HAn;var i1=zAn(Ie()),UAn=Ce(),H7t=d3e();_l.ListFilesOut$inboundSchema=i1.object({data:i1.array(H7t.FileSchema$inboundSchema),object:i1.string(),total:i1.number().int()});_l.ListFilesOut$outboundSchema=i1.object({data:i1.array(H7t.FileSchema$outboundSchema),object:i1.string(),total:i1.number().int()});var q7t;(function(t){t.inboundSchema=_l.ListFilesOut$inboundSchema,t.outboundSchema=_l.ListFilesOut$outboundSchema})(q7t||(_l.ListFilesOut$=q7t={}));function qAn(t){return JSON.stringify(_l.ListFilesOut$outboundSchema.parse(t))}function HAn(t){return(0,UAn.safeParse)(t,e=>_l.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var J7t=x(ui=>{"use strict";var VAn=ui&&ui.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WAn=ui&&ui.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KAn=ui&&ui.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VAn(e,t,r);return WAn(e,t),e};Object.defineProperty(ui,"__esModule",{value:!0});ui.ModelList$=ui.ModelList$outboundSchema=ui.ModelList$inboundSchema=ui.Data$=ui.Data$outboundSchema=ui.Data$inboundSchema=void 0;ui.dataToJSON=GAn;ui.dataFromJSON=JAn;ui.modelListToJSON=ZAn;ui.modelListFromJSON=YAn;var pa=KAn(Ie()),G7t=Ce(),she=X4e(),uhe=p3e();ui.Data$inboundSchema=pa.union([she.BaseModelCard$inboundSchema.and(pa.object({type:pa.literal("base")}).transform(t=>({type:t.type}))),uhe.FTModelCard$inboundSchema.and(pa.object({type:pa.literal("fine-tuned")}).transform(t=>({type:t.type})))]);ui.Data$outboundSchema=pa.union([she.BaseModelCard$outboundSchema.and(pa.object({type:pa.literal("base")}).transform(t=>({type:t.type}))),uhe.FTModelCard$outboundSchema.and(pa.object({type:pa.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var W7t;(function(t){t.inboundSchema=ui.Data$inboundSchema,t.outboundSchema=ui.Data$outboundSchema})(W7t||(ui.Data$=W7t={}));function GAn(t){return JSON.stringify(ui.Data$outboundSchema.parse(t))}function JAn(t){return(0,G7t.safeParse)(t,e=>ui.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}ui.ModelList$inboundSchema=pa.object({object:pa.string().default("list"),data:pa.array(pa.union([she.BaseModelCard$inboundSchema.and(pa.object({type:pa.literal("base")}).transform(t=>({type:t.type}))),uhe.FTModelCard$inboundSchema.and(pa.object({type:pa.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});ui.ModelList$outboundSchema=pa.object({object:pa.string().default("list"),data:pa.array(pa.union([she.BaseModelCard$outboundSchema.and(pa.object({type:pa.literal("base")}).transform(t=>({type:t.type}))),uhe.FTModelCard$outboundSchema.and(pa.object({type:pa.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});var K7t;(function(t){t.inboundSchema=ui.ModelList$inboundSchema,t.outboundSchema=ui.ModelList$outboundSchema})(K7t||(ui.ModelList$=K7t={}));function ZAn(t){return JSON.stringify(ui.ModelList$outboundSchema.parse(t))}function YAn(t){return(0,G7t.safeParse)(t,e=>ui.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var tZt=x(vl=>{"use strict";var XAn=vl&&vl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QAn=vl&&vl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eIn=vl&&vl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XAn(e,t,r);return QAn(e,t),e};Object.defineProperty(vl,"__esModule",{value:!0});vl.RetrieveFileOut$=vl.RetrieveFileOut$outboundSchema=vl.RetrieveFileOut$inboundSchema=void 0;vl.retrieveFileOutToJSON=rIn;vl.retrieveFileOutFromJSON=nIn;var rd=eIn(Ie()),Y7t=Ke(),tIn=Ce(),X7t=MJ(),Q7t=RJ(),eZt=NJ();vl.RetrieveFileOut$inboundSchema=rd.object({id:rd.string(),object:rd.string(),bytes:rd.number().int(),created_at:rd.number().int(),filename:rd.string(),purpose:X7t.FilePurpose$inboundSchema,sample_type:Q7t.SampleType$inboundSchema,num_lines:rd.nullable(rd.number().int()).optional(),source:eZt.Source$inboundSchema,deleted:rd.boolean()}).transform(t=>(0,Y7t.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));vl.RetrieveFileOut$outboundSchema=rd.object({id:rd.string(),object:rd.string(),sizeBytes:rd.number().int(),createdAt:rd.number().int(),filename:rd.string(),purpose:X7t.FilePurpose$outboundSchema,sampleType:Q7t.SampleType$outboundSchema,numLines:rd.nullable(rd.number().int()).optional(),source:eZt.Source$outboundSchema,deleted:rd.boolean()}).transform(t=>(0,Y7t.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var Z7t;(function(t){t.inboundSchema=vl.RetrieveFileOut$inboundSchema,t.outboundSchema=vl.RetrieveFileOut$outboundSchema})(Z7t||(vl.RetrieveFileOut$=Z7t={}));function rIn(t){return JSON.stringify(vl.RetrieveFileOut$outboundSchema.parse(t))}function nIn(t){return(0,tIn.safeParse)(t,e=>vl.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var oZt=x(wl=>{"use strict";var oIn=wl&&wl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iIn=wl&&wl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aIn=wl&&wl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oIn(e,t,r);return iIn(e,t),e};Object.defineProperty(wl,"__esModule",{value:!0});wl.Security$=wl.Security$outboundSchema=wl.Security$inboundSchema=void 0;wl.securityToJSON=uIn;wl.securityFromJSON=lIn;var lhe=aIn(Ie()),nZt=Ke(),sIn=Ce();wl.Security$inboundSchema=lhe.object({ApiKey:lhe.string().optional()}).transform(t=>(0,nZt.remap)(t,{ApiKey:"apiKey"}));wl.Security$outboundSchema=lhe.object({apiKey:lhe.string().optional()}).transform(t=>(0,nZt.remap)(t,{apiKey:"ApiKey"}));var rZt;(function(t){t.inboundSchema=wl.Security$inboundSchema,t.outboundSchema=wl.Security$outboundSchema})(rZt||(wl.Security$=rZt={}));function uIn(t){return JSON.stringify(wl.Security$outboundSchema.parse(t))}function lIn(t){return(0,sIn.safeParse)(t,e=>wl.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var sZt=x(li=>{"use strict";var cIn=li&&li.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dIn=li&&li.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fIn=li&&li.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cIn(e,t,r);return dIn(e,t),e};Object.defineProperty(li,"__esModule",{value:!0});li.UnarchiveFTModelOut$=li.UnarchiveFTModelOut$outboundSchema=li.UnarchiveFTModelOut$inboundSchema=li.UnarchiveFTModelOutObject$=li.UnarchiveFTModelOutObject$outboundSchema=li.UnarchiveFTModelOutObject$inboundSchema=li.UnarchiveFTModelOutObject=void 0;li.unarchiveFTModelOutToJSON=mIn;li.unarchiveFTModelOutFromJSON=hIn;var pT=fIn(Ie()),pIn=Ce();li.UnarchiveFTModelOutObject={Model:"model"};li.UnarchiveFTModelOutObject$inboundSchema=pT.nativeEnum(li.UnarchiveFTModelOutObject);li.UnarchiveFTModelOutObject$outboundSchema=li.UnarchiveFTModelOutObject$inboundSchema;var iZt;(function(t){t.inboundSchema=li.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=li.UnarchiveFTModelOutObject$outboundSchema})(iZt||(li.UnarchiveFTModelOutObject$=iZt={}));li.UnarchiveFTModelOut$inboundSchema=pT.object({id:pT.string(),object:pT.literal("model").default("model"),archived:pT.boolean().default(!1)});li.UnarchiveFTModelOut$outboundSchema=pT.object({id:pT.string(),object:pT.literal("model").default("model"),archived:pT.boolean().default(!1)});var aZt;(function(t){t.inboundSchema=li.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=li.UnarchiveFTModelOut$outboundSchema})(aZt||(li.UnarchiveFTModelOut$=aZt={}));function mIn(t){return JSON.stringify(li.UnarchiveFTModelOut$outboundSchema.parse(t))}function hIn(t){return(0,pIn.safeParse)(t,e=>li.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var lZt=x(xl=>{"use strict";var gIn=xl&&xl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yIn=xl&&xl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bIn=xl&&xl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gIn(e,t,r);return yIn(e,t),e};Object.defineProperty(xl,"__esModule",{value:!0});xl.UpdateFTModelIn$=xl.UpdateFTModelIn$outboundSchema=xl.UpdateFTModelIn$inboundSchema=void 0;xl.updateFTModelInToJSON=vIn;xl.updateFTModelInFromJSON=wIn;var IO=bIn(Ie()),_In=Ce();xl.UpdateFTModelIn$inboundSchema=IO.object({name:IO.nullable(IO.string()).optional(),description:IO.nullable(IO.string()).optional()});xl.UpdateFTModelIn$outboundSchema=IO.object({name:IO.nullable(IO.string()).optional(),description:IO.nullable(IO.string()).optional()});var uZt;(function(t){t.inboundSchema=xl.UpdateFTModelIn$inboundSchema,t.outboundSchema=xl.UpdateFTModelIn$outboundSchema})(uZt||(xl.UpdateFTModelIn$=uZt={}));function vIn(t){return JSON.stringify(xl.UpdateFTModelIn$outboundSchema.parse(t))}function wIn(t){return(0,_In.safeParse)(t,e=>xl.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var hZt=x(Sl=>{"use strict";var xIn=Sl&&Sl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SIn=Sl&&Sl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CIn=Sl&&Sl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xIn(e,t,r);return SIn(e,t),e};Object.defineProperty(Sl,"__esModule",{value:!0});Sl.UploadFileOut$=Sl.UploadFileOut$outboundSchema=Sl.UploadFileOut$inboundSchema=void 0;Sl.uploadFileOutToJSON=EIn;Sl.uploadFileOutFromJSON=PIn;var op=CIn(Ie()),dZt=Ke(),OIn=Ce(),fZt=MJ(),pZt=RJ(),mZt=NJ();Sl.UploadFileOut$inboundSchema=op.object({id:op.string(),object:op.string(),bytes:op.number().int(),created_at:op.number().int(),filename:op.string(),purpose:fZt.FilePurpose$inboundSchema,sample_type:pZt.SampleType$inboundSchema,num_lines:op.nullable(op.number().int()).optional(),source:mZt.Source$inboundSchema}).transform(t=>(0,dZt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Sl.UploadFileOut$outboundSchema=op.object({id:op.string(),object:op.string(),sizeBytes:op.number().int(),createdAt:op.number().int(),filename:op.string(),purpose:fZt.FilePurpose$outboundSchema,sampleType:pZt.SampleType$outboundSchema,numLines:op.nullable(op.number().int()).optional(),source:mZt.Source$outboundSchema}).transform(t=>(0,dZt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var cZt;(function(t){t.inboundSchema=Sl.UploadFileOut$inboundSchema,t.outboundSchema=Sl.UploadFileOut$outboundSchema})(cZt||(Sl.UploadFileOut$=cZt={}));function EIn(t){return JSON.stringify(Sl.UploadFileOut$outboundSchema.parse(t))}function PIn(t){return(0,OIn.safeParse)(t,e=>Sl.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var _Zt=x(ci=>{"use strict";var TIn=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]}),AIn=ci&&ci.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IIn=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)&&TIn(e,t,r);return AIn(e,t),e};Object.defineProperty(ci,"__esModule",{value:!0});ci.ValidationError$=ci.ValidationError$outboundSchema=ci.ValidationError$inboundSchema=ci.Loc$=ci.Loc$outboundSchema=ci.Loc$inboundSchema=void 0;ci.locToJSON=MIn;ci.locFromJSON=RIn;ci.validationErrorToJSON=NIn;ci.validationErrorFromJSON=jIn;var Cl=IIn(Ie()),bZt=Ce();ci.Loc$inboundSchema=Cl.union([Cl.string(),Cl.number().int()]);ci.Loc$outboundSchema=Cl.union([Cl.string(),Cl.number().int()]);var gZt;(function(t){t.inboundSchema=ci.Loc$inboundSchema,t.outboundSchema=ci.Loc$outboundSchema})(gZt||(ci.Loc$=gZt={}));function MIn(t){return JSON.stringify(ci.Loc$outboundSchema.parse(t))}function RIn(t){return(0,bZt.safeParse)(t,e=>ci.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}ci.ValidationError$inboundSchema=Cl.object({loc:Cl.array(Cl.union([Cl.string(),Cl.number().int()])),msg:Cl.string(),type:Cl.string()});ci.ValidationError$outboundSchema=Cl.object({loc:Cl.array(Cl.union([Cl.string(),Cl.number().int()])),msg:Cl.string(),type:Cl.string()});var yZt;(function(t){t.inboundSchema=ci.ValidationError$inboundSchema,t.outboundSchema=ci.ValidationError$outboundSchema})(yZt||(ci.ValidationError$=yZt={}));function NIn(t){return JSON.stringify(ci.ValidationError$outboundSchema.parse(t))}function jIn(t){return(0,bZt.safeParse)(t,e=>ci.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var no=x(Ze=>{"use strict";var DIn=Ze&&Ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),et=Ze&&Ze.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DIn(e,t,r)};Object.defineProperty(Ze,"__esModule",{value:!0});et(rKt(),Ze);et(dKt(),Ze);et(Y4e(),Ze);et(hKt(),Ze);et(e1(),Ze);et(X4e(),Ze);et(Q4e(),Ze);et(EKt(),Ze);et(t3e(),Ze);et(LKt(),Ze);et(e3e(),Ze);et(UKt(),Ze);et(jme(),Ze);et(tGt(),Ze);et(sGt(),Ze);et(gGt(),Ze);et(n3e(),Ze);et(o3e(),Ze);et(TGt(),Ze);et(MGt(),Ze);et(s3e(),Ze);et(WGt(),Ze);et(a3e(),Ze);et(B3(),Ze);et(GGt(),Ze);et(ZGt(),Ze);et(i3e(),Ze);et(_Jt(),Ze);et(CJt(),Ze);et(AJt(),Ze);et(c3e(),Ze);et(u3e(),Ze);et(MJ(),Ze);et(d3e(),Ze);et($Jt(),Ze);et(HJt(),Ze);et(GJt(),Ze);et(QJt(),Ze);et(f3e(),Ze);et(p3e(),Ze);et(c7t(),Ze);et(J4e(),Ze);et(V4e(),Ze);et(Z4e(),Ze);et(m3e(),Ze);et(Zme(),Ze);et(U4e(),Ze);et(q4e(),Ze);et(E7t(),Ze);et(Yme(),Ze);et(v3e(),Ze);et(k7t(),Ze);et(K4e(),Ze);et(U7t(),Ze);et(V7t(),Ze);et(r3e(),Ze);et(Rme(),Ze);et(J7t(),Ze);et(U3(),Ze);et(H4e(),Ze);et(q3(),Ze);et(G4e(),Ze);et(tZt(),Ze);et(RJ(),Ze);et(oZt(),Ze);et(NJ(),Ze);et(Ok(),Ze);et(cme(),Ze);et(H3(),Ze);et(dme(),Ze);et(V3(),Ze);et(W3(),Ze);et(Ek(),Ze);et(AJ(),Ze);et(h3e(),Ze);et(Xme(),Ze);et(g3e(),Ze);et(sZt(),Ze);et(lZt(),Ze);et(hZt(),Ze);et(G3(),Ze);et(Pk(),Ze);et(_Zt(),Ze);et(y3e(),Ze);et(Qme(),Ze)});var SZt=x(nd=>{"use strict";var LIn=nd&&nd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FIn=nd&&nd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wZt=nd&&nd.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LIn(e,t,r);return FIn(e,t),e};Object.defineProperty(nd,"__esModule",{value:!0});nd.HTTPValidationError$=nd.HTTPValidationError$outboundSchema=nd.HTTPValidationError$inboundSchema=nd.HTTPValidationError=void 0;var jJ=wZt(Ie()),xZt=wZt(no()),DJ=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"}};nd.HTTPValidationError=DJ;nd.HTTPValidationError$inboundSchema=jJ.object({detail:jJ.array(xZt.ValidationError$inboundSchema).optional()}).transform(t=>new DJ(t));nd.HTTPValidationError$outboundSchema=jJ.instanceof(DJ).transform(t=>t.data$).pipe(jJ.object({detail:jJ.array(xZt.ValidationError$outboundSchema).optional()}));var vZt;(function(t){t.inboundSchema=nd.HTTPValidationError$inboundSchema,t.outboundSchema=nd.HTTPValidationError$outboundSchema})(vZt||(nd.HTTPValidationError$=vZt={}))});var yg=x(MO=>{"use strict";var kIn=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]}),che=MO&&MO.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kIn(e,t,r)};Object.defineProperty(MO,"__esModule",{value:!0});che(p4e(),MO);che(SZt(),MO);che(D4e(),MO);che(B4e(),MO)});var EZt=x(mT=>{"use strict";var $In=mT&&mT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BIn=mT&&mT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w3e=mT&&mT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$In(e,t,r);return BIn(e,t),e};Object.defineProperty(mT,"__esModule",{value:!0});mT.agentsComplete=WIn;var zIn=wi(),LJ=w3e(xi()),UIn=Ke(),qIn=Ce(),CZt=Si(),HIn=Uo(),OZt=w3e(no()),VIn=w3e(yg());async function WIn(t,e,r){let n=(0,qIn.safeParse)(e,_=>OZt.AgentsCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,zIn.encodeJSON)("body",o,{explode:!0}),a=(0,HIn.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,UIn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,CZt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,CZt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await LJ.match(LJ.json(200,OZt.ChatCompletionResponse$inboundSchema),LJ.jsonErr(422,VIn.HTTPValidationError$inboundSchema),LJ.fail("4XX"),LJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var AZt=x(hT=>{"use strict";var KIn=hT&&hT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GIn=hT&&hT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dhe=hT&&hT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KIn(e,t,r);return GIn(e,t),e};Object.defineProperty(hT,"__esModule",{value:!0});hT.agentsStream=rMn;var JIn=dhe(Ie()),ZIn=wi(),YIn=EJ(),FJ=dhe(xi()),XIn=Ke(),QIn=Ce(),PZt=Si(),eMn=Uo(),TZt=dhe(no()),tMn=dhe(yg());async function rMn(t,e,r){let n=(0,QIn.safeParse)(e,_=>TZt.AgentsCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,ZIn.encodeJSON)("body",o,{explode:!0}),a=(0,eMn.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,XIn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,PZt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,PZt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await FJ.match(FJ.sse(200,JIn.instanceof(ReadableStream).transform(_=>new YIn.EventStream({stream:_,decoder(w){return TZt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),FJ.jsonErr(422,tMn.HTTPValidationError$inboundSchema),FJ.fail("4XX"),FJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var MZt=x(fhe=>{"use strict";Object.defineProperty(fhe,"__esModule",{value:!0});fhe.Agents=void 0;var nMn=EZt(),oMn=AZt(),iMn=hg(),IZt=Dy(),x3e=class extends iMn.ClientSDK{async complete(e,r){return(0,IZt.unwrapAsync)((0,nMn.agentsComplete)(this,e,r))}async stream(e,r){return(0,IZt.unwrapAsync)((0,oMn.agentsStream)(this,e,r))}};fhe.Agents=x3e});var jZt=x(Ol=>{"use strict";var aMn=Ol&&Ol.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sMn=Ol&&Ol.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uMn=Ol&&Ol.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aMn(e,t,r);return sMn(e,t),e};Object.defineProperty(Ol,"__esModule",{value:!0});Ol.DeleteModelV1ModelsModelIdDeleteRequest$=Ol.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Ol.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;Ol.deleteModelV1ModelsModelIdDeleteRequestToJSON=cMn;Ol.deleteModelV1ModelsModelIdDeleteRequestFromJSON=dMn;var phe=uMn(Ie()),NZt=Ke(),lMn=Ce();Ol.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=phe.object({model_id:phe.string()}).transform(t=>(0,NZt.remap)(t,{model_id:"modelId"}));Ol.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=phe.object({modelId:phe.string()}).transform(t=>(0,NZt.remap)(t,{modelId:"model_id"}));var RZt;(function(t){t.inboundSchema=Ol.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=Ol.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(RZt||(Ol.DeleteModelV1ModelsModelIdDeleteRequest$=RZt={}));function cMn(t){return JSON.stringify(Ol.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function dMn(t){return(0,lMn.safeParse)(t,e=>Ol.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var FZt=x(El=>{"use strict";var fMn=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]}),pMn=El&&El.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mMn=El&&El.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fMn(e,t,r);return pMn(e,t),e};Object.defineProperty(El,"__esModule",{value:!0});El.FilesApiRoutesDeleteFileRequest$=El.FilesApiRoutesDeleteFileRequest$outboundSchema=El.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;El.filesApiRoutesDeleteFileRequestToJSON=gMn;El.filesApiRoutesDeleteFileRequestFromJSON=yMn;var mhe=mMn(Ie()),LZt=Ke(),hMn=Ce();El.FilesApiRoutesDeleteFileRequest$inboundSchema=mhe.object({file_id:mhe.string()}).transform(t=>(0,LZt.remap)(t,{file_id:"fileId"}));El.FilesApiRoutesDeleteFileRequest$outboundSchema=mhe.object({fileId:mhe.string()}).transform(t=>(0,LZt.remap)(t,{fileId:"file_id"}));var DZt;(function(t){t.inboundSchema=El.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=El.FilesApiRoutesDeleteFileRequest$outboundSchema})(DZt||(El.FilesApiRoutesDeleteFileRequest$=DZt={}));function gMn(t){return JSON.stringify(El.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function yMn(t){return(0,hMn.safeParse)(t,e=>El.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var BZt=x(Pl=>{"use strict";var bMn=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]}),_Mn=Pl&&Pl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vMn=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)&&bMn(e,t,r);return _Mn(e,t),e};Object.defineProperty(Pl,"__esModule",{value:!0});Pl.FilesApiRoutesDownloadFileRequest$=Pl.FilesApiRoutesDownloadFileRequest$outboundSchema=Pl.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;Pl.filesApiRoutesDownloadFileRequestToJSON=xMn;Pl.filesApiRoutesDownloadFileRequestFromJSON=SMn;var hhe=vMn(Ie()),$Zt=Ke(),wMn=Ce();Pl.FilesApiRoutesDownloadFileRequest$inboundSchema=hhe.object({file_id:hhe.string()}).transform(t=>(0,$Zt.remap)(t,{file_id:"fileId"}));Pl.FilesApiRoutesDownloadFileRequest$outboundSchema=hhe.object({fileId:hhe.string()}).transform(t=>(0,$Zt.remap)(t,{fileId:"file_id"}));var kZt;(function(t){t.inboundSchema=Pl.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=Pl.FilesApiRoutesDownloadFileRequest$outboundSchema})(kZt||(Pl.FilesApiRoutesDownloadFileRequest$=kZt={}));function xMn(t){return JSON.stringify(Pl.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function SMn(t){return(0,wMn.safeParse)(t,e=>Pl.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var qZt=x(Tl=>{"use strict";var CMn=Tl&&Tl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OMn=Tl&&Tl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EMn=Tl&&Tl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CMn(e,t,r);return OMn(e,t),e};Object.defineProperty(Tl,"__esModule",{value:!0});Tl.FilesApiRoutesGetSignedUrlRequest$=Tl.FilesApiRoutesGetSignedUrlRequest$outboundSchema=Tl.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;Tl.filesApiRoutesGetSignedUrlRequestToJSON=TMn;Tl.filesApiRoutesGetSignedUrlRequestFromJSON=AMn;var Y3=EMn(Ie()),UZt=Ke(),PMn=Ce();Tl.FilesApiRoutesGetSignedUrlRequest$inboundSchema=Y3.object({file_id:Y3.string(),expiry:Y3.number().int().default(24)}).transform(t=>(0,UZt.remap)(t,{file_id:"fileId"}));Tl.FilesApiRoutesGetSignedUrlRequest$outboundSchema=Y3.object({fileId:Y3.string(),expiry:Y3.number().int().default(24)}).transform(t=>(0,UZt.remap)(t,{fileId:"file_id"}));var zZt;(function(t){t.inboundSchema=Tl.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=Tl.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(zZt||(Tl.FilesApiRoutesGetSignedUrlRequest$=zZt={}));function TMn(t){return JSON.stringify(Tl.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function AMn(t){return(0,PMn.safeParse)(t,e=>Tl.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var KZt=x(Il=>{"use strict";var IMn=Il&&Il.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MMn=Il&&Il.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VZt=Il&&Il.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&IMn(e,t,r);return MMn(e,t),e};Object.defineProperty(Il,"__esModule",{value:!0});Il.FilesApiRoutesListFilesRequest$=Il.FilesApiRoutesListFilesRequest$outboundSchema=Il.FilesApiRoutesListFilesRequest$inboundSchema=void 0;Il.filesApiRoutesListFilesRequestToJSON=NMn;Il.filesApiRoutesListFilesRequestFromJSON=jMn;var Al=VZt(Ie()),WZt=Ke(),RMn=Ce(),X3=VZt(no());Il.FilesApiRoutesListFilesRequest$inboundSchema=Al.object({page:Al.number().int().default(0),page_size:Al.number().int().default(100),sample_type:Al.nullable(Al.array(X3.SampleType$inboundSchema)).optional(),source:Al.nullable(Al.array(X3.Source$inboundSchema)).optional(),search:Al.nullable(Al.string()).optional(),purpose:Al.nullable(X3.FilePurpose$inboundSchema).optional()}).transform(t=>(0,WZt.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));Il.FilesApiRoutesListFilesRequest$outboundSchema=Al.object({page:Al.number().int().default(0),pageSize:Al.number().int().default(100),sampleType:Al.nullable(Al.array(X3.SampleType$outboundSchema)).optional(),source:Al.nullable(Al.array(X3.Source$outboundSchema)).optional(),search:Al.nullable(Al.string()).optional(),purpose:Al.nullable(X3.FilePurpose$outboundSchema).optional()}).transform(t=>(0,WZt.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var HZt;(function(t){t.inboundSchema=Il.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=Il.FilesApiRoutesListFilesRequest$outboundSchema})(HZt||(Il.FilesApiRoutesListFilesRequest$=HZt={}));function NMn(t){return JSON.stringify(Il.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function jMn(t){return(0,RMn.safeParse)(t,e=>Il.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var ZZt=x(Ml=>{"use strict";var DMn=Ml&&Ml.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LMn=Ml&&Ml.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FMn=Ml&&Ml.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DMn(e,t,r);return LMn(e,t),e};Object.defineProperty(Ml,"__esModule",{value:!0});Ml.FilesApiRoutesRetrieveFileRequest$=Ml.FilesApiRoutesRetrieveFileRequest$outboundSchema=Ml.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;Ml.filesApiRoutesRetrieveFileRequestToJSON=$Mn;Ml.filesApiRoutesRetrieveFileRequestFromJSON=BMn;var ghe=FMn(Ie()),JZt=Ke(),kMn=Ce();Ml.FilesApiRoutesRetrieveFileRequest$inboundSchema=ghe.object({file_id:ghe.string()}).transform(t=>(0,JZt.remap)(t,{file_id:"fileId"}));Ml.FilesApiRoutesRetrieveFileRequest$outboundSchema=ghe.object({fileId:ghe.string()}).transform(t=>(0,JZt.remap)(t,{fileId:"file_id"}));var GZt;(function(t){t.inboundSchema=Ml.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=Ml.FilesApiRoutesRetrieveFileRequest$outboundSchema})(GZt||(Ml.FilesApiRoutesRetrieveFileRequest$=GZt={}));function $Mn(t){return JSON.stringify(Ml.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function BMn(t){return(0,kMn.safeParse)(t,e=>Ml.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var S3e=x(N_=>{"use strict";var zMn=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]}),UMn=N_&&N_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qMn=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)&&zMn(e,t,r);return UMn(e,t),e};Object.defineProperty(N_,"__esModule",{value:!0});N_.blobLikeSchema=void 0;N_.isBlobLike=YZt;var HMn=qMn(Ie());N_.blobLikeSchema=HMn.custom(YZt,{message:"expected a Blob, File or Blob-like object",fatal:!0});function YZt(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 nYt=x(Ao=>{"use strict";var VMn=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]}),WMn=Ao&&Ao.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eYt=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)&&VMn(e,t,r);return WMn(e,t),e};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.FilesApiRoutesUploadFileMultiPartBodyParams$=Ao.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=Ao.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=Ao.FileT$=Ao.FileT$outboundSchema=Ao.FileT$inboundSchema=void 0;Ao.fileToJSON=GMn;Ao.fileFromJSON=JMn;Ao.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=ZMn;Ao.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=YMn;var od=eYt(Ie()),tYt=Ce(),KMn=S3e(),rYt=eYt(no());Ao.FileT$inboundSchema=od.object({fileName:od.string(),content:od.union([od.instanceof(ReadableStream),od.instanceof(Blob),od.instanceof(ArrayBuffer),od.instanceof(Uint8Array)])});Ao.FileT$outboundSchema=od.object({fileName:od.string(),content:od.union([od.instanceof(ReadableStream),od.instanceof(Blob),od.instanceof(ArrayBuffer),od.instanceof(Uint8Array)])});var XZt;(function(t){t.inboundSchema=Ao.FileT$inboundSchema,t.outboundSchema=Ao.FileT$outboundSchema})(XZt||(Ao.FileT$=XZt={}));function GMn(t){return JSON.stringify(Ao.FileT$outboundSchema.parse(t))}function JMn(t){return(0,tYt.safeParse)(t,e=>Ao.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}Ao.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=od.object({file:od.lazy(()=>Ao.FileT$inboundSchema),purpose:rYt.FilePurpose$inboundSchema.optional()});Ao.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=od.object({file:od.lazy(()=>Ao.FileT$outboundSchema).or(KMn.blobLikeSchema),purpose:rYt.FilePurpose$outboundSchema.optional()});var QZt;(function(t){t.inboundSchema=Ao.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=Ao.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(QZt||(Ao.FilesApiRoutesUploadFileMultiPartBodyParams$=QZt={}));function ZMn(t){return JSON.stringify(Ao.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function YMn(t){return(0,tYt.safeParse)(t,e=>Ao.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var aYt=x(Rl=>{"use strict";var XMn=Rl&&Rl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QMn=Rl&&Rl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eRn=Rl&&Rl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XMn(e,t,r);return QMn(e,t),e};Object.defineProperty(Rl,"__esModule",{value:!0});Rl.JobsApiRoutesBatchCancelBatchJobRequest$=Rl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=Rl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;Rl.jobsApiRoutesBatchCancelBatchJobRequestToJSON=rRn;Rl.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=nRn;var yhe=eRn(Ie()),iYt=Ke(),tRn=Ce();Rl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=yhe.object({job_id:yhe.string()}).transform(t=>(0,iYt.remap)(t,{job_id:"jobId"}));Rl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=yhe.object({jobId:yhe.string()}).transform(t=>(0,iYt.remap)(t,{jobId:"job_id"}));var oYt;(function(t){t.inboundSchema=Rl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=Rl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(oYt||(Rl.JobsApiRoutesBatchCancelBatchJobRequest$=oYt={}));function rRn(t){return JSON.stringify(Rl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function nRn(t){return(0,tRn.safeParse)(t,e=>Rl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var lYt=x(Nl=>{"use strict";var oRn=Nl&&Nl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iRn=Nl&&Nl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aRn=Nl&&Nl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oRn(e,t,r);return iRn(e,t),e};Object.defineProperty(Nl,"__esModule",{value:!0});Nl.JobsApiRoutesBatchGetBatchJobRequest$=Nl.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=Nl.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;Nl.jobsApiRoutesBatchGetBatchJobRequestToJSON=uRn;Nl.jobsApiRoutesBatchGetBatchJobRequestFromJSON=lRn;var bhe=aRn(Ie()),uYt=Ke(),sRn=Ce();Nl.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=bhe.object({job_id:bhe.string()}).transform(t=>(0,uYt.remap)(t,{job_id:"jobId"}));Nl.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=bhe.object({jobId:bhe.string()}).transform(t=>(0,uYt.remap)(t,{jobId:"job_id"}));var sYt;(function(t){t.inboundSchema=Nl.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=Nl.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(sYt||(Nl.JobsApiRoutesBatchGetBatchJobRequest$=sYt={}));function uRn(t){return JSON.stringify(Nl.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function lRn(t){return(0,sRn.safeParse)(t,e=>Nl.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var mYt=x(jl=>{"use strict";var cRn=jl&&jl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dRn=jl&&jl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dYt=jl&&jl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cRn(e,t,r);return dRn(e,t),e};Object.defineProperty(jl,"__esModule",{value:!0});jl.JobsApiRoutesBatchGetBatchJobsRequest$=jl.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=jl.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;jl.jobsApiRoutesBatchGetBatchJobsRequestToJSON=pRn;jl.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=mRn;var Ya=dYt(Ie()),fYt=Ke(),fRn=Ce(),pYt=dYt(no());jl.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=Ya.object({page:Ya.number().int().default(0),page_size:Ya.number().int().default(100),model:Ya.nullable(Ya.string()).optional(),metadata:Ya.nullable(Ya.record(Ya.any())).optional(),created_after:Ya.nullable(Ya.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Ya.boolean().default(!1),status:Ya.nullable(pYt.BatchJobStatus$inboundSchema).optional()}).transform(t=>(0,fYt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe"}));jl.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Ya.object({page:Ya.number().int().default(0),pageSize:Ya.number().int().default(100),model:Ya.nullable(Ya.string()).optional(),metadata:Ya.nullable(Ya.record(Ya.any())).optional(),createdAfter:Ya.nullable(Ya.date().transform(t=>t.toISOString())).optional(),createdByMe:Ya.boolean().default(!1),status:Ya.nullable(pYt.BatchJobStatus$outboundSchema).optional()}).transform(t=>(0,fYt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me"}));var cYt;(function(t){t.inboundSchema=jl.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=jl.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(cYt||(jl.JobsApiRoutesBatchGetBatchJobsRequest$=cYt={}));function pRn(t){return JSON.stringify(jl.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function mRn(t){return(0,fRn.safeParse)(t,e=>jl.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var yYt=x(Dl=>{"use strict";var hRn=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]}),gRn=Dl&&Dl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yRn=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)&&hRn(e,t,r);return gRn(e,t),e};Object.defineProperty(Dl,"__esModule",{value:!0});Dl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=Dl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=Dl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;Dl.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=_Rn;Dl.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=vRn;var _he=yRn(Ie()),gYt=Ke(),bRn=Ce();Dl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=_he.object({model_id:_he.string()}).transform(t=>(0,gYt.remap)(t,{model_id:"modelId"}));Dl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=_he.object({modelId:_he.string()}).transform(t=>(0,gYt.remap)(t,{modelId:"model_id"}));var hYt;(function(t){t.inboundSchema=Dl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=Dl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(hYt||(Dl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=hYt={}));function _Rn(t){return JSON.stringify(Dl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function vRn(t){return(0,bRn.safeParse)(t,e=>Dl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var vYt=x(Ll=>{"use strict";var wRn=Ll&&Ll.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xRn=Ll&&Ll.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SRn=Ll&&Ll.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wRn(e,t,r);return xRn(e,t),e};Object.defineProperty(Ll,"__esModule",{value:!0});Ll.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=Ll.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=Ll.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;Ll.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=ORn;Ll.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=ERn;var vhe=SRn(Ie()),_Yt=Ke(),CRn=Ce();Ll.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=vhe.object({job_id:vhe.string()}).transform(t=>(0,_Yt.remap)(t,{job_id:"jobId"}));Ll.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=vhe.object({jobId:vhe.string()}).transform(t=>(0,_Yt.remap)(t,{jobId:"job_id"}));var bYt;(function(t){t.inboundSchema=Ll.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=Ll.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(bYt||(Ll.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=bYt={}));function ORn(t){return JSON.stringify(Ll.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function ERn(t){return(0,CRn.safeParse)(t,e=>Ll.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}});var CYt=x(Fl=>{"use strict";var PRn=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]}),TRn=Fl&&Fl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xYt=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)&&PRn(e,t,r);return TRn(e,t),e};Object.defineProperty(Fl,"__esModule",{value:!0});Fl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=Fl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Fl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=void 0;Fl.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=IRn;Fl.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=MRn;var SYt=xYt(Ie()),ARn=Ce(),whe=xYt(no());Fl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=SYt.union([whe.LegacyJobMetadataOut$inboundSchema,whe.JobOut$inboundSchema]);Fl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=SYt.union([whe.LegacyJobMetadataOut$outboundSchema,whe.JobOut$outboundSchema]);var wYt;(function(t){t.inboundSchema=Fl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=Fl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(wYt||(Fl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=wYt={}));function IRn(t){return JSON.stringify(Fl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function MRn(t){return(0,ARn.safeParse)(t,e=>Fl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var PYt=x(kl=>{"use strict";var RRn=kl&&kl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NRn=kl&&kl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jRn=kl&&kl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RRn(e,t,r);return NRn(e,t),e};Object.defineProperty(kl,"__esModule",{value:!0});kl.JobsApiRoutesFineTuningGetFineTuningJobRequest$=kl.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=kl.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;kl.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=LRn;kl.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=FRn;var xhe=jRn(Ie()),EYt=Ke(),DRn=Ce();kl.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=xhe.object({job_id:xhe.string()}).transform(t=>(0,EYt.remap)(t,{job_id:"jobId"}));kl.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=xhe.object({jobId:xhe.string()}).transform(t=>(0,EYt.remap)(t,{jobId:"job_id"}));var OYt;(function(t){t.inboundSchema=kl.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=kl.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(OYt||(kl.JobsApiRoutesFineTuningGetFineTuningJobRequest$=OYt={}));function LRn(t){return JSON.stringify(kl.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function FRn(t){return(0,DRn.safeParse)(t,e=>kl.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}});var MYt=x(Io=>{"use strict";var kRn=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]}),$Rn=Io&&Io.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BRn=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)&&kRn(e,t,r);return $Rn(e,t),e};Object.defineProperty(Io,"__esModule",{value:!0});Io.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=Io.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Io.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Io.Status$=Io.Status$outboundSchema=Io.Status$inboundSchema=Io.Status=void 0;Io.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=URn;Io.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=qRn;var Oi=BRn(Ie()),IYt=Ke(),zRn=Ce();Io.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Io.Status$inboundSchema=Oi.nativeEnum(Io.Status);Io.Status$outboundSchema=Io.Status$inboundSchema;var TYt;(function(t){t.inboundSchema=Io.Status$inboundSchema,t.outboundSchema=Io.Status$outboundSchema})(TYt||(Io.Status$=TYt={}));Io.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Oi.object({page:Oi.number().int().default(0),page_size:Oi.number().int().default(100),model:Oi.nullable(Oi.string()).optional(),created_after:Oi.nullable(Oi.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Oi.boolean().default(!1),status:Oi.nullable(Io.Status$inboundSchema).optional(),wandb_project:Oi.nullable(Oi.string()).optional(),wandb_name:Oi.nullable(Oi.string()).optional(),suffix:Oi.nullable(Oi.string()).optional()}).transform(t=>(0,IYt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));Io.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Oi.object({page:Oi.number().int().default(0),pageSize:Oi.number().int().default(100),model:Oi.nullable(Oi.string()).optional(),createdAfter:Oi.nullable(Oi.date().transform(t=>t.toISOString())).optional(),createdByMe:Oi.boolean().default(!1),status:Oi.nullable(Io.Status$outboundSchema).optional(),wandbProject:Oi.nullable(Oi.string()).optional(),wandbName:Oi.nullable(Oi.string()).optional(),suffix:Oi.nullable(Oi.string()).optional()}).transform(t=>(0,IYt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var AYt;(function(t){t.inboundSchema=Io.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=Io.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(AYt||(Io.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=AYt={}));function URn(t){return JSON.stringify(Io.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function qRn(t){return(0,zRn.safeParse)(t,e=>Io.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var jYt=x($l=>{"use strict";var HRn=$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]}),VRn=$l&&$l.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WRn=$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)&&HRn(e,t,r);return VRn(e,t),e};Object.defineProperty($l,"__esModule",{value:!0});$l.JobsApiRoutesFineTuningStartFineTuningJobRequest$=$l.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=$l.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;$l.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=GRn;$l.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=JRn;var She=WRn(Ie()),NYt=Ke(),KRn=Ce();$l.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=She.object({job_id:She.string()}).transform(t=>(0,NYt.remap)(t,{job_id:"jobId"}));$l.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=She.object({jobId:She.string()}).transform(t=>(0,NYt.remap)(t,{jobId:"job_id"}));var RYt;(function(t){t.inboundSchema=$l.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=$l.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(RYt||($l.JobsApiRoutesFineTuningStartFineTuningJobRequest$=RYt={}));function GRn(t){return JSON.stringify($l.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function JRn(t){return(0,KRn.safeParse)(t,e=>$l.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}});var FYt=x(Bl=>{"use strict";var ZRn=Bl&&Bl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YRn=Bl&&Bl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XRn=Bl&&Bl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZRn(e,t,r);return YRn(e,t),e};Object.defineProperty(Bl,"__esModule",{value:!0});Bl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=Bl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=Bl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;Bl.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=e1n;Bl.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=t1n;var Che=XRn(Ie()),LYt=Ke(),QRn=Ce();Bl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=Che.object({model_id:Che.string()}).transform(t=>(0,LYt.remap)(t,{model_id:"modelId"}));Bl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=Che.object({modelId:Che.string()}).transform(t=>(0,LYt.remap)(t,{modelId:"model_id"}));var DYt;(function(t){t.inboundSchema=Bl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=Bl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(DYt||(Bl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=DYt={}));function e1n(t){return JSON.stringify(Bl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function t1n(t){return(0,QRn.safeParse)(t,e=>Bl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var UYt=x(zl=>{"use strict";var r1n=zl&&zl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n1n=zl&&zl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Yt=zl&&zl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&r1n(e,t,r);return n1n(e,t),e};Object.defineProperty(zl,"__esModule",{value:!0});zl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=zl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=zl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;zl.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=i1n;zl.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=a1n;var Ohe=$Yt(Ie()),BYt=Ke(),o1n=Ce(),zYt=$Yt(no());zl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=Ohe.object({model_id:Ohe.string(),UpdateFTModelIn:zYt.UpdateFTModelIn$inboundSchema}).transform(t=>(0,BYt.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));zl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Ohe.object({modelId:Ohe.string(),updateFTModelIn:zYt.UpdateFTModelIn$outboundSchema}).transform(t=>(0,BYt.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var kYt;(function(t){t.inboundSchema=zl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=zl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(kYt||(zl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=kYt={}));function i1n(t){return JSON.stringify(zl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function a1n(t){return(0,o1n.safeParse)(t,e=>zl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}});var GYt=x(di=>{"use strict";var s1n=di&&di.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u1n=di&&di.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VYt=di&&di.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s1n(e,t,r);return u1n(e,t),e};Object.defineProperty(di,"__esModule",{value:!0});di.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=di.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=di.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=di.RetrieveModelV1ModelsModelIdGetRequest$=di.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=di.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;di.retrieveModelV1ModelsModelIdGetRequestToJSON=l1n;di.retrieveModelV1ModelsModelIdGetRequestFromJSON=c1n;di.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=d1n;di.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=f1n;var dh=VYt(Ie()),WYt=Ke(),KYt=Ce(),Ehe=VYt(no());di.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=dh.object({model_id:dh.string()}).transform(t=>(0,WYt.remap)(t,{model_id:"modelId"}));di.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=dh.object({modelId:dh.string()}).transform(t=>(0,WYt.remap)(t,{modelId:"model_id"}));var qYt;(function(t){t.inboundSchema=di.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=di.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(qYt||(di.RetrieveModelV1ModelsModelIdGetRequest$=qYt={}));function l1n(t){return JSON.stringify(di.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function c1n(t){return(0,KYt.safeParse)(t,e=>di.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}di.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=dh.union([Ehe.BaseModelCard$inboundSchema.and(dh.object({type:dh.literal("base")}).transform(t=>({type:t.type}))),Ehe.FTModelCard$inboundSchema.and(dh.object({type:dh.literal("fine-tuned")}).transform(t=>({type:t.type})))]);di.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=dh.union([Ehe.BaseModelCard$outboundSchema.and(dh.object({type:dh.literal("base")}).transform(t=>({type:t.type}))),Ehe.FTModelCard$outboundSchema.and(dh.object({type:dh.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var HYt;(function(t){t.inboundSchema=di.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=di.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(HYt||(di.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=HYt={}));function d1n(t){return JSON.stringify(di.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function f1n(t){return(0,KYt.safeParse)(t,e=>di.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var Ul=x(Ra=>{"use strict";var p1n=Ra&&Ra.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xc=Ra&&Ra.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&p1n(e,t,r)};Object.defineProperty(Ra,"__esModule",{value:!0});xc(jZt(),Ra);xc(FZt(),Ra);xc(BZt(),Ra);xc(qZt(),Ra);xc(KZt(),Ra);xc(ZZt(),Ra);xc(nYt(),Ra);xc(aYt(),Ra);xc(lYt(),Ra);xc(mYt(),Ra);xc(yYt(),Ra);xc(vYt(),Ra);xc(CYt(),Ra);xc(PYt(),Ra);xc(MYt(),Ra);xc(jYt(),Ra);xc(FYt(),Ra);xc(UYt(),Ra);xc(GYt(),Ra)});var ZYt=x(gT=>{"use strict";var m1n=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]}),h1n=gT&&gT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C3e=gT&&gT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&m1n(e,t,r);return h1n(e,t),e};Object.defineProperty(gT,"__esModule",{value:!0});gT.batchJobsCancel=x1n;var g1n=wi(),Phe=C3e(xi()),y1n=Ke(),b1n=Ce(),JYt=Si(),_1n=Uo(),v1n=C3e(no()),w1n=C3e(Ul());async function x1n(t,e,r){let n=(0,b1n.safeParse)(e,_=>w1n.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,g1n.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,_1n.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,y1n.compactMap)({Accept:"application/json"})),l=await(0,JYt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,JYt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Phe.match(Phe.json(200,v1n.BatchJobOut$inboundSchema),Phe.fail("4XX"),Phe.fail("5XX"))(g);return y.ok,y}});var eXt=x(yT=>{"use strict";var S1n=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]}),C1n=yT&&yT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QYt=yT&&yT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&S1n(e,t,r);return C1n(e,t),e};Object.defineProperty(yT,"__esModule",{value:!0});yT.batchJobsCreate=A1n;var O1n=wi(),The=QYt(xi()),E1n=Ke(),P1n=Ce(),YYt=Si(),T1n=Uo(),XYt=QYt(no());async function A1n(t,e,r){let n=(0,P1n.safeParse)(e,y=>XYt.BatchJobIn$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,O1n.encodeJSON)("body",o,{explode:!0}),a=(0,T1n.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,E1n.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,YYt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,YYt.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,h=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,[g]=await The.match(The.json(200,XYt.BatchJobOut$inboundSchema),The.fail("4XX"),The.fail("5XX"))(m);return g.ok,g}});var rXt=x(bT=>{"use strict";var I1n=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]}),M1n=bT&&bT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O3e=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)&&I1n(e,t,r);return M1n(e,t),e};Object.defineProperty(bT,"__esModule",{value:!0});bT.batchJobsGet=k1n;var R1n=wi(),Ahe=O3e(xi()),N1n=Ke(),j1n=Ce(),tXt=Si(),D1n=Uo(),L1n=O3e(no()),F1n=O3e(Ul());async function k1n(t,e,r){let n=(0,j1n.safeParse)(e,_=>F1n.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,R1n.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,D1n.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,N1n.compactMap)({Accept:"application/json"})),l=await(0,tXt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,tXt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Ahe.match(Ahe.json(200,L1n.BatchJobOut$inboundSchema),Ahe.fail("4XX"),Ahe.fail("5XX"))(g);return y.ok,y}});var oXt=x(_T=>{"use strict";var $1n=_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]}),B1n=_T&&_T.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E3e=_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)&&$1n(e,t,r);return B1n(e,t),e};Object.defineProperty(_T,"__esModule",{value:!0});_T.batchJobsList=K1n;var z1n=wi(),Ihe=E3e(xi()),U1n=Ke(),q1n=Ce(),nXt=Si(),H1n=Uo(),V1n=E3e(no()),W1n=E3e(Ul());async function K1n(t,e,r){let n=(0,q1n.safeParse)(e,_=>W1n.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,H1n.pathToFunc)("/v1/batch/jobs")(),s=(0,z1n.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,U1n.compactMap)({Accept:"application/json"})),l=await(0,nXt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,nXt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Ihe.match(Ihe.json(200,V1n.BatchJobsOut$inboundSchema),Ihe.fail("4XX"),Ihe.fail("5XX"))(g);return y.ok,y}});var iXt=x(Rhe=>{"use strict";Object.defineProperty(Rhe,"__esModule",{value:!0});Rhe.MistralJobs=void 0;var G1n=ZYt(),J1n=eXt(),Z1n=rXt(),Y1n=oXt(),X1n=hg(),Mhe=Dy(),P3e=class extends X1n.ClientSDK{async list(e,r){return(0,Mhe.unwrapAsync)((0,Y1n.batchJobsList)(this,e,r))}async create(e,r){return(0,Mhe.unwrapAsync)((0,J1n.batchJobsCreate)(this,e,r))}async get(e,r){return(0,Mhe.unwrapAsync)((0,Z1n.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,Mhe.unwrapAsync)((0,G1n.batchJobsCancel)(this,e,r))}};Rhe.MistralJobs=P3e});var aXt=x(Nhe=>{"use strict";Object.defineProperty(Nhe,"__esModule",{value:!0});Nhe.Batch=void 0;var Q1n=hg(),eNn=iXt(),T3e=class extends Q1n.ClientSDK{get jobs(){return this._jobs??(this._jobs=new eNn.MistralJobs(this._options))}};Nhe.Batch=T3e});var lXt=x(vT=>{"use strict";var tNn=vT&&vT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rNn=vT&&vT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A3e=vT&&vT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tNn(e,t,r);return rNn(e,t),e};Object.defineProperty(vT,"__esModule",{value:!0});vT.chatComplete=uNn;var nNn=wi(),kJ=A3e(xi()),oNn=Ke(),iNn=Ce(),sXt=Si(),aNn=Uo(),uXt=A3e(no()),sNn=A3e(yg());async function uNn(t,e,r){let n=(0,iNn.safeParse)(e,_=>uXt.ChatCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,nNn.encodeJSON)("body",o,{explode:!0}),a=(0,aNn.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,oNn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,sXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,sXt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await kJ.match(kJ.json(200,uXt.ChatCompletionResponse$inboundSchema),kJ.jsonErr(422,sNn.HTTPValidationError$inboundSchema),kJ.fail("4XX"),kJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var fXt=x(wT=>{"use strict";var lNn=wT&&wT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=wT&&wT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jhe=wT&&wT.__importStar||function(t){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(wT,"__esModule",{value:!0});wT.chatStream=bNn;var dNn=jhe(Ie()),fNn=wi(),pNn=EJ(),$J=jhe(xi()),mNn=Ke(),hNn=Ce(),cXt=Si(),gNn=Uo(),dXt=jhe(no()),yNn=jhe(yg());async function bNn(t,e,r){let n=(0,hNn.safeParse)(e,_=>dXt.ChatCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,fNn.encodeJSON)("body",o,{explode:!0}),a=(0,gNn.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,mNn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,cXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,cXt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await $J.match($J.sse(200,dNn.instanceof(ReadableStream).transform(_=>new pNn.EventStream({stream:_,decoder(w){return dXt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),$J.jsonErr(422,yNn.HTTPValidationError$inboundSchema),$J.fail("4XX"),$J.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var Dhe=x(RO=>{"use strict";Object.defineProperty(RO,"__esModule",{value:!0});RO.getDefaultOptions=RO.defaultOptions=RO.ignoreOverride=void 0;RO.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");RO.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 _Nn=t=>typeof t=="string"?{...RO.defaultOptions,name:t}:{...RO.defaultOptions,...t};RO.getDefaultOptions=_Nn});var I3e=x(Lhe=>{"use strict";Object.defineProperty(Lhe,"__esModule",{value:!0});Lhe.getRefs=void 0;var vNn=Dhe(),wNn=t=>{let e=(0,vNn.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}]))}};Lhe.getRefs=wNn});var a1=x(Q3=>{"use strict";Object.defineProperty(Q3,"__esModule",{value:!0});Q3.setResponseValueAndErrors=Q3.addErrorMessage=void 0;function pXt(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}Q3.addErrorMessage=pXt;function xNn(t,e,r,n,o){t[e]=r,pXt(t,e,n,o)}Q3.setResponseValueAndErrors=xNn});var M3e=x(Fhe=>{"use strict";Object.defineProperty(Fhe,"__esModule",{value:!0});Fhe.parseAnyDef=void 0;function SNn(){return{}}Fhe.parseAnyDef=SNn});var R3e=x($he=>{"use strict";Object.defineProperty($he,"__esModule",{value:!0});$he.parseArrayDef=void 0;var CNn=Ie(),khe=a1(),ONn=ql();function ENn(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==CNn.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,ONn.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,khe.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,khe.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,khe.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,khe.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}$he.parseArrayDef=ENn});var N3e=x(Bhe=>{"use strict";Object.defineProperty(Bhe,"__esModule",{value:!0});Bhe.parseBigintDef=void 0;var Rk=a1();function PNn(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,Rk.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,Rk.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,Rk.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,Rk.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,Rk.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,Rk.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,Rk.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}Bhe.parseBigintDef=PNn});var j3e=x(zhe=>{"use strict";Object.defineProperty(zhe,"__esModule",{value:!0});zhe.parseBooleanDef=void 0;function TNn(){return{type:"boolean"}}zhe.parseBooleanDef=TNn});var qhe=x(Uhe=>{"use strict";Object.defineProperty(Uhe,"__esModule",{value:!0});Uhe.parseBrandedDef=void 0;var ANn=ql();function INn(t,e){return(0,ANn.parseDef)(t.type._def,e)}Uhe.parseBrandedDef=INn});var D3e=x(Hhe=>{"use strict";Object.defineProperty(Hhe,"__esModule",{value:!0});Hhe.parseCatchDef=void 0;var MNn=ql(),RNn=(t,e)=>(0,MNn.parseDef)(t.innerType._def,e);Hhe.parseCatchDef=RNn});var L3e=x(Vhe=>{"use strict";Object.defineProperty(Vhe,"__esModule",{value:!0});Vhe.parseDateDef=void 0;var mXt=a1();function hXt(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>hXt(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 NNn(t,e)}}Vhe.parseDateDef=hXt;var NNn=(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,mXt.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,mXt.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var F3e=x(Whe=>{"use strict";Object.defineProperty(Whe,"__esModule",{value:!0});Whe.parseDefaultDef=void 0;var jNn=ql();function DNn(t,e){return{...(0,jNn.parseDef)(t.innerType._def,e),default:t.defaultValue()}}Whe.parseDefaultDef=DNn});var k3e=x(Khe=>{"use strict";Object.defineProperty(Khe,"__esModule",{value:!0});Khe.parseEffectsDef=void 0;var LNn=ql();function FNn(t,e){return e.effectStrategy==="input"?(0,LNn.parseDef)(t.schema._def,e):{}}Khe.parseEffectsDef=FNn});var $3e=x(Ghe=>{"use strict";Object.defineProperty(Ghe,"__esModule",{value:!0});Ghe.parseEnumDef=void 0;function kNn(t){return{type:"string",enum:Array.from(t.values)}}Ghe.parseEnumDef=kNn});var B3e=x(Jhe=>{"use strict";Object.defineProperty(Jhe,"__esModule",{value:!0});Jhe.parseIntersectionDef=void 0;var gXt=ql(),$Nn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function BNn(t,e){let r=[(0,gXt.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,gXt.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($Nn(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}Jhe.parseIntersectionDef=BNn});var z3e=x(Zhe=>{"use strict";Object.defineProperty(Zhe,"__esModule",{value:!0});Zhe.parseLiteralDef=void 0;function zNn(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}}Zhe.parseLiteralDef=zNn});var Yhe=x(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.parseStringDef=Qd.zodPatterns=void 0;var Nk=a1(),U3e;Qd.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:()=>(U3e===void 0&&(U3e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),U3e),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 UNn(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":(0,Nk.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":(0,Nk.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":j_(r,"email",n.message,e);break;case"format:idn-email":j_(r,"idn-email",n.message,e);break;case"pattern:zod":Jp(r,Qd.zodPatterns.email,n.message,e);break}break;case"url":j_(r,"uri",n.message,e);break;case"uuid":j_(r,"uuid",n.message,e);break;case"regex":Jp(r,n.regex,n.message,e);break;case"cuid":Jp(r,Qd.zodPatterns.cuid,n.message,e);break;case"cuid2":Jp(r,Qd.zodPatterns.cuid2,n.message,e);break;case"startsWith":Jp(r,RegExp(`^${q3e(n.value,e)}`),n.message,e);break;case"endsWith":Jp(r,RegExp(`${q3e(n.value,e)}$`),n.message,e);break;case"datetime":j_(r,"date-time",n.message,e);break;case"date":j_(r,"date",n.message,e);break;case"time":j_(r,"time",n.message,e);break;case"duration":j_(r,"duration",n.message,e);break;case"length":(0,Nk.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),(0,Nk.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Jp(r,RegExp(q3e(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&j_(r,"ipv4",n.message,e),n.version!=="v4"&&j_(r,"ipv6",n.message,e);break}case"base64url":Jp(r,Qd.zodPatterns.base64url,n.message,e);break;case"jwt":Jp(r,Qd.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Jp(r,Qd.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&Jp(r,Qd.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":Jp(r,Qd.zodPatterns.emoji(),n.message,e);break;case"ulid":{Jp(r,Qd.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{j_(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,Nk.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Jp(r,Qd.zodPatterns.base64,n.message,e);break}}break}case"nanoid":Jp(r,Qd.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}Qd.parseStringDef=UNn;function q3e(t,e){return e.patternStrategy==="escape"?HNn(t):t}var qNn=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function HNn(t){let e="";for(let r=0;r<t.length;r++)qNn.has(t[r])||(e+="\\"),e+=t[r];return e}function j_(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,Nk.setResponseValueAndErrors)(t,"format",e,r,n)}function Jp(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:yXt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,Nk.setResponseValueAndErrors)(t,"pattern",yXt(e,n),r,n)}function yXt(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 Qhe=x(Xhe=>{"use strict";Object.defineProperty(Xhe,"__esModule",{value:!0});Xhe.parseRecordDef=void 0;var BJ=Ie(),bXt=ql(),VNn=Yhe(),WNn=qhe();function KNn(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===BJ.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,bXt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,bXt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===BJ.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,VNn.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===BJ.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===BJ.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===BJ.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,WNn.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}Xhe.parseRecordDef=KNn});var H3e=x(ege=>{"use strict";Object.defineProperty(ege,"__esModule",{value:!0});ege.parseMapDef=void 0;var _Xt=ql(),GNn=Qhe();function JNn(t,e){if(e.mapStrategy==="record")return(0,GNn.parseRecordDef)(t,e);let r=(0,_Xt.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,_Xt.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}}}ege.parseMapDef=JNn});var V3e=x(tge=>{"use strict";Object.defineProperty(tge,"__esModule",{value:!0});tge.parseNativeEnumDef=void 0;function ZNn(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}}tge.parseNativeEnumDef=ZNn});var W3e=x(rge=>{"use strict";Object.defineProperty(rge,"__esModule",{value:!0});rge.parseNeverDef=void 0;function YNn(){return{not:{}}}rge.parseNeverDef=YNn});var K3e=x(nge=>{"use strict";Object.defineProperty(nge,"__esModule",{value:!0});nge.parseNullDef=void 0;function XNn(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}nge.parseNullDef=XNn});var oge=x(s1=>{"use strict";Object.defineProperty(s1,"__esModule",{value:!0});s1.parseUnionDef=s1.primitiveMappings=void 0;var QNn=ql();s1.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ejn(t,e){if(e.target==="openApi3")return vXt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in s1.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=s1.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 vXt(t,e)}s1.parseUnionDef=ejn;var vXt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,QNn.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 G3e=x(ige=>{"use strict";Object.defineProperty(ige,"__esModule",{value:!0});ige.parseNullableDef=void 0;var wXt=ql(),xXt=oge();function tjn(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:xXt.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[xXt.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,wXt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,wXt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}ige.parseNullableDef=tjn});var J3e=x(age=>{"use strict";Object.defineProperty(age,"__esModule",{value:!0});age.parseNumberDef=void 0;var u1=a1();function rjn(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,u1.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,u1.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,u1.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,u1.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,u1.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,u1.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,u1.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,u1.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}age.parseNumberDef=rjn});var Y3e=x(sge=>{"use strict";Object.defineProperty(sge,"__esModule",{value:!0});sge.parseObjectDef=void 0;var njn=Ie(),Z3e=ql();function ojn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,Z3e.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,Z3e.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function ijn(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 njn.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,Z3e.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:ojn(t,e)};return n.required.length||delete n.required,n}sge.parseObjectDef=ijn});var X3e=x(uge=>{"use strict";Object.defineProperty(uge,"__esModule",{value:!0});uge.parseOptionalDef=void 0;var SXt=ql(),ajn=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,SXt.parseDef)(t.innerType._def,e);let r=(0,SXt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};uge.parseOptionalDef=ajn});var Q3e=x(cge=>{"use strict";Object.defineProperty(cge,"__esModule",{value:!0});cge.parsePipelineDef=void 0;var lge=ql(),sjn=(t,e)=>{if(e.pipeStrategy==="input")return(0,lge.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,lge.parseDef)(t.out._def,e);let r=(0,lge.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,lge.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};cge.parsePipelineDef=sjn});var eHe=x(dge=>{"use strict";Object.defineProperty(dge,"__esModule",{value:!0});dge.parsePromiseDef=void 0;var ujn=ql();function ljn(t,e){return(0,ujn.parseDef)(t.type._def,e)}dge.parsePromiseDef=ljn});var tHe=x(fge=>{"use strict";Object.defineProperty(fge,"__esModule",{value:!0});fge.parseSetDef=void 0;var CXt=a1(),cjn=ql();function djn(t,e){let n={type:"array",uniqueItems:!0,items:(0,cjn.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,CXt.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,CXt.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}fge.parseSetDef=djn});var nHe=x(pge=>{"use strict";Object.defineProperty(pge,"__esModule",{value:!0});pge.parseTupleDef=void 0;var rHe=ql();function fjn(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,rHe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,rHe.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,rHe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}pge.parseTupleDef=fjn});var oHe=x(mge=>{"use strict";Object.defineProperty(mge,"__esModule",{value:!0});mge.parseUndefinedDef=void 0;function pjn(){return{not:{}}}mge.parseUndefinedDef=pjn});var iHe=x(hge=>{"use strict";Object.defineProperty(hge,"__esModule",{value:!0});hge.parseUnknownDef=void 0;function mjn(){return{}}hge.parseUnknownDef=mjn});var aHe=x(gge=>{"use strict";Object.defineProperty(gge,"__esModule",{value:!0});gge.parseReadonlyDef=void 0;var hjn=ql(),gjn=(t,e)=>(0,hjn.parseDef)(t.innerType._def,e);gge.parseReadonlyDef=gjn});var ql=x(yge=>{"use strict";Object.defineProperty(yge,"__esModule",{value:!0});yge.parseDef=void 0;var oo=Ie(),yjn=M3e(),bjn=R3e(),_jn=N3e(),vjn=j3e(),wjn=qhe(),xjn=D3e(),Sjn=L3e(),Cjn=F3e(),Ojn=k3e(),Ejn=$3e(),Pjn=B3e(),Tjn=z3e(),Ajn=H3e(),Ijn=V3e(),Mjn=W3e(),Rjn=K3e(),Njn=G3e(),jjn=J3e(),Djn=Y3e(),Ljn=X3e(),Fjn=Q3e(),kjn=eHe(),$jn=Qhe(),Bjn=tHe(),zjn=Yhe(),Ujn=nHe(),qjn=oHe(),Hjn=oge(),Vjn=iHe(),Wjn=aHe(),Kjn=Dhe();function OXt(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==Kjn.ignoreOverride)return a}if(n&&!r){let a=Gjn(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=Zjn(t,t.typeName,e);return i&&Yjn(t,e,i),o.jsonSchema=i,i}yge.parseDef=OXt;var Gjn=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Jjn(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}},Jjn=(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("/")},Zjn=(t,e,r)=>{switch(e){case oo.ZodFirstPartyTypeKind.ZodString:return(0,zjn.parseStringDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodNumber:return(0,jjn.parseNumberDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodObject:return(0,Djn.parseObjectDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodBigInt:return(0,_jn.parseBigintDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodBoolean:return(0,vjn.parseBooleanDef)();case oo.ZodFirstPartyTypeKind.ZodDate:return(0,Sjn.parseDateDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodUndefined:return(0,qjn.parseUndefinedDef)();case oo.ZodFirstPartyTypeKind.ZodNull:return(0,Rjn.parseNullDef)(r);case oo.ZodFirstPartyTypeKind.ZodArray:return(0,bjn.parseArrayDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodUnion:case oo.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,Hjn.parseUnionDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodIntersection:return(0,Pjn.parseIntersectionDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodTuple:return(0,Ujn.parseTupleDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodRecord:return(0,$jn.parseRecordDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodLiteral:return(0,Tjn.parseLiteralDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodEnum:return(0,Ejn.parseEnumDef)(t);case oo.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,Ijn.parseNativeEnumDef)(t);case oo.ZodFirstPartyTypeKind.ZodNullable:return(0,Njn.parseNullableDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodOptional:return(0,Ljn.parseOptionalDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodMap:return(0,Ajn.parseMapDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodSet:return(0,Bjn.parseSetDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodLazy:return OXt(t.getter()._def,r);case oo.ZodFirstPartyTypeKind.ZodPromise:return(0,kjn.parsePromiseDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodNaN:case oo.ZodFirstPartyTypeKind.ZodNever:return(0,Mjn.parseNeverDef)();case oo.ZodFirstPartyTypeKind.ZodEffects:return(0,Ojn.parseEffectsDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodAny:return(0,yjn.parseAnyDef)();case oo.ZodFirstPartyTypeKind.ZodUnknown:return(0,Vjn.parseUnknownDef)();case oo.ZodFirstPartyTypeKind.ZodDefault:return(0,Cjn.parseDefaultDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodBranded:return(0,wjn.parseBrandedDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodReadonly:return(0,Wjn.parseReadonlyDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodCatch:return(0,xjn.parseCatchDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodPipeline:return(0,Fjn.parsePipelineDef)(t,r);case oo.ZodFirstPartyTypeKind.ZodFunction:case oo.ZodFirstPartyTypeKind.ZodVoid:case oo.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},Yjn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var sHe=x(bge=>{"use strict";Object.defineProperty(bge,"__esModule",{value:!0});bge.zodToJsonSchema=void 0;var EXt=ql(),Xjn=I3e(),Qjn=(t,e)=>{let r=(0,Xjn.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:(0,EXt.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,EXt.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};bge.zodToJsonSchema=Qjn});var PXt=x(yn=>{"use strict";var eDn=yn&&yn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),go=yn&&yn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eDn(e,t,r)};Object.defineProperty(yn,"__esModule",{value:!0});go(Dhe(),yn);go(I3e(),yn);go(a1(),yn);go(ql(),yn);go(M3e(),yn);go(R3e(),yn);go(N3e(),yn);go(j3e(),yn);go(qhe(),yn);go(D3e(),yn);go(L3e(),yn);go(F3e(),yn);go(k3e(),yn);go($3e(),yn);go(B3e(),yn);go(z3e(),yn);go(H3e(),yn);go(V3e(),yn);go(W3e(),yn);go(K3e(),yn);go(G3e(),yn);go(J3e(),yn);go(Y3e(),yn);go(X3e(),yn);go(Q3e(),yn);go(eHe(),yn);go(aHe(),yn);go(Qhe(),yn);go(tHe(),yn);go(Yhe(),yn);go(nHe(),yn);go(oHe(),yn);go(oge(),yn);go(iHe(),yn);go(sHe(),yn);var tDn=sHe();yn.default=tDn.zodToJsonSchema});var AXt=x(zJ=>{"use strict";Object.defineProperty(zJ,"__esModule",{value:!0});zJ.transformToChatCompletionRequest=nDn;zJ.convertToParsedChatCompletionResponse=oDn;zJ.responseFormatFromZodObject=TXt;var rDn=PXt();function nDn(t){let{responseFormat:e,...r}=t,n=TXt(e);return{...r,responseFormat:n}}function oDn(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 TXt(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,rDn.zodToJsonSchema)(t),strict:!0}}}});var RXt=x(vge=>{"use strict";Object.defineProperty(vge,"__esModule",{value:!0});vge.Chat=void 0;var IXt=lXt(),MXt=fXt(),iDn=hg(),_ge=Dy(),uHe=AXt(),lHe=class extends iDn.ClientSDK{async parse(e,r){let n=(0,uHe.transformToChatCompletionRequest)(e),o=await(0,_ge.unwrapAsync)((0,IXt.chatComplete)(this,n,r));return(0,uHe.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,uHe.transformToChatCompletionRequest)(e);return(0,_ge.unwrapAsync)((0,MXt.chatStream)(this,n,r))}async complete(e,r){return(0,_ge.unwrapAsync)((0,IXt.chatComplete)(this,e,r))}async stream(e,r){return(0,_ge.unwrapAsync)((0,MXt.chatStream)(this,e,r))}};vge.Chat=lHe});var DXt=x(xT=>{"use strict";var aDn=xT&&xT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sDn=xT&&xT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cHe=xT&&xT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aDn(e,t,r);return sDn(e,t),e};Object.defineProperty(xT,"__esModule",{value:!0});xT.classifiersModerate=pDn;var uDn=wi(),UJ=cHe(xi()),lDn=Ke(),cDn=Ce(),NXt=Si(),dDn=Uo(),jXt=cHe(no()),fDn=cHe(yg());async function pDn(t,e,r){let n=(0,cDn.safeParse)(e,_=>jXt.ClassificationRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,uDn.encodeJSON)("body",o,{explode:!0}),a=(0,dDn.pathToFunc)("/v1/moderations")(),s=new Headers((0,lDn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,NXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,NXt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await UJ.match(UJ.json(200,jXt.ClassificationResponse$inboundSchema),UJ.jsonErr(422,fDn.HTTPValidationError$inboundSchema),UJ.fail("4XX"),UJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var kXt=x(ST=>{"use strict";var mDn=ST&&ST.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hDn=ST&&ST.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dHe=ST&&ST.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mDn(e,t,r);return hDn(e,t),e};Object.defineProperty(ST,"__esModule",{value:!0});ST.classifiersModerateChat=wDn;var gDn=wi(),qJ=dHe(xi()),yDn=Ke(),bDn=Ce(),LXt=Si(),_Dn=Uo(),FXt=dHe(no()),vDn=dHe(yg());async function wDn(t,e,r){let n=(0,bDn.safeParse)(e,_=>FXt.ChatClassificationRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,gDn.encodeJSON)("body",o,{explode:!0}),a=(0,_Dn.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,yDn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,LXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,LXt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await qJ.match(qJ.json(200,FXt.ClassificationResponse$inboundSchema),qJ.jsonErr(422,vDn.HTTPValidationError$inboundSchema),qJ.fail("4XX"),qJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var BXt=x(wge=>{"use strict";Object.defineProperty(wge,"__esModule",{value:!0});wge.Classifiers=void 0;var xDn=DXt(),SDn=kXt(),CDn=hg(),$Xt=Dy(),fHe=class extends CDn.ClientSDK{async moderate(e,r){return(0,$Xt.unwrapAsync)((0,xDn.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,$Xt.unwrapAsync)((0,SDn.classifiersModerateChat)(this,e,r))}};wge.Classifiers=fHe});var qXt=x(CT=>{"use strict";var ODn=CT&&CT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EDn=CT&&CT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pHe=CT&&CT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ODn(e,t,r);return EDn(e,t),e};Object.defineProperty(CT,"__esModule",{value:!0});CT.embeddingsCreate=RDn;var PDn=wi(),HJ=pHe(xi()),TDn=Ke(),ADn=Ce(),zXt=Si(),IDn=Uo(),UXt=pHe(no()),MDn=pHe(yg());async function RDn(t,e,r){let n=(0,ADn.safeParse)(e,_=>UXt.EmbeddingRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,PDn.encodeJSON)("body",o,{explode:!0}),a=(0,IDn.pathToFunc)("/v1/embeddings")(),s=new Headers((0,TDn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,zXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,zXt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await HJ.match(HJ.json(200,UXt.EmbeddingResponse$inboundSchema),HJ.jsonErr(422,MDn.HTTPValidationError$inboundSchema),HJ.fail("4XX"),HJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var HXt=x(xge=>{"use strict";Object.defineProperty(xge,"__esModule",{value:!0});xge.Embeddings=void 0;var NDn=qXt(),jDn=hg(),DDn=Dy(),mHe=class extends jDn.ClientSDK{async create(e,r){return(0,DDn.unwrapAsync)((0,NDn.embeddingsCreate)(this,e,r))}};xge.Embeddings=mHe});var WXt=x(OT=>{"use strict";var LDn=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]}),FDn=OT&&OT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hHe=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)&&LDn(e,t,r);return FDn(e,t),e};Object.defineProperty(OT,"__esModule",{value:!0});OT.filesDelete=HDn;var kDn=wi(),Sge=hHe(xi()),$Dn=Ke(),BDn=Ce(),VXt=Si(),zDn=Uo(),UDn=hHe(no()),qDn=hHe(Ul());async function HDn(t,e,r){let n=(0,BDn.safeParse)(e,_=>qDn.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,kDn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,zDn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,$Dn.compactMap)({Accept:"application/json"})),l=await(0,VXt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,VXt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Sge.match(Sge.json(200,UDn.DeleteFileOut$inboundSchema),Sge.fail("4XX"),Sge.fail("5XX"))(g);return y.ok,y}});var GXt=x(ET=>{"use strict";var VDn=ET&&ET.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WDn=ET&&ET.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gHe=ET&&ET.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VDn(e,t,r);return WDn(e,t),e};Object.defineProperty(ET,"__esModule",{value:!0});ET.filesDownload=QDn;var KDn=gHe(Ie()),GDn=wi(),Cge=gHe(xi()),JDn=Ke(),ZDn=Ce(),KXt=Si(),YDn=Uo(),XDn=gHe(Ul());async function QDn(t,e,r){let n=(0,ZDn.safeParse)(e,_=>XDn.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,GDn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,YDn.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,JDn.compactMap)({Accept:"application/octet-stream"})),l=await(0,KXt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,KXt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Cge.match(Cge.stream(200,KDn.instanceof(ReadableStream)),Cge.fail("4XX"),Cge.fail("5XX"))(g);return y.ok,y}});var YXt=x(PT=>{"use strict";var eLn=PT&&PT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tLn=PT&&PT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yHe=PT&&PT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eLn(e,t,r);return tLn(e,t),e};Object.defineProperty(PT,"__esModule",{value:!0});PT.filesGetSignedUrl=sLn;var JXt=wi(),Oge=yHe(xi()),rLn=Ke(),nLn=Ce(),ZXt=Si(),oLn=Uo(),iLn=yHe(no()),aLn=yHe(Ul());async function sLn(t,e,r){let n=(0,nLn.safeParse)(e,w=>aLn.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,JXt.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,oLn.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,JXt.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,rLn.compactMap)({Accept:"application/json"})),c=await(0,ZXt.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,ZXt.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"]},h=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(!h.ok)return h;let m=h.value,g=await t._do(m,{context:p,errorCodes:["4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!g.ok)return g;let y=g.value,[_]=await Oge.match(Oge.json(200,iLn.FileSignedURL$inboundSchema),Oge.fail("4XX"),Oge.fail("5XX"))(y);return _.ok,_}});var QXt=x(TT=>{"use strict";var uLn=TT&&TT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lLn=TT&&TT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bHe=TT&&TT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uLn(e,t,r);return lLn(e,t),e};Object.defineProperty(TT,"__esModule",{value:!0});TT.filesList=gLn;var cLn=wi(),Ege=bHe(xi()),dLn=Ke(),fLn=Ce(),XXt=Si(),pLn=Uo(),mLn=bHe(no()),hLn=bHe(Ul());async function gLn(t,e,r){let n=(0,fLn.safeParse)(e,_=>hLn.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,pLn.pathToFunc)("/v1/files")(),s=(0,cLn.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,dLn.compactMap)({Accept:"application/json"})),l=await(0,XXt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,XXt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Ege.match(Ege.json(200,mLn.ListFilesOut$inboundSchema),Ege.fail("4XX"),Ege.fail("5XX"))(g);return y.ok,y}});var tQt=x(AT=>{"use strict";var yLn=AT&&AT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bLn=AT&&AT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_He=AT&&AT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yLn(e,t,r);return bLn(e,t),e};Object.defineProperty(AT,"__esModule",{value:!0});AT.filesRetrieve=OLn;var _Ln=wi(),Pge=_He(xi()),vLn=Ke(),wLn=Ce(),eQt=Si(),xLn=Uo(),SLn=_He(no()),CLn=_He(Ul());async function OLn(t,e,r){let n=(0,wLn.safeParse)(e,_=>CLn.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,_Ln.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,xLn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,vLn.compactMap)({Accept:"application/json"})),l=await(0,eQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,eQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Pge.match(Pge.json(200,SLn.RetrieveFileOut$inboundSchema),Pge.fail("4XX"),Pge.fail("5XX"))(g);return y.ok,y}});var rQt=x(vHe=>{"use strict";Object.defineProperty(vHe,"__esModule",{value:!0});vHe.isReadableStream=ELn;function ELn(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 oQt=x(IT=>{"use strict";var PLn=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]}),TLn=IT&&IT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wHe=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)&&PLn(e,t,r);return TLn(e,t),e};Object.defineProperty(IT,"__esModule",{value:!0});IT.filesUpload=FLn;var Tge=wi(),ALn=n4e(),Age=wHe(xi()),ILn=Ke(),MLn=Ce(),nQt=Si(),RLn=Uo(),NLn=wHe(no()),jLn=wHe(Ul()),DLn=S3e(),LLn=rQt();async function FLn(t,e,r){let n=(0,MLn.safeParse)(e,y=>jLn.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=new FormData;if((0,DLn.isBlobLike)(o.file))(0,Tge.appendForm)(i,"file",o.file);else if((0,LLn.isReadableStream)(o.file.content)){let y=await(0,ALn.readableStreamToArrayBuffer)(o.file.content),_=new Blob([y],{type:"application/octet-stream"});(0,Tge.appendForm)(i,"file",_)}else(0,Tge.appendForm)(i,"file",new Blob([o.file.content],{type:"application/octet-stream"}),o.file.fileName);o.purpose!==void 0&&(0,Tge.appendForm)(i,"purpose",o.purpose);let a=(0,RLn.pathToFunc)("/v1/files")(),s=new Headers((0,ILn.compactMap)({Accept:"application/json"})),u=await(0,nQt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,nQt.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,h=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,[g]=await Age.match(Age.json(200,NLn.UploadFileOut$inboundSchema),Age.fail("4XX"),Age.fail("5XX"))(m);return g.ok,g}});var iQt=x(Ige=>{"use strict";Object.defineProperty(Ige,"__esModule",{value:!0});Ige.Files=void 0;var kLn=WXt(),$Ln=GXt(),BLn=YXt(),zLn=QXt(),ULn=tQt(),qLn=oQt(),HLn=hg(),eH=Dy(),xHe=class extends HLn.ClientSDK{async upload(e,r){return(0,eH.unwrapAsync)((0,qLn.filesUpload)(this,e,r))}async list(e,r){return(0,eH.unwrapAsync)((0,zLn.filesList)(this,e,r))}async retrieve(e,r){return(0,eH.unwrapAsync)((0,ULn.filesRetrieve)(this,e,r))}async delete(e,r){return(0,eH.unwrapAsync)((0,kLn.filesDelete)(this,e,r))}async download(e,r){return(0,eH.unwrapAsync)((0,$Ln.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,eH.unwrapAsync)((0,BLn.filesGetSignedUrl)(this,e,r))}};Ige.Files=xHe});var uQt=x(MT=>{"use strict";var VLn=MT&&MT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WLn=MT&&MT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SHe=MT&&MT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VLn(e,t,r);return WLn(e,t),e};Object.defineProperty(MT,"__esModule",{value:!0});MT.fimComplete=XLn;var KLn=wi(),VJ=SHe(xi()),GLn=Ke(),JLn=Ce(),aQt=Si(),ZLn=Uo(),sQt=SHe(no()),YLn=SHe(yg());async function XLn(t,e,r){let n=(0,JLn.safeParse)(e,_=>sQt.FIMCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,KLn.encodeJSON)("body",o,{explode:!0}),a=(0,ZLn.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,GLn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,aQt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,aQt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await VJ.match(VJ.json(200,sQt.FIMCompletionResponse$inboundSchema),VJ.jsonErr(422,YLn.HTTPValidationError$inboundSchema),VJ.fail("4XX"),VJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var dQt=x(RT=>{"use strict";var QLn=RT&&RT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eFn=RT&&RT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mge=RT&&RT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QLn(e,t,r);return eFn(e,t),e};Object.defineProperty(RT,"__esModule",{value:!0});RT.fimStream=uFn;var tFn=Mge(Ie()),rFn=wi(),nFn=EJ(),WJ=Mge(xi()),oFn=Ke(),iFn=Ce(),lQt=Si(),aFn=Uo(),cQt=Mge(no()),sFn=Mge(yg());async function uFn(t,e,r){let n=(0,iFn.safeParse)(e,_=>cQt.FIMCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,rFn.encodeJSON)("body",o,{explode:!0}),a=(0,aFn.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,oFn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,lQt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,lQt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await WJ.match(WJ.sse(200,tFn.instanceof(ReadableStream).transform(_=>new nFn.EventStream({stream:_,decoder(w){return cQt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),WJ.jsonErr(422,sFn.HTTPValidationError$inboundSchema),WJ.fail("4XX"),WJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var pQt=x(Rge=>{"use strict";Object.defineProperty(Rge,"__esModule",{value:!0});Rge.Fim=void 0;var lFn=uQt(),cFn=dQt(),dFn=hg(),fQt=Dy(),CHe=class extends dFn.ClientSDK{async complete(e,r){return(0,fQt.unwrapAsync)((0,lFn.fimComplete)(this,e,r))}async stream(e,r){return(0,fQt.unwrapAsync)((0,cFn.fimStream)(this,e,r))}};Rge.Fim=CHe});var hQt=x(NT=>{"use strict";var fFn=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]}),pFn=NT&&NT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OHe=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)&&fFn(e,t,r);return pFn(e,t),e};Object.defineProperty(NT,"__esModule",{value:!0});NT.fineTuningJobsCancel=vFn;var mFn=wi(),Nge=OHe(xi()),hFn=Ke(),gFn=Ce(),mQt=Si(),yFn=Uo(),bFn=OHe(no()),_Fn=OHe(Ul());async function vFn(t,e,r){let n=(0,gFn.safeParse)(e,_=>_Fn.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,mFn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,yFn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,hFn.compactMap)({Accept:"application/json"})),l=await(0,mQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,mQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Nge.match(Nge.json(200,bFn.DetailedJobOut$inboundSchema),Nge.fail("4XX"),Nge.fail("5XX"))(g);return y.ok,y}});var yQt=x(jT=>{"use strict";var wFn=jT&&jT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xFn=jT&&jT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EHe=jT&&jT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wFn(e,t,r);return xFn(e,t),e};Object.defineProperty(jT,"__esModule",{value:!0});jT.fineTuningJobsCreate=AFn;var SFn=wi(),jge=EHe(xi()),CFn=Ke(),OFn=Ce(),gQt=Si(),EFn=Uo(),PFn=EHe(no()),TFn=EHe(Ul());async function AFn(t,e,r){let n=(0,OFn.safeParse)(e,y=>PFn.JobIn$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,SFn.encodeJSON)("body",o,{explode:!0}),a=(0,EFn.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,CFn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,gQt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,gQt.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,h=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,[g]=await jge.match(jge.json(200,TFn.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),jge.fail("4XX"),jge.fail("5XX"))(m);return g.ok,g}});var _Qt=x(DT=>{"use strict";var IFn=DT&&DT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MFn=DT&&DT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PHe=DT&&DT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&IFn(e,t,r);return MFn(e,t),e};Object.defineProperty(DT,"__esModule",{value:!0});DT.fineTuningJobsGet=kFn;var RFn=wi(),Dge=PHe(xi()),NFn=Ke(),jFn=Ce(),bQt=Si(),DFn=Uo(),LFn=PHe(no()),FFn=PHe(Ul());async function kFn(t,e,r){let n=(0,jFn.safeParse)(e,_=>FFn.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,RFn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,DFn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,NFn.compactMap)({Accept:"application/json"})),l=await(0,bQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,bQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Dge.match(Dge.json(200,LFn.DetailedJobOut$inboundSchema),Dge.fail("4XX"),Dge.fail("5XX"))(g);return y.ok,y}});var wQt=x(LT=>{"use strict";var $Fn=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]}),BFn=LT&&LT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),THe=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)&&$Fn(e,t,r);return BFn(e,t),e};Object.defineProperty(LT,"__esModule",{value:!0});LT.fineTuningJobsList=KFn;var zFn=wi(),Lge=THe(xi()),UFn=Ke(),qFn=Ce(),vQt=Si(),HFn=Uo(),VFn=THe(no()),WFn=THe(Ul());async function KFn(t,e,r){let n=(0,qFn.safeParse)(e,_=>WFn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,HFn.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,zFn.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,UFn.compactMap)({Accept:"application/json"})),l=await(0,vQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,vQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Lge.match(Lge.json(200,VFn.JobsOut$inboundSchema),Lge.fail("4XX"),Lge.fail("5XX"))(g);return y.ok,y}});var SQt=x(FT=>{"use strict";var GFn=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]}),JFn=FT&&FT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AHe=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)&&GFn(e,t,r);return JFn(e,t),e};Object.defineProperty(FT,"__esModule",{value:!0});FT.fineTuningJobsStart=rkn;var ZFn=wi(),Fge=AHe(xi()),YFn=Ke(),XFn=Ce(),xQt=Si(),QFn=Uo(),ekn=AHe(no()),tkn=AHe(Ul());async function rkn(t,e,r){let n=(0,XFn.safeParse)(e,_=>tkn.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,ZFn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,QFn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,YFn.compactMap)({Accept:"application/json"})),l=await(0,xQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,xQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Fge.match(Fge.json(200,ekn.DetailedJobOut$inboundSchema),Fge.fail("4XX"),Fge.fail("5XX"))(g);return y.ok,y}});var CQt=x(kge=>{"use strict";Object.defineProperty(kge,"__esModule",{value:!0});kge.Jobs=void 0;var nkn=hQt(),okn=yQt(),ikn=_Qt(),akn=wQt(),skn=SQt(),ukn=hg(),KJ=Dy(),IHe=class extends ukn.ClientSDK{async list(e,r){return(0,KJ.unwrapAsync)((0,akn.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,KJ.unwrapAsync)((0,okn.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,KJ.unwrapAsync)((0,ikn.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,KJ.unwrapAsync)((0,nkn.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,KJ.unwrapAsync)((0,skn.fineTuningJobsStart)(this,e,r))}};kge.Jobs=IHe});var OQt=x($ge=>{"use strict";Object.defineProperty($ge,"__esModule",{value:!0});$ge.FineTuning=void 0;var lkn=hg(),ckn=CQt(),MHe=class extends lkn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new ckn.Jobs(this._options))}};$ge.FineTuning=MHe});var PQt=x(kT=>{"use strict";var dkn=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]}),fkn=kT&&kT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RHe=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)&&dkn(e,t,r);return fkn(e,t),e};Object.defineProperty(kT,"__esModule",{value:!0});kT.modelsArchive=_kn;var pkn=wi(),Bge=RHe(xi()),mkn=Ke(),hkn=Ce(),EQt=Si(),gkn=Uo(),ykn=RHe(no()),bkn=RHe(Ul());async function _kn(t,e,r){let n=(0,hkn.safeParse)(e,_=>bkn.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,pkn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,gkn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,mkn.compactMap)({Accept:"application/json"})),l=await(0,EQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,EQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Bge.match(Bge.json(200,ykn.ArchiveFTModelOut$inboundSchema),Bge.fail("4XX"),Bge.fail("5XX"))(g);return y.ok,y}});var AQt=x($T=>{"use strict";var vkn=$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]}),wkn=$T&&$T.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zge=$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)&&vkn(e,t,r);return wkn(e,t),e};Object.defineProperty($T,"__esModule",{value:!0});$T.modelsDelete=Akn;var xkn=wi(),GJ=zge(xi()),Skn=Ke(),Ckn=Ce(),TQt=Si(),Okn=Uo(),Ekn=zge(no()),Pkn=zge(yg()),Tkn=zge(Ul());async function Akn(t,e,r){let n=(0,Ckn.safeParse)(e,w=>Tkn.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,xkn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Okn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,Skn.compactMap)({Accept:"application/json"})),l=await(0,TQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,TQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,y={HttpMeta:{Response:g,Request:h}},[_]=await GJ.match(GJ.json(200,Ekn.DeleteModelOut$inboundSchema),GJ.jsonErr(422,Pkn.HTTPValidationError$inboundSchema),GJ.fail("4XX"),GJ.fail("5XX"))(g,{extraFields:y});return _.ok,_}});var MQt=x(BT=>{"use strict";var Ikn=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]}),Mkn=BT&&BT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NHe=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)&&Ikn(e,t,r);return Mkn(e,t),e};Object.defineProperty(BT,"__esModule",{value:!0});BT.modelsList=Lkn;var JJ=NHe(xi()),Rkn=Ke(),IQt=Si(),Nkn=Uo(),jkn=NHe(no()),Dkn=NHe(yg());async function Lkn(t,e){let r=(0,Nkn.pathToFunc)("/v1/models")(),n=new Headers((0,Rkn.compactMap)({Accept:"application/json"})),o=await(0,IQt.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,IQt.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 JJ.match(JJ.json(200,jkn.ModelList$inboundSchema),JJ.jsonErr(422,Dkn.HTTPValidationError$inboundSchema),JJ.fail("4XX"),JJ.fail("5XX"))(d,{extraFields:f});return p.ok,p}});var jQt=x(zT=>{"use strict";var Fkn=zT&&zT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kkn=zT&&zT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jHe=zT&&zT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Fkn(e,t,r);return kkn(e,t),e};Object.defineProperty(zT,"__esModule",{value:!0});zT.modelsRetrieve=Hkn;var $kn=wi(),ZJ=jHe(xi()),Bkn=Ke(),zkn=Ce(),RQt=Si(),Ukn=Uo(),qkn=jHe(yg()),NQt=jHe(Ul());async function Hkn(t,e,r){let n=(0,zkn.safeParse)(e,w=>NQt.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,$kn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Ukn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,Bkn.compactMap)({Accept:"application/json"})),l=await(0,RQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,RQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,y={HttpMeta:{Response:g,Request:h}},[_]=await ZJ.match(ZJ.json(200,NQt.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),ZJ.jsonErr(422,qkn.HTTPValidationError$inboundSchema),ZJ.fail("4XX"),ZJ.fail("5XX"))(g,{extraFields:y});return _.ok,_}});var LQt=x(UT=>{"use strict";var Vkn=UT&&UT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wkn=UT&&UT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DHe=UT&&UT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vkn(e,t,r);return Wkn(e,t),e};Object.defineProperty(UT,"__esModule",{value:!0});UT.modelsUnarchive=Qkn;var Kkn=wi(),Uge=DHe(xi()),Gkn=Ke(),Jkn=Ce(),DQt=Si(),Zkn=Uo(),Ykn=DHe(no()),Xkn=DHe(Ul());async function Qkn(t,e,r){let n=(0,Jkn.safeParse)(e,_=>Xkn.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Kkn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Zkn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,Gkn.compactMap)({Accept:"application/json"})),l=await(0,DQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,DQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Uge.match(Uge.json(200,Ykn.UnarchiveFTModelOut$inboundSchema),Uge.fail("4XX"),Uge.fail("5XX"))(g);return y.ok,y}});var $Qt=x(qT=>{"use strict";var e$n=qT&&qT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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$n=qT&&qT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LHe=qT&&qT.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&e$n(e,t,r);return t$n(e,t),e};Object.defineProperty(qT,"__esModule",{value:!0});qT.modelsUpdate=s$n;var FQt=wi(),qge=LHe(xi()),r$n=Ke(),n$n=Ce(),kQt=Si(),o$n=Uo(),i$n=LHe(no()),a$n=LHe(Ul());async function s$n(t,e,r){let n=(0,n$n.safeParse)(e,_=>a$n.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,FQt.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,FQt.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,o$n.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,r$n.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,kQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,kQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await qge.match(qge.json(200,i$n.FTModelOut$inboundSchema),qge.fail("4XX"),qge.fail("5XX"))(g);return y.ok,y}});var BQt=x(Hge=>{"use strict";Object.defineProperty(Hge,"__esModule",{value:!0});Hge.Models=void 0;var u$n=PQt(),l$n=AQt(),c$n=MQt(),d$n=jQt(),f$n=LQt(),p$n=$Qt(),m$n=hg(),tH=Dy(),FHe=class extends m$n.ClientSDK{async list(e){return(0,tH.unwrapAsync)((0,c$n.modelsList)(this,e))}async retrieve(e,r){return(0,tH.unwrapAsync)((0,d$n.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,tH.unwrapAsync)((0,l$n.modelsDelete)(this,e,r))}async update(e,r){return(0,tH.unwrapAsync)((0,p$n.modelsUpdate)(this,e,r))}async archive(e,r){return(0,tH.unwrapAsync)((0,u$n.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,tH.unwrapAsync)((0,f$n.modelsUnarchive)(this,e,r))}};Hge.Models=FHe});var zQt=x(Vge=>{"use strict";Object.defineProperty(Vge,"__esModule",{value:!0});Vge.Mistral=void 0;var h$n=hg(),g$n=MZt(),y$n=aXt(),b$n=RXt(),_$n=BXt(),v$n=HXt(),w$n=iQt(),x$n=pQt(),S$n=OQt(),C$n=BQt(),kHe=class extends h$n.ClientSDK{get models(){return this._models??(this._models=new C$n.Models(this._options))}get files(){return this._files??(this._files=new w$n.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new S$n.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new y$n.Batch(this._options))}get chat(){return this._chat??(this._chat=new b$n.Chat(this._options))}get fim(){return this._fim??(this._fim=new x$n.Fim(this._options))}get agents(){return this._agents??(this._agents=new g$n.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new v$n.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new _$n.Classifiers(this._options))}};Vge.Mistral=kHe});var HQt=x(fh=>{"use strict";var UQt=fh&&fh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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$n=fh&&fh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qQt=fh&&fh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UQt(e,t,r)},E$n=fh&&fh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UQt(e,t,r);return O$n(e,t),e};Object.defineProperty(fh,"__esModule",{value:!0});fh.files=void 0;qQt(Upe(),fh);fh.files=E$n(n4e());qQt(zQt(),fh)});var $He=b(()=>{OB()});function T$n(t){return P$n.test(t)}function A$n(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 I$n(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 BHe(t){if(T$n(t))return t;{let e=I$n(t),r=A$n(e);return r.length>=9?r.slice(0,9):r.padStart(9,"0")}}function zHe(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}):""}var P$n,VQt=b(()=>{P$n=/^[a-zA-Z0-9]{9}$/});function WQt(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(Vi(o)&&o.tool_calls?.length)return o.tool_calls.map(i=>({...i,id:BHe(i.id??"")})).map(rO)};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:BHe(o.tool_call_id)}:Vi(o)?i===void 0?{role:e(o.getType()),content:a}:{role:e(o.getType()),toolCalls:i}:{role:e(o.getType()),content:a}})}function M$n(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=zHe(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=Xm(s,{returnId:!0});i.push({...u,id:u.id??zpe().replace(/-/g,"")})}catch(u){a.push(Qm(s,u.message))}return new Fn({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 Zs({content:o})}}function R$n(t,e){if(!t.content&&!t.toolCalls)return e?new xr({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??zpe().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=zHe(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 xp({content:o}):n==="assistant"?new xr({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 Bg({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new Ch({content:o,additional_kwargs:i}):new wp({content:o,role:n})}function KQt(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:os(e.schema)}}})}function GQt(t){return typeof t?.parse=="function"}var JQt,ZQt,Wge,YQt=b(()=>{$5t();JQt=j(HQt(),1),ZQt=j(vJ(),1);Fs();UC();Gf();$He();to();Mb();H2();Om();Ug();VQt();Wge=class extends Cu{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??ct("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?KQt(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:KQt(e),...r})}async completionWithRetry(e,r){let n=new Oh({maxRetries:this.maxRetries}),o=new JQt.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=WQt(e),s={...i,messages:a},u=r.signal??!!r.timeout;if(this.streaming||u){let h=this._streamResponseChunks(e,r,n),m={};for await(let y of h){let _=y.generationInfo?.completion??0;m[_]===void 0?m[_]=y:m[_]=m[_].concat(y)}return{generations:Object.entries(m).sort(([y],[_])=>parseInt(y,10)-parseInt(_,10)).map(([y,_])=>_),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 h of l?.choices??[]){if("delta"in h)throw new Error("Delta not supported in non-streaming mode.");if(!("message"in h))throw new Error("No message found in the choice.");let m=h.message?.content??"";Array.isArray(m)&&(m=m[0].type==="text"?m[0].text:"");let g={text:m,message:M$n(h,l?.usage)};h.finishReason&&(g.generationInfo={finishReason:h.finishReason}),p.push(g)}return{generations:p,llmOutput:{tokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=WQt(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=R$n(c,f?u.usage:null);if(p===null)continue;let h=c.content??"";Array.isArray(h)&&(h=h[0].type==="text"?h[0].text:"");let m=new so({message:p,text:h,generationInfo:d});yield m,n?.handleLLMNewToken(m.text??"",d,void 0,void 0,void 0,{chunk:m})}}addAllHooksToHttpClient(){try{if(this.removeAllHooksFromHttpClient(),[this.beforeRequestHooks,this.requestErrorHooks,this.responseHooks].some(r=>r&&r.length>0)&&!this.httpClient&&(this.httpClient=new ZQt.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"}}),GQt(n)?u=wd.fromZodSchema(n):u=new xd;else{let f=o??"extract";if(GQt(n)){let p=os(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:"any"}),u=new qd({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 qd({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=jo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=jo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return ji.from([{raw:s},d])}}});var XQt=b(()=>{to();CP();Cy()});var QQt=b(()=>{wL();Gf();to();Cy();$He()});var eer=b(()=>{YQt();XQt();QQt()});var ter=b(()=>{eer()});function jk(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}var l1=b(()=>{});function YJ(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var rer=b(()=>{});function Dk(t){let e;return t.constructor.name===ug.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Ia.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=YJ(t,"INVALID_TOOL_RESULTS"):t.status===401?e=YJ(t,"MODEL_AUTHENTICATION"):t.status===429?e=YJ(t,"MODEL_RATE_LIMIT"):t.status===404?e=YJ(t,"MODEL_NOT_FOUND"):e=t,e}function UHe(t){if(t)return t==="any"||t==="required"?"required":t==="auto"?"auto":t==="none"?"none":typeof t=="string"?{type:"function",function:{name:t}}:t}var rH=b(()=>{KF();Ug();rg();rer()});function N$n(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function ner(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(oer(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function oer(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}: ${Kge(o,e)},`):r.push(`${n}?: ${Kge(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function Kge(t,e){if(N$n(t))return t.anyOf.map(r=>Kge(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["{",oer(t,e+2),"}"].join(`
`);case"array":return t.items?`${Kge(t.items,e)}[]`:"any[]";default:return""}}var ier=b(()=>{});function aer(t,e){let r;if(Hc(t)){let n=Spe({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:DM(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}var ser=b(()=>{rg();iJ()});function j$n(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 VHe(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(!Js.isInstance(t))throw new Error("Invalid generic chat message");return j$n(t)}default:throw new Error(`Unknown message type: ${e}`)}}function HHe(t,e){return t.flatMap(r=>{let n=VHe(r);n==="system"&&WHe(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=""),Vi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(rO),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})}function uer(t,e){return t.flatMap(r=>{let n=VHe(r);if(n==="system"&&WHe(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[nH];if(Vi(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 cer(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(Xm(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Qm(s,l))}i[nH]??(i[nH]={}),i[nH][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 Fn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function D$n(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[nH]={[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=cer(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 so({text:e.map(u=>u.text).join(""),message:new xr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function qHe(t){return"type"in t&&t.type!=="function"}function L$n(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function ler(t,e){return kd(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:aer(t,e)}function WHe(t){return t?.startsWith("o1")||t?.startsWith("o3")}function Gge(t){return typeof t?.parse=="function"}function F$n(t){return t!==void 0&&typeof t.schema=="object"}var nH,XJ,Jge=b(()=>{KF();Fs();Gf();to();UC();tg();Om();Mb();H2();Ug();iJ();l1();rH();ier();ser();nH="__openai_function_call_ids__";XJ=class extends Cu{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??ct("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??ct("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=>qHe(o)?o:ler(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&Gge(e.json_schema.schema)?xpe(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=>qHe(l)?l:kd(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:L$n(e?.tool_choice)?e?.tool_choice:(()=>{let l=UHe(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=>ler(s,{strict:n})):void 0,tool_choice:UHe(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),WHe(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(Xm(u,{returnId:!0}))}catch(l){i.push(Qm(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 Fn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Js(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 xp({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 xr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Of({content:i,response_metadata:s}):o==="developer"?new Of({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Ch({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Bg({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new wp({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:uer(e,this.model),stream:!0},r);for await(let c of l){let d=D$n(c);d!=null&&(yield d)}return}let o=HHe(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 h={...p};c.finish_reason!=null&&(h.finish_reason=c.finish_reason,h.system_fingerprint=l.system_fingerprint,h.model_name=l.model),this.logprobs&&(h.logprobs=c.logprobs);let m=new so({message:f,text:f.content,generationInfo:h});yield m,await n?.handleLLMNewToken(m.text??"",p,void 0,void 0,void 0,{chunk:m})}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 so({message:new xr({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=uer(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:cer(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(qHe),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=HHe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let h of s){h.message.response_metadata={...h.generationInfo,...h.message.response_metadata};let m=h.generationInfo?.completion??0;u[m]===void 0?u[m]=h:u[m]=u[m].concat(h)}let l=Object.entries(u).sort(([h],[m])=>parseInt(h,10)-parseInt(m,10)).map(([h,m])=>m),{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 h of s?.choices??[]){let g={text:h.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(h.message??{role:"assistant"},s)};g.generationInfo={...h.finish_reason?{finish_reason:h.finish_reason}:{},...h.logprobs?{logprobs:h.logprobs}:{}},Vi(g.message)&&(g.message.usage_metadata=o),g.message=new Fn(Object.fromEntries(Object.entries(g.message).filter(([y])=>!y.startsWith("lc_")))),p.push(g)}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=ner(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(VHe(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 Dk(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 Dk(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 Dk(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=jk(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Pr(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;F$n(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"}}),Gge(n)?u=wd.fromZodSchema(n):u=new xd;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}}}),Gge(n)){let f=wd.fromZodSchema(n);u=Ep.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new xd;else{let f=o??"extract";if(Gge(n)){let p=os(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 qd({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 qd({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=jo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=jo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return ji.from([{raw:s},d])}}});var der=b(()=>{to();Jge();l1()});var KHe=b(()=>{tg();Gf();to();wL();Cy();l1();rH()});var fer=b(()=>{to();KHe();l1()});var GHe=b(()=>{to();CP();Cy();l1();rH()});var per=b(()=>{to();GHe();l1();rH()});var mer=b(()=>{});var JHe,her=b(()=>{to();KF();$K();JHe=class extends eR{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??ct("OPENAI_API_KEY"),n=e?.organization??ct("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new Pr(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(JHe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"})});var ger=b(()=>{her()});var yer=b(()=>{Jge()});var ber=b(()=>{Jge();der();KHe();fer();per();GHe();mer();rH();l1();ger();yer()});var _er=b(()=>{ber()});var Zge,ver=b(()=>{to();_er();Zge=class extends XJ{static lc_name(){return"ChatXAI"}_llmType(){return"xai"}get lc_secrets(){return{apiKey:"XAI_API_KEY"}}constructor(e){let r=e?.apiKey||ct("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 wer=b(()=>{ver()});var xer=b(()=>{wer()});var Ser={};ns(Ser,{default:()=>c1});var Yge,k$n,id,c1,Xge=b(()=>{sa();nr();Aj();Kt();bt();fr();lK();NVt();lFe();Y8t();gFe();N5t();ter();IFe();yce();xer();Yge=require("obsidian"),k$n={openai:nO,"azure openai":nO,anthropic:Dfe,cohereai:ile,google:fle,xai:Zge,openrouterai:nO,ollama:yle,"lm-studio":nO,groq:kpe,"3rd party (openai-format)":nO,"copilot-plus":nO,mistralai:Wge,deepseek:Ppe},id=class id{constructor(){this.providerApiKeyMap={openai:()=>oe().openAIApiKey,google:()=>oe().googleApiKey,"azure openai":()=>oe().azureOpenAIApiKey,anthropic:()=>oe().anthropicApiKey,cohereai:()=>oe().cohereApiKey,openrouterai:()=>oe().openRouterAiApiKey,groq:()=>oe().groqApiKey,xai:()=>oe().xaiApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>oe().plusLicenseKey,mistralai:()=>oe().mistralApiKey,deepseek:()=>oe().deepseekApiKey};this.buildModelMap(),va(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return id.instance||(id.instance=new id),id.instance}getTemperatureForModel(e,r,n){if(!e.isThinkingEnabled)return e.isOSeries||e.isGPT5?id.REASONING_MODEL_TEMPERATURE:r.temperature??n.temperature}async getModelConfig(e){let r=oe(),n=e.name,o=XB(n),{isThinkingEnabled:i}=o,a={modelName:n,streaming:e.stream??!0,maxRetries:3,maxConcurrency:3,enableCors:e.enableCors,...!i&&{temperature:e.temperature??r.temperature}},u={openai:{modelName:n,apiKey:await _o(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?yu:void 0,organization:await _o(e.openAIOrgId||r.openAIOrgId)},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},anthropic:{anthropicApiKey:await _o(e.apiKey||r.anthropicApiKey),model:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?yu:void 0},...i&&{thinking:{type:"enabled",budget_tokens:2048}}},"azure openai":{modelName:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,apiKey:await _o(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 _o(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?yu:void 0},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},cohereai:{apiKey:await _o(e.apiKey||r.cohereApiKey),model:n},google:{apiKey:await _o(e.apiKey||r.googleApiKey),modelName:n,safetySettings:[{category:xL.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:SL.BLOCK_NONE},{category:xL.HARM_CATEGORY_HATE_SPEECH,threshold:SL.BLOCK_NONE},{category:xL.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:SL.BLOCK_NONE},{category:xL.HARM_CATEGORY_HARASSMENT,threshold:SL.BLOCK_NONE}],baseUrl:e.baseUrl},xai:{apiKey:await _o(e.apiKey||r.xaiApiKey),model:n},openrouterai:{modelName:n,apiKey:await _o(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?yu:void 0,defaultHeaders:{"HTTP-Referer":"https://obsidiancopilot.com","X-Title":"Obsidian Copilot"}}},groq:{apiKey:await _o(e.apiKey||r.groqApiKey),modelName:n},ollama:{model:n,baseUrl:e.baseUrl||"http://localhost:11434",headers:new Headers({Authorization:`Bearer ${await _o(e.apiKey||"default-key")}`})},"lm-studio":{modelName:n,apiKey:e.apiKey||"default-key",configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?yu:void 0}},"3rd party (openai-format)":{modelName:n,apiKey:await _o(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?yu:void 0,defaultHeaders:{"dangerously-allow-browser":"true"}},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},"copilot-plus":{modelName:n,apiKey:await _o(r.plusLicenseKey),configuration:{baseURL:ZA,fetch:e.enableCors?yu:void 0}},mistralai:{model:n,apiKey:await _o(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl},deepseek:{modelName:n,apiKey:await _o(e.apiKey||r.deepseekApiKey),configuration:{baseURL:e.baseUrl||ez.deepseek.host,fetch:e.enableCors?yu:void 0}}}[e.provider]||{},l=this.getProviderSpecificParams(e.provider,e),c=i?{maxTokens:e.maxTokens??r.maxTokens}:{maxTokens:e.maxTokens??r.maxTokens};return{...a,...u,...l,...c}}getOpenAISpecialConfig(e,r,n,o){let i=oe(),a=XB(e),s=this.getTemperatureForModel(a,o||{},i),u={maxTokens:r,temperature:s};if((a.isOSeries||a.isGPT5)&&o?.reasoningEffort&&(u.reasoning={effort:o.reasoningEffort},a.isGPT5&&o?.verbosity)){let l=o.verbosity;u.text={verbosity:l}}return u}getProviderSpecificParams(e,r){let n={};return r.topP!==void 0&&["openai","azure openai","anthropic","google","openrouterai","ollama","lm-studio","3rd party (openai-format)","mistralai","deepseek"].includes(e)&&(n.topP=r.topP),r.frequencyPenalty!==void 0&&["openai","azure openai","openrouterai","ollama","lm-studio","3rd party (openai-format)","mistralai","deepseek"].includes(e)&&(n.frequencyPenalty=r.frequencyPenalty),n}buildModelMap(){let e=oe().activeModels;id.modelMap={};let r=id.modelMap;(e??Pv).forEach(o=>{if(o.enabled){if(!Object.values(xE).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=en(o);r[u]={hasApiKey:!!(o.apiKey||s),AIConstructor:i,vendor:o.provider}}})}getProviderConstructor(e){let r=k$n[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(!id.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return id.chatModel}async setChatModel(e){let r=en(e);try{let n=await this.createModelInstance(e);id.chatModel=n,XB(e.name).isGPT5&&(e.provider==="openai"||e.provider==="azure openai"||e.provider==="3rd party (openai-format)")&&B(`Chat model set with Responses API for GPT-5: ${e.name}`)}catch(n){ie(n),new Yge.Notice(`Error creating model: ${r}`)}}async createModelInstance(e){let r=en(e),n=id.modelMap[r];if(!n)throw new Error(`No model found for: ${r}`);if(!n.hasApiKey){let u=`API key is not provided for the model: ${r}.`;throw new Yge.Notice(u),new Error(u)}let o=await this.getModelConfig(e),i=XB(e.name),a={...o};return i.isGPT5&&(n.vendor==="openai"||n.vendor==="azure openai"||n.vendor==="3rd party (openai-format)")&&(a.useResponsesApi=!0,B(`Enabling Responses API for GPT-5 model: ${e.name} (${n.vendor})`)),new n.AIConstructor(a)}validateChatModel(e){return e!=null}estimateTokens(e){return e?Math.ceil(e.length/4):0}async countTokens(e){try{return await Sd(async()=>id.chatModel?.getNumTokens(e)??0)}catch(r){if(r instanceof Error&&r.message.includes("Unknown model"))return B("Using estimated token count due to tokenizer error"),this.estimateTokens(e);throw r}}validateCurrentModel(){if(!id.chatModel)return;let e=Nee();if(!e)return;id.modelMap[e]?.hasApiKey||(id.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={maxTokens:30},d=XB(e.name),f={...l,...c};d.isGPT5&&(e.provider==="openai"||e.provider==="azure openai"||e.provider==="3rd party (openai-format)")&&(f.useResponsesApi=!0),await new(this.getProviderConstructor(o))(f).invoke([{role:"user",content:"hello"}],{timeout:8e3})};try{return await r(!1),!0}catch(n){console.log("First ping attempt failed, trying with CORS...");try{return await r(!0),new Yge.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: `+Xn(n)+`
with CORS Error: `+Xn(o);throw new Error(i)}}}findModelByName(e){return oe().activeModels.find(n=>n.name===e)}};id.REASONING_MODEL_TEMPERATURE=1;c1=id});var Qge={};ns(Qge,{TieredLexicalRetriever:()=>QJ});async function $$n(){try{if(!ZHe){let e=await Promise.resolve().then(()=>(Xge(),Ser));ZHe=()=>e.default.getInstance()}return ZHe().getChatModel()}catch{return null}}var YHe,ZHe,QJ,e7=b(()=>{Kt();bt();fr();QK();vze();YHe=require("obsidian");kde();$Ht();ZHe=null;QJ=class extends m4{constructor(r,n){super();this.app=r;this.options=n;this.lc_namespace=["tiered_lexical_retriever"];this.searchCore=new ife(r,$$n),typeof this.searchCore.getChunkManager=="function"?this.chunkManager=this.searchCore.getChunkManager():this.chunkManager=new cR(r)}async getRelevantDocuments(r,n){try{if(this.options.timeRange)return this.getTimeRangeDocuments(r);let o=Hg(r,this.app.vault),i=o.map(f=>f.basename),a=[...new Set([...this.options.salientTerms,...i])];oe().debug&&B("TieredLexicalRetriever: Starting search",{query:r,salientTerms:a,maxK:this.options.maxK});let s=oe(),u=await this.searchCore.retrieve(r,{maxResults:this.options.maxK,salientTerms:a,enableLexicalBoosts:s.enableLexicalBoosts}),l=await this.getTitleMatches(o),c=await this.convertToDocuments(u),d=this.combineResults(c,l);return oe().debug&&B("TieredLexicalRetriever: Search complete",{totalResults:d.length,titleMatches:l.length,searchResults:u.length}),d}catch(o){return $t("TieredLexicalRetriever: Error during search",o),[]}}async getTimeRangeDocuments(r){if(!this.options.timeRange)return[];let{startTime:n,endTime:o}=this.options.timeRange,i=this.generateDailyNoteDateRange(n,o);oe().debug&&B("TieredLexicalRetriever: Generated daily note titles",{startTime:new Date(n).toISOString(),endTime:new Date(o).toISOString(),titlesCount:i.length,firstTitle:i[0],lastTitle:i[i.length-1]});let a=i.join(", "),s=Hg(a,this.app.vault),l=(await this.getTitleMatches(s)).map(m=>(m.metadata.includeInContext=!0,m)),c=this.app.vault.getMarkdownFiles(),d=[],f=Math.min(this.options.maxK,100);for(let m of c)if(m.stat.mtime>=n&&m.stat.mtime<=o){if(s.some(g=>g.path===m.path))continue;if(d.length>=f)break;try{let g=await this.app.vault.cachedRead(m),y=this.app.metadataCache.getFileCache(m),_=(Date.now()-m.stat.mtime)/(1e3*60*60*24),w=Math.max(.3,Math.min(1,1-_/30));d.push(new rh({pageContent:g,metadata:{path:m.path,title:m.basename,mtime:m.stat.mtime,ctime:m.stat.ctime,tags:y?.tags?.map(S=>S.tag)||[],includeInContext:!0,score:w,rerank_score:w,source:"time-filtered"}}))}catch(g){$t(`TieredLexicalRetriever: Failed to read file ${m.path}`,g)}}let p=new Map;for(let m of l)p.set(m.metadata.path,m);for(let m of d)p.has(m.metadata.path)||p.set(m.metadata.path,{...m,metadata:{...m.metadata,includeInContext:!0}});let h=Array.from(p.values()).sort((m,g)=>{let y=m.metadata.score||0;return(g.metadata.score||0)-y});return oe().debug&&B("TieredLexicalRetriever: Time range search complete",{timeRange:this.options.timeRange,dailyNotesFound:s.length,timeFilteredDocs:d.length,totalResults:h.length}),h}generateDailyNoteDateRange(r,n){let o=[],i=new Date(r),a=new Date(n),s=365;Math.ceil((n-r)/(1e3*60*60*24))>s&&($t(`TieredLexicalRetriever: Date range exceeds ${s} days, limiting to recent ${s} days`),i.setTime(a.getTime()-s*24*60*60*1e3));let l=new Date(i);for(;l<=a;)o.push(`[[${l.toLocaleDateString("en-CA")}]]`),l.setDate(l.getDate()+1);return o}async getTitleMatches(r){let n=[];for(let o of r)try{let i=await this.app.vault.cachedRead(o),a=this.app.metadataCache.getFileCache(o);n.push(new rh({pageContent:i,metadata:{path:o.path,title:o.basename,mtime:o.stat.mtime,ctime:o.stat.ctime,tags:a?.tags?.map(s=>s.tag)||[],includeInContext:!0,score:1,rerank_score:1,source:"title-match"}}))}catch(i){$t(`TieredLexicalRetriever: Failed to read title-matched file ${o.path}`,i)}return n}async convertToDocuments(r){let n=[];for(let o of r)try{if(o.id.includes("#")){let[a]=o.id.split("#"),s=this.app.vault.getAbstractFileByPath(a);if(!s||!(s instanceof YHe.TFile))continue;let u="",l=this.chunkManager;if(typeof l.getChunkText=="function"?u=await l.getChunkText(o.id):typeof l.getChunkTextSync=="function"&&(u=l.getChunkTextSync(o.id)||""),!u)continue;let c=this.app.metadataCache.getFileCache(s);n.push(new rh({pageContent:u,metadata:{path:a,chunkId:o.id,title:s.basename,mtime:s.stat.mtime,ctime:s.stat.ctime,tags:c?.tags?.map(d=>d.tag)||[],score:o.score,rerank_score:o.score,engine:o.engine||"chunk-v3",includeInContext:o.score>(this.options.minSimilarityScore||.1),explanation:o.explanation,isChunk:!0}}))}else{let a=this.app.vault.getAbstractFileByPath(o.id);if(!a||!(a instanceof YHe.TFile))continue;let s=await this.app.vault.cachedRead(a);if(!s)continue;let u=this.app.metadataCache.getFileCache(a);n.push(new rh({pageContent:s,metadata:{path:o.id,title:a.basename,mtime:a.stat.mtime,ctime:a.stat.ctime,tags:u?.tags?.map(l=>l.tag)||[],score:o.score,rerank_score:o.score,engine:o.engine||"v3",includeInContext:o.score>(this.options.minSimilarityScore||.1),explanation:o.explanation,isChunk:!1}}))}}catch(i){$t(`TieredLexicalRetriever: Failed to convert result ${o.id}`,i)}return B(`TieredLexicalRetriever: Converted ${n.length} results to Documents`),n}combineResults(r,n){let o=[];o.push(...n);for(let i of r)n.some(s=>s.metadata.path===i.metadata.path)||o.push(i);return o.sort((i,a)=>{let s=i.metadata.score||0,l=(a.metadata.score||0)-s;if(Math.abs(l)>.01)return l;if(i.metadata.isChunk&&a.metadata.isChunk&&i.metadata.path===a.metadata.path){let c=parseInt(i.metadata.chunkId?.split("#")[1]||"0"),d=parseInt(a.metadata.chunkId?.split("#")[1]||"0");return c-d}return l})}}});var t7,Cer=b(()=>{nr();Kt();uG();e7();bt();fr();iG();p4();t7=class extends BP{async run(e,r,n,o,i){let a=new g_(n);try{let l=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),c=YB(l),d=e.message;c.length>0&&(d=e.message);let f=oe(),h=await(f.enableSemanticSearchV3?new sG({minSimilarityScore:.01,maxK:f.maxSourceChunks,salientTerms:[]}):new QJ(app,{minSimilarityScore:.01,maxK:f.maxSourceChunks,salientTerms:[],timeRange:void 0,textWeight:void 0,returnAll:!1,useRerankerThreshold:void 0})).getRelevantDocuments(d);this.chainManager.storeRetrieverDocuments(h);let m=h.map(E=>`<${tCe}>
${E.pageContent}
</${tCe}>`).join(`
`),g=[],y=If(),_=`
Answer the question with as detailed as possible based only on the following context:
`+m,w=y+_,S=this.chainManager.chatModelManager.getChatModel();w&&g.push({role:JA(S),content:w});for(let E of c)g.push({role:E.role,content:E.content});if(e.content&&Array.isArray(e.content)){let E=e.content.map(P=>P.type==="text"?{...P,text:e.message}:P);g.push({role:"user",content:E})}else g.push({role:"user",content:e.message});B(`==== Final Request to AI ====
`,g);let C=await Sd(()=>this.chainManager.chatModelManager.getChatModel().stream(g,{signal:r.signal}));for await(let E of C){if(r.signal.aborted){B("VaultQA stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(E)}}catch(u){u.name==="AbortError"||r.signal.aborted?B("VaultQA stream aborted by user",{reason:r.signal.reason}):await this.handleError(u,o,n)}let s=a.close();return r.signal.aborted&&r.signal.reason==="new-chat"?(n(""),""):(s=this.addSourcestoResponse(s),this.handleResponse(s,e,r,o,n))}addSourcestoResponse(e){let r=Ret(this.chainManager.getRetrievedDocuments());if(r.length>0){let n=r.map(o=>`- [[${o}]]`).join(`
`);e+=`
#### Sources:
`+n}return e}}});async function eye(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(({role:o,content:i})=>`${o}: ${i}`).join(`
`);return await Sd(async()=>{let i=await Hd.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]);return Cj(i.content)})}var XHe=b(()=>{lR();fr()});var QHe,Oer,NO,r7=b(()=>{QHe=require("obsidian"),Oer=t=>{switch(t){case"@vault":return"Search through your vault for relevant information";case"@websearch":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";case"@composer":return"Edit existing notes or create new notes.";default:return""}},NO=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 QHe.Notice(n.message):new QHe.Notice("An error occurred while executing the tool. Check console for details."),null}}}});function D_(){}function Eer(t,e,r,n,o){for(var i=[],a;e;)i.push(e),a=e.previousComponent,delete e.previousComponent,e=a;i.reverse();for(var s=0,u=i.length,l=0,c=0;s<u;s++){var d=i[s];if(d.removed)d.value=t.join(n.slice(c,c+d.count)),c+=d.count;else{if(!d.added&&o){var f=r.slice(l,l+d.count);f=f.map(function(p,h){var m=n[c+h];return m.length>p.length?m:p}),d.value=t.join(f)}else d.value=t.join(r.slice(l,l+d.count));l+=d.count,d.added||(c+=d.count)}}return i}function Per(t,e){var r;for(r=0;r<t.length&&r<e.length;r++)if(t[r]!=e[r])return t.slice(0,r);return t.slice(0,r)}function Ter(t,e){var r;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(r=0;r<t.length&&r<e.length;r++)if(t[t.length-(r+1)]!=e[e.length-(r+1)])return t.slice(-r);return t.slice(-r)}function eVe(t,e,r){if(t.slice(0,e.length)!=e)throw Error("string ".concat(JSON.stringify(t)," doesn't start with prefix ").concat(JSON.stringify(e),"; this is a bug"));return r+t.slice(e.length)}function tVe(t,e,r){if(!e)return t+r;if(t.slice(-e.length)!=e)throw Error("string ".concat(JSON.stringify(t)," doesn't end with suffix ").concat(JSON.stringify(e),"; this is a bug"));return t.slice(0,-e.length)+r}function n7(t,e){return eVe(t,e,"")}function tye(t,e){return tVe(t,e,"")}function Aer(t,e){return e.slice(0,B$n(t,e))}function B$n(t,e){var r=0;t.length>e.length&&(r=t.length-e.length);var n=e.length;t.length<e.length&&(n=t.length);var o=Array(n),i=0;o[0]=0;for(var a=1;a<n;a++){for(e[a]==e[i]?o[a]=o[i]:o[a]=i;i>0&&e[a]!=e[i];)i=o[i];e[a]==e[i]&&i++}i=0;for(var s=r;s<t.length;s++){for(;i>0&&t[s]!=e[i];)i=o[i];t[s]==e[i]&&i++}return i}function Mer(t,e,r){return r?.ignoreWhitespace!=null&&!r.ignoreWhitespace?U$n(t,e,r):i7.diff(t,e,r)}function Ier(t,e,r,n){if(e&&r){var o=e.value.match(/^\s*/)[0],i=e.value.match(/\s*$/)[0],a=r.value.match(/^\s*/)[0],s=r.value.match(/\s*$/)[0];if(t){var u=Per(o,a);t.value=tVe(t.value,a,u),e.value=n7(e.value,u),r.value=n7(r.value,u)}if(n){var l=Ter(i,s);n.value=eVe(n.value,s,l),e.value=tye(e.value,l),r.value=tye(r.value,l)}}else if(r)t&&(r.value=r.value.replace(/^\s*/,"")),n&&(n.value=n.value.replace(/^\s*/,""));else if(t&&n){var c=n.value.match(/^\s*/)[0],d=e.value.match(/^\s*/)[0],f=e.value.match(/\s*$/)[0],p=Per(c,d);e.value=n7(e.value,p);var h=Ter(n7(c,p),f);e.value=tye(e.value,h),n.value=eVe(n.value,c,h),t.value=tVe(t.value,c,c.slice(0,c.length-h.length))}else if(n){var m=n.value.match(/^\s*/)[0],g=e.value.match(/\s*$/)[0],y=Aer(g,m);e.value=tye(e.value,y)}else if(t){var _=t.value.match(/\s*$/)[0],w=e.value.match(/^\s*/)[0],S=Aer(_,w);e.value=n7(e.value,S)}}function U$n(t,e,r){return Rer.diff(t,e,r)}function q$n(t,e){if(typeof t=="function")e.callback=t;else if(t)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function Ner(t,e,r){var n=q$n(r,{ignoreWhitespace:!0});return nye.diff(t,e,n)}function rVe(t){"@babel/helpers - typeof";return rVe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rVe(t)}function nVe(t,e,r,n,o){e=e||[],r=r||[],n&&(t=n(o,t));var i;for(i=0;i<e.length;i+=1)if(e[i]===t)return r[i];var a;if(Object.prototype.toString.call(t)==="[object Array]"){for(e.push(t),a=new Array(t.length),r.push(a),i=0;i<t.length;i+=1)a[i]=nVe(t[i],e,r,n,o);return e.pop(),r.pop(),a}if(t&&t.toJSON&&(t=t.toJSON()),rVe(t)==="object"&&t!==null){e.push(t),a={},r.push(a);var s=[],u;for(u in t)Object.prototype.hasOwnProperty.call(t,u)&&s.push(u);for(s.sort(),i=0;i<s.length;i+=1)u=s[i],a[u]=nVe(t[u],e,r,n,u);e.pop(),r.pop()}else a=t;return a}var nMi,rye,z$n,i7,Rer,nye,H$n,V$n,o7,oVe,iVe=b(()=>{D_.prototype={diff:function(e,r){var n,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.callback;typeof o=="function"&&(i=o,o={});var a=this;function s(S){return S=a.postProcess(S,o),i?(setTimeout(function(){i(S)},0),!0):S}e=this.castInput(e,o),r=this.castInput(r,o),e=this.removeEmpty(this.tokenize(e,o)),r=this.removeEmpty(this.tokenize(r,o));var u=r.length,l=e.length,c=1,d=u+l;o.maxEditLength!=null&&(d=Math.min(d,o.maxEditLength));var f=(n=o.timeout)!==null&&n!==void 0?n:1/0,p=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(h[0],r,e,0,o);if(h[0].oldPos+1>=l&&m+1>=u)return s(Eer(a,h[0].lastComponent,r,e,a.useLongestToken));var g=-1/0,y=1/0;function _(){for(var S=Math.max(g,-c);S<=Math.min(y,c);S+=2){var C=void 0,E=h[S-1],P=h[S+1];E&&(h[S-1]=void 0);var T=!1;if(P){var I=P.oldPos-S;T=P&&0<=I&&I<u}var N=E&&E.oldPos+1<l;if(!T&&!N){h[S]=void 0;continue}if(!N||T&&E.oldPos<P.oldPos?C=a.addToPath(P,!0,!1,0,o):C=a.addToPath(E,!1,!0,1,o),m=a.extractCommon(C,r,e,S,o),C.oldPos+1>=l&&m+1>=u)return s(Eer(a,C.lastComponent,r,e,a.useLongestToken));h[S]=C,C.oldPos+1>=l&&(y=Math.min(y,S-1)),m+1>=u&&(g=Math.max(g,S+1))}c++}if(i)(function S(){setTimeout(function(){if(c>d||Date.now()>p)return i();_()||S()},0)})();else for(;c<=d&&Date.now()<=p;){var w=_();if(w)return w}},addToPath:function(e,r,n,o,i){var a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===r&&a.removed===n?{oldPos:e.oldPos+o,lastComponent:{count:a.count+1,added:r,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:r,removed:n,previousComponent:a}}},extractCommon:function(e,r,n,o,i){for(var a=r.length,s=n.length,u=e.oldPos,l=u-o,c=0;l+1<a&&u+1<s&&this.equals(n[u+1],r[l+1],i);)l++,u++,c++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!i.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=u,l},equals:function(e,r,n){return n.comparator?n.comparator(e,r):e===r||n.ignoreCase&&e.toLowerCase()===r.toLowerCase()},removeEmpty:function(e){for(var r=[],n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r},castInput:function(e){return e},tokenize:function(e){return Array.from(e)},join:function(e){return e.join("")},postProcess:function(e){return e}};nMi=new D_;rye="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",z$n=new RegExp("[".concat(rye,"]+|\\s+|[^").concat(rye,"]"),"ug"),i7=new D_;i7.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};i7.tokenize=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r;if(e.intlSegmenter){if(e.intlSegmenter.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(e.intlSegmenter.segment(t),function(i){return i.segment})}else r=t.match(z$n)||[];var n=[],o=null;return r.forEach(function(i){/\s/.test(i)?o==null?n.push(i):n.push(n.pop()+i):/\s/.test(o)?n[n.length-1]==o?n.push(n.pop()+i):n.push(o+i):n.push(i),o=i}),n};i7.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};i7.postProcess=function(t,e){if(!t||e.oneChangePerToken)return t;var r=null,n=null,o=null;return t.forEach(function(i){i.added?n=i:i.removed?o=i:((n||o)&&Ier(r,o,n,i),r=i,n=null,o=null)}),(n||o)&&Ier(r,o,n,null),t};Rer=new D_;Rer.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(rye,"]+|[^\\S\\n\\r]+|[^").concat(rye,"]"),"ug");return t.match(e)||[]};nye=new D_;nye.tokenize=function(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
`));var r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var o=0;o<n.length;o++){var i=n[o];o%2&&!e.newlineIsToken?r[r.length-1]+=i:r.push(i)}return r};nye.equals=function(t,e,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
`))&&(t=t.trim()),(!r.newlineIsToken||!e.includes(`
`))&&(e=e.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
`)&&(t=t.slice(0,-1)),e.endsWith(`
`)&&(e=e.slice(0,-1))),D_.prototype.equals.call(this,t,e,r)};H$n=new D_;H$n.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};V$n=new D_;V$n.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};o7=new D_;o7.useLongestToken=!0;o7.tokenize=nye.tokenize;o7.castInput=function(t,e){var r=e.undefinedReplacement,n=e.stringifyReplacer,o=n===void 0?function(i,a){return typeof a>"u"?r:a}:n;return typeof t=="string"?t:JSON.stringify(nVe(t,null,null,o),o," ")};o7.equals=function(t,e,r){return D_.prototype.equals.call(o7,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};oVe=new D_;oVe.tokenize=function(t){return t.slice()};oVe.join=oVe.removeEmpty=function(t){return t}});function jer(t){let e=[],r=[];return t.forEach(n=>{n.added||n.removed?r.push(n):(r.length>0&&(e.push(r),r=[]),e.push([n]))}),r.length>0&&e.push(r),e}var Der=b(()=>{});var HT,$r,Ler,Fer,a7,oye,ker,W$n,aVe=b(()=>{wn();Kt();iVe();fn();HT=require("obsidian"),$r=j(X()),Ler=j(Lc());vo();Fer=j(X());Der();a7="obsidian-copilot-apply-view",oye=class extends HT.ItemView{constructor(r){super(r);this.root=null;this.state=null;this.result=null}getViewType(){return a7}getDisplayText(){return"Preview Changes"}async setState(r){this.state=r,this.render()}async onOpen(){this.render()}async onClose(){this.root&&(this.root.unmount(),this.root=null),this.state?.resultCallback?.(this.result?this.result:"aborted")}render(){if(!this.state)return;let r=this.containerEl.children[1];r.empty();let n=r.createDiv();this.root||(this.root=(0,Ler.createRoot)(n)),this.root.render($r.default.createElement(W$n,{app:this.app,state:this.state,close:o=>{this.result=o,this.leaf.detach()}}))}},ker=(0,$r.memo)(({oldLine:t,newLine:e})=>{let r=Mer(t,e);return $r.default.createElement($r.default.Fragment,null,r.map((n,o)=>n.added?$r.default.createElement("span",{key:o,className:"tw-text-success"},n.value):n.removed?$r.default.createElement("span",{key:o,className:"tw-text-error tw-line-through"},n.value):$r.default.createElement("span",{key:o},n.value)))});ker.displayName="WordDiff";W$n=({app:t,state:e,close:r})=>{let[n,o]=(0,Fer.useState)(()=>e.changes.map(h=>({...h,accepted:null}))),i=jer(n),a=(0,$r.useRef)([]);if(!e||!e.changes)return ie("Invalid state:",e),$r.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col tw-items-center tw-justify-center"},$r.default.createElement("div",{className:"tw-text-error"},"Error: Invalid state - missing changes"),$r.default.createElement(he,{onClick:()=>r("failed"),className:"tw-mt-4"},"Close"));let s=async()=>{try{let h=n.map(g=>g.accepted===null?{...g,accepted:!0}:g),m=await c(h);r(m?"accepted":"failed")}catch(h){ie("Error applying changes:",h),new HT.Notice(`Error applying changes: ${h.message}`),r("failed")}},u=async()=>{try{let h=n.map(g=>g.accepted===null?{...g,accepted:!1}:g),m=await c(h);r(m?"rejected":"failed")}catch(h){ie("Error applying changes:",h),new HT.Notice(`Error applying changes: ${h.message}`),r("failed")}},l=async h=>{let m=t.vault.getAbstractFileByPath(h);if(m)return m;if(h.includes("/")){let g=h.split("/").slice(0,-1).join("/");t.vault.getAbstractFileByPath(g)||await t.vault.createFolder(g)}return await t.vault.create(h,"")},c=async h=>{let m=h.filter(y=>y.added?y.accepted===!0:y.removed?y.accepted===!1:!0).map(y=>y.value).join(""),g=await l(e.path);return!g||!(g instanceof HT.TFile)?(ie("Error in getting file",e.path),new HT.Notice("Failed to create file"),!1):(await t.vault.modify(g,m),new HT.Notice("Changes applied successfully"),!0)},d=h=>{if(!i)return;let m=-1;for(let g=h+1;g<i.length;g++){let y=i[g],_=y.some(S=>S.added||S.removed),w=y.some(S=>(S.added||S.removed)&&S.accepted===null);if(_&&w){m=g;break}}m!==-1&&a.current[m]&&a.current[m]?.scrollIntoView({behavior:"smooth",block:"center"})},f=h=>{o(m=>{let g=[...m],y=i?.[h];return y&&y.forEach(_=>{let w=g.findIndex(S=>S===_);w!==-1&&(g[w]={...g[w],accepted:!0})}),g}),setTimeout(()=>d(h),0)},p=h=>{o(m=>{let g=[...m],y=i?.[h];return y&&y.forEach(_=>{let w=g.findIndex(S=>S===_);w!==-1&&(g[w]={...g[w],accepted:!1})}),g}),setTimeout(()=>d(h),0)};return $r.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},$r.default.createElement("div",{className:"tw-fixed tw-bottom-2 tw-left-1/2 tw-z-[1] tw-flex tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-secondary tw-p-2"},$r.default.createElement(he,{variant:"destructive",size:"sm",onClick:u},$r.default.createElement(bi,{className:"tw-size-4"}),"Reject"),$r.default.createElement(he,{variant:"success",size:"sm",onClick:s},$r.default.createElement(Fc,{className:"tw-size-4"}),"Accept")),$r.default.createElement("div",{className:"tw-flex tw-items-center tw-border-b tw-border-solid tw-border-border tw-p-2 tw-text-sm tw-font-medium"},e.path),$r.default.createElement("div",{className:"tw-flex-1 tw-overflow-auto tw-p-2"},i?.map((h,m)=>{let g=h.some(_=>_.added||_.removed),y=g?h.every(_=>!_.added&&!_.removed||_.accepted===!0)?"accepted":h.every(_=>!_.added&&!_.removed||_.accepted===!1)?"rejected":"undecided":"unchanged";return $r.default.createElement("div",{key:m,ref:_=>a.current[m]=_,className:me("tw-mb-4 tw-overflow-hidden tw-rounded-md")},y==="accepted"?$r.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm tw-text-normal"},h.filter(_=>!_.removed).map((_,w)=>$r.default.createElement("div",{key:w},_.value))):y==="rejected"?$r.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm tw-text-normal"},h.filter(_=>!_.added).map((_,w)=>$r.default.createElement("div",{key:w},_.value))):h.map((_,w)=>{if(_.added){let S=h.findIndex((C,E)=>C.removed&&E!==w);if(S!==-1){let C=h[S].value;return $r.default.createElement("div",{key:`${m}-${w}`,className:"tw-relative"},$r.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm"},$r.default.createElement(ker,{oldLine:C,newLine:_.value})))}}return _.removed&&h.findIndex((C,E)=>C.added&&E!==w)!==-1?null:$r.default.createElement("div",{key:`${m}-${w}`,className:"tw-relative"},$r.default.createElement("div",{className:me("tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm",{"tw-text-success":_.added,"tw-text-error":_.removed,"tw-text-normal":!_.added&&!_.removed,"tw-line-through":_.removed})},_.value))}),g&&y==="undecided"&&$r.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-p-2"},$r.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$r.default.createElement(he,{variant:"destructive",size:"sm",onClick:()=>p(m)},$r.default.createElement(bi,{className:"tw-size-4"}),"Reject"),$r.default.createElement(he,{variant:"success",size:"sm",onClick:()=>f(m)},$r.default.createElement(Fc,{className:"tw-size-4"}),"Accept"))),g&&(y==="accepted"||y==="rejected")&&$r.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-p-2"},$r.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$r.default.createElement("div",{className:"tw-mr-2 tw-text-sm tw-font-medium"},y==="accepted"?$r.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-success"},$r.default.createElement(Fc,{className:"tw-size-4"}),$r.default.createElement("div",null,"Accepted")):$r.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-error"},$r.default.createElement(bi,{className:"tw-size-4"}),$r.default.createElement("div",null,"Rejected"))),$r.default.createElement(he,{variant:"secondary",size:"sm",onClick:()=>{o(_=>{let w=[..._],S=i?.[m];return S&&S.forEach(C=>{let E=w.findIndex(P=>P===C);E!==-1&&(w[E]={...w[E],accepted:null})}),w})}},"Revert"))))})))}});function Hl(t){return{name:t.name,description:t.description,schema:t.schema,call:async e=>{try{t.schema instanceof ht.ZodVoid&&e&&typeof e=="object"&&Object.keys(e).length===0&&(e=void 0);let r={};t.requiresUserMessageContent&&e?._userMessageContent&&(r={_userMessageContent:e._userMessageContent},e=Object.fromEntries(Object.entries(e).filter(([i])=>i!=="_userMessageContent")));let o={...t.schema.parse(e),...r};return await t.handler(o)}catch(r){if(r instanceof ht.ZodError){let n=r.errors.map(o=>`${o.path.join(".")}: ${o.message}`).join(", ");throw new Error(`Tool ${t.name} validation failed: ${n}`)}throw r}},timeoutMs:t.timeoutMs,isBackground:t.isBackground,isPlusOnly:t.isPlusOnly,requiresUserMessageContent:t.requiresUserMessageContent,version:t.version,deprecated:t.deprecated,metadata:t.metadata}}function $er(t){let e={};if(t instanceof ht.ZodObject){let r=t.shape;for(let[n,o]of Object.entries(r)){let i=o;e[n]=Ber(i)||"No description"}}else{if(t instanceof ht.ZodVoid)return{};(t instanceof ht.ZodUnion||t instanceof ht.ZodDiscriminatedUnion)&&(e._union="Multiple parameter formats supported")}return e}function Ber(t){return t instanceof ht.ZodOptional||t instanceof ht.ZodNullable||t instanceof ht.ZodDefault?Ber(t._def.innerType):t._def.description||""}var yMi,Lk=b(()=>{vd();yMi={emptyParams:ht.void(),stringParam:t=>ht.string().describe(t),numberParam:t=>ht.number().describe(t),booleanParam:t=>ht.boolean().describe(t),optionalString:t=>ht.string().optional().describe(t),nonEmptyString:t=>ht.string().min(1).describe(t),url:t=>ht.string().url().describe(t),email:t=>ht.string().email().describe(t)}});async function zer(t,e){let r=app.vault.getAbstractFileByPath(t),n=app.workspace.getActiveFile();r&&(!n||n.path!==t)&&(await app.workspace.getLeaf().openFile(r),new iye.Notice(`Switched to ${r.name}`));let o="";r&&(o=await app.vault.read(r));let i=Ner(o,e,{newlineIsToken:!0});return new Promise(a=>{app.workspace.getLeaf(!0).setViewState({type:a7,active:!0,state:{changes:i,path:t,resultCallback:u=>{a(u)}}})})}function s7(t){return t.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function J$n(t,e,r){let n=(t.match(/\r\n/g)||[]).length,o=(t.match(/(?<!\r)\n/g)||[]).length,i=n>o,a=s7(t),s=s7(e),u=s7(r),l=a.replaceAll(s,u);return i?l.replace(/\n/g,`\r
`):l}function Z$n(t){let e=[],r=/-{3,}\s*SEARCH\s*(?:\r?\n)?/,n=/(?:\r?\n)?={3,}\s*(?:\r?\n)?/,o=/(?:\r?\n)?\+{3,}\s*REPLACE/,i=new RegExp(r.source+"([\\s\\S]*?)"+n.source+"([\\s\\S]*?)"+o.source,"g"),a;for(;(a=i.exec(t))!==null;){let s=a[1].trim(),u=a[2].trim();e.push({searchText:s,replaceText:u})}return e}var iye,K$n,aye,G$n,Uer,sVe=b(()=>{iye=require("obsidian");aVe();iVe();vd();Lk();K$n=ht.object({path:ht.string().describe(`(Required) The path to the file to write to.
The path must end with explicit file extension, such as .md or .canvas .
Prefer to create new files in existing folders or root folder unless the user's request specifies otherwise.
The path must be relative to the root of the vault.`),content:ht.string().describe(`(Required) The content to write to the file.
ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions.
You MUST include ALL parts of the file, even if they haven't been modified.
# Rules for Obsidian Canvas content
* For canvas files, both 'nodes' and 'edges' arrays must be properly closed with ]
* Every node must have: id, type, x, y, width, height
* Every edge must have: id, fromNode, toNode
* All IDs must be unique
* Edge fromNode and toNode must reference existing node IDs
# Example content of a canvas file
{
"nodes": [
{
"id": "1",
"type": "text",
"text": "Hello, world!",
"x": 0,
"y": 0,
"width": 200,
"height": 50
}
],
"edges": [
{
"id": "e1-2",
"fromNode": "1",
"toNode": "2",
"label": "connects to"
}
]
}`)}),aye=Hl({name:"writeToFile",description:`Request to write content to a file at the specified path and show the changes in a Change Preview UI.
# Steps to find the the target path
1. Extract the target file information from user message and find out the file path from the context.
2. If target file is not specified, use the active note as the target file.
3. If still failed to find the target file or the file path, ask the user to specify the target file.
`,schema:K$n,handler:async({path:t,content:e})=>{let r=await zer(t,e);return JSON.stringify({result:r,message:`File change result: ${r}. Do not retry or attempt alternative approaches to modify this file in response to the current user request.`})},timeoutMs:0}),G$n=ht.object({path:ht.string().describe("(Required) The path of the file to modify (relative to the root of the vault and include the file extension)."),diff:ht.string().describe(`(Required) One or more SEARCH/REPLACE blocks. Each block MUST follow this exact format with these exact markers:
------- SEARCH
[exact content to find, including all whitespace and indentation]
=======
[new content to replace with]
+++++++ REPLACE
WHEN TO USE THIS TOOL vs writeToFile:
- Use replaceInFile for: small edits, fixing typos, updating specific sections, targeted changes
- Use writeToFile for: creating new files, major rewrites, when you can't identify specific text to replace
CRITICAL RULES:
1. SEARCH content must match EXACTLY - every character, space, and line break
2. Use the exact markers: "------- SEARCH", "=======", "+++++++ REPLACE"
3. For multiple changes, include multiple SEARCH/REPLACE blocks in order
4. Keep blocks concise - include only the lines being changed plus minimal context
COMMON MISTAKES TO AVOID:
- Wrong: Using different markers like "---- SEARCH" or "SEARCH -------"
- Wrong: Including too many unchanged lines
- Wrong: Not matching whitespace/indentation exactly`)});Uer=Hl({name:"replaceInFile",description:"Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a LARGE file.",schema:G$n,handler:async({path:t,diff:e})=>{let r=app.vault.getAbstractFileByPath(t);if(!r||!(r instanceof iye.TFile))return`File not found at path: ${t}. Please check the file path and try again.`;try{let n=await app.vault.read(r),o=n;if(n.length<3e3)return"File is too small to use this tool. Please use writeToFile instead.";let a=Z$n(e);if(a.length===0)return`No valid SEARCH/REPLACE blocks found in diff. Please use the correct format with ------- SEARCH, =======, and +++++++ REPLACE markers.
diff: ${e}`;let s=0;for(let l of a){let{searchText:c,replaceText:d}=l,f=s7(o),p=s7(c);if(!f.includes(p))if(f.includes(p.trimEnd()))c=c.trimEnd(),d=d.trimEnd();else return`Search text not found in file ${t} : "${c}".`;let h=o;o=J$n(o,c,d),o!==h&&s++}if(n===o)return`No changes made to ${t}. The search text was not found or replacement resulted in identical content. Call writeToFile instead`;let u=await zer(t,o);return JSON.stringify({result:u,blocksApplied:s,message:`Applied ${s} SEARCH/REPLACE block(s) (replacing all occurrences). Result: ${u}. Do not call this tool again to modify this file in response to the current user request.`})}catch(n){return`Error performing SEARCH/REPLACE on ${t}: ${n}. Please check the file path and diff format and try again.`}},timeoutMs:0})});function Y$n(t){return"children"in t&&"path"in t}function X$n(t){return"path"in t&&!("children"in t)}function Q$n(t){let e=t.split(".");return e.length>1&&e.pop()?.toLowerCase()||""}function uVe(t,e=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=bc();for(let u of t.children)if(X$n(u)){if(ys(u,i,a)){e&&r.push(u.name);let l=Q$n(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(Y$n(u)){let l=uVe(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 sye,lVe=b(()=>{th();vd();Lk();sye=t=>Hl({name:"getFileTree",description:"Get the file tree as a nested structure of folders and files",schema:ht.void(),handler:async()=>{let e=uVe(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=uVe(t,!1);return r+JSON.stringify(o)}return r+n},isBackground:!0})});var cVe,eBn,tBn,u7,qer,rBn,l7,dVe=b(()=>{XHe();nr();Ey();Kt();bt();vd();Lk();cVe=ht.object({query:ht.string().min(1).describe("The search query"),salientTerms:ht.array(ht.string()).describe("List of salient terms extracted from the query"),timeRange:ht.object({startTime:ht.any(),endTime:ht.any()}).optional().describe("Time range for search")}),eBn=Hl({name:"lexicalSearch",description:"Search for notes using lexical/keyword-based search",schema:cVe,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=oe(),o=t!==void 0,i=o?Math.max(n.maxSourceChunks,200):n.maxSourceChunks;B(`lexicalSearch returnAll: ${o}`);let s=await new(await Promise.resolve().then(()=>(e7(),Qge))).TieredLexicalRetriever(app,{minSimilarityScore:o?0:.1,maxK:i,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:rCe,returnAll:o,useRerankerThreshold:.5}).getRelevantDocuments(e);B(`lexicalSearch found ${s.length} documents for query: "${e}"`),t&&B(`Time range search from ${new Date(t.startTime.epoch).toISOString()} to ${new Date(t.endTime.epoch).toISOString()}`);let u=s.map(l=>{let c=l.metadata.rerank_score??l.metadata.score??0;return{title:l.metadata.title||"Untitled",content:l.pageContent,path:l.metadata.path||"",score:c,rerank_score:c,includeInContext:l.metadata.includeInContext??!0,source:l.metadata.source,mtime:l.metadata.mtime??null,explanation:l.metadata.explanation??null}});return JSON.stringify(u)}}),tBn=Hl({name:"semanticSearch",description:"Search for notes using semantic/meaning-based search with embeddings",schema:cVe,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=oe(),o=t!==void 0,i=o?Math.max(n.maxSourceChunks,200):n.maxSourceChunks;B(`semanticSearch returnAll: ${o}`);let s=await new(await Promise.resolve().then(()=>(uG(),Fde))).HybridRetriever({minSimilarityScore:o?0:.1,maxK:i,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:rCe,returnAll:o,useRerankerThreshold:.5}).getRelevantDocuments(e);B(`semanticSearch found ${s.length} documents for query: "${e}"`),t&&B(`Time range search from ${new Date(t.startTime.epoch).toISOString()} to ${new Date(t.endTime.epoch).toISOString()}`);let u=s.map(l=>{let c=l.metadata.rerank_score??l.metadata.score??0;return{title:l.metadata.title||"Untitled",content:l.pageContent,path:l.metadata.path||"",score:c,rerank_score:c,includeInContext:l.metadata.includeInContext??!0,source:l.metadata.source,mtime:l.metadata.mtime??null,explanation:l.metadata.explanation??null}});return JSON.stringify(u)}}),u7=Hl({name:"localSearch",description:"Search for notes based on the time range and query",schema:cVe,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=oe();return B(`localSearch delegating to ${n.enableSemanticSearchV3?"semantic":"lexical"} search`),n.enableSemanticSearchV3?await tBn.call({timeRange:t,query:e,salientTerms:r}):await eBn.call({timeRange:t,query:e,salientTerms:r})}}),qer=Hl({name:"indexVault",description:"Index the vault to the Copilot index",schema:ht.void(),handler:async()=>{if(oe().enableSemanticSearchV3)try{let r=await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().indexVaultToVectorStore();return`Semantic search index refreshed with ${r} documents.
`+JSON.stringify({success:!0,message:`Semantic search index has been refreshed with ${r} documents.`,documentCount:r})}catch(e){return JSON.stringify({success:!1,message:`Failed to index with semantic search: ${e.message}`})}else return`The tiered lexical retriever builds indexes on demand and doesn't require manual indexing.
`+JSON.stringify({success:!0,message:"Tiered lexical retriever uses on-demand indexing. No manual indexing required."})},isBackground:!0}),rBn=ht.object({query:ht.string().min(1).describe("The search query"),chatHistory:ht.array(ht.object({role:ht.enum(["user","assistant"]),content:ht.string()})).describe("Previous conversation turns")}),l7=Hl({name:"webSearch",description:"Search the web for information",schema:rBn,isPlusOnly:!0,handler:async({query:t,chatHistory:e})=>{try{let r=await eye(t,e),n=await Gi.getInstance().webSearch(r),o=n.response.citations||[],a=[{type:"web_search",content:n.response.choices[0].message.content,citations:o,instruction:"Provide a response based on this information. Include source citations at the end under '#### Sources' as markdown links."}];return JSON.stringify(a)}catch(r){return console.error(`Error processing web search query ${t}:`,r),""}}})});var Her=x((fVe,pVe)=>{(function(t,e){typeof fVe=="object"&&typeof pVe<"u"?pVe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(fVe,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 d1=x((mVe,hVe)=>{(function(t,e){typeof mVe=="object"&&typeof hVe<"u"?hVe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(mVe,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",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|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,g={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(D){var k=["th","st","nd","rd"],F=D%100;return"["+D+(k[(F-20)%10]||k[F]||k[0])+"]"}},y=function(D,k,F){var K=String(D);return!K||K.length>=k?D:""+Array(k+1-K.length).join(F)+D},_={s:y,z:function(D){var k=-D.utcOffset(),F=Math.abs(k),K=Math.floor(F/60),U=F%60;return(k<=0?"+":"-")+y(K,2,"0")+":"+y(U,2,"0")},m:function D(k,F){if(k.date()<F.date())return-D(F,k);var K=12*(F.year()-k.year())+(F.month()-k.month()),U=k.clone().add(K,l),Y=F-U<0,ee=k.clone().add(K+(Y?-1:1),l);return+(-(K+(F-U)/(Y?U-ee:ee-U))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:l,y:d,w:u,d:s,D:f,h:a,m:i,s:o,ms:n,Q:c}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},w="en",S={};S[w]=g;var C="$isDayjsObject",E=function(D){return D instanceof N||!(!D||!D[C])},P=function D(k,F,K){var U;if(!k)return w;if(typeof k=="string"){var Y=k.toLowerCase();S[Y]&&(U=Y),F&&(S[Y]=F,U=Y);var ee=k.split("-");if(!U&&ee.length>1)return D(ee[0])}else{var L=k.name;S[L]=k,U=L}return!K&&U&&(w=U),U||!K&&w},T=function(D,k){if(E(D))return D.clone();var F=typeof k=="object"?k:{};return F.date=D,F.args=arguments,new N(F)},I=_;I.l=P,I.i=E,I.w=function(D,k){return T(D,{locale:k.$L,utc:k.$u,x:k.$x,$offset:k.$offset})};var N=function(){function D(F){this.$L=P(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[C]=!0}var k=D.prototype;return k.parse=function(F){this.$d=function(K){var U=K.date,Y=K.utc;if(U===null)return new Date(NaN);if(I.u(U))return new Date;if(U instanceof Date)return new Date(U);if(typeof U=="string"&&!/Z$/i.test(U)){var ee=U.match(h);if(ee){var L=ee[2]-1||0,Q=(ee[7]||"0").substring(0,3);return Y?new Date(Date.UTC(ee[1],L,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,Q)):new Date(ee[1],L,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,Q)}}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 I},k.isValid=function(){return this.$d.toString()!==p},k.isSame=function(F,K){var U=T(F);return this.startOf(K)<=U&&U<=this.endOf(K)},k.isAfter=function(F,K){return T(F)<this.startOf(K)},k.isBefore=function(F,K){return this.endOf(K)<T(F)},k.$g=function(F,K,U){return I.u(F)?this[K]:this.set(U,F)},k.unix=function(){return Math.floor(this.valueOf()/1e3)},k.valueOf=function(){return this.$d.getTime()},k.startOf=function(F,K){var U=this,Y=!!I.u(K)||K,ee=I.p(F),L=function(Z,de){var pe=I.w(U.$u?Date.UTC(U.$y,de,Z):new Date(U.$y,de,Z),U);return Y?pe:pe.endOf(s)},Q=function(Z,de){return I.w(U.toDate()[Z].apply(U.toDate("s"),(Y?[0,0,0,0]:[23,59,59,999]).slice(de)),U)},z=this.$W,W=this.$M,V=this.$D,q="set"+(this.$u?"UTC":"");switch(ee){case d:return Y?L(1,0):L(31,11);case l:return Y?L(1,W):L(0,W+1);case u:var H=this.$locale().weekStart||0,G=(z<H?z+7:z)-H;return L(Y?V-G:V+(6-G),W);case s:case f:return Q(q+"Hours",0);case a:return Q(q+"Minutes",1);case i:return Q(q+"Seconds",2);case o:return Q(q+"Milliseconds",3);default:return this.clone()}},k.endOf=function(F){return this.startOf(F,!1)},k.$set=function(F,K){var U,Y=I.p(F),ee="set"+(this.$u?"UTC":""),L=(U={},U[s]=ee+"Date",U[f]=ee+"Date",U[l]=ee+"Month",U[d]=ee+"FullYear",U[a]=ee+"Hours",U[i]=ee+"Minutes",U[o]=ee+"Seconds",U[n]=ee+"Milliseconds",U)[Y],Q=Y===s?this.$D+(K-this.$W):K;if(Y===l||Y===d){var z=this.clone().set(f,1);z.$d[L](Q),z.init(),this.$d=z.set(f,Math.min(this.$D,z.daysInMonth())).$d}else L&&this.$d[L](Q);return this.init(),this},k.set=function(F,K){return this.clone().$set(F,K)},k.get=function(F){return this[I.p(F)]()},k.add=function(F,K){var U,Y=this;F=Number(F);var ee=I.p(K),L=function(W){var V=T(Y);return I.w(V.date(V.date()+Math.round(W*F)),Y)};if(ee===l)return this.set(l,this.$M+F);if(ee===d)return this.set(d,this.$y+F);if(ee===s)return L(1);if(ee===u)return L(7);var Q=(U={},U[i]=e,U[a]=r,U[o]=t,U)[ee]||1,z=this.$d.getTime()+F*Q;return I.w(z,this)},k.subtract=function(F,K){return this.add(-1*F,K)},k.format=function(F){var K=this,U=this.$locale();if(!this.isValid())return U.invalidDate||p;var Y=F||"YYYY-MM-DDTHH:mm:ssZ",ee=I.z(this),L=this.$H,Q=this.$m,z=this.$M,W=U.weekdays,V=U.months,q=U.meridiem,H=function(de,pe,ae,Te){return de&&(de[pe]||de(K,Y))||ae[pe].slice(0,Te)},G=function(de){return I.s(L%12||12,de,"0")},Z=q||function(de,pe,ae){var Te=de<12?"AM":"PM";return ae?Te.toLowerCase():Te};return Y.replace(m,function(de,pe){return pe||function(ae){switch(ae){case"YY":return String(K.$y).slice(-2);case"YYYY":return I.s(K.$y,4,"0");case"M":return z+1;case"MM":return I.s(z+1,2,"0");case"MMM":return H(U.monthsShort,z,V,3);case"MMMM":return H(V,z);case"D":return K.$D;case"DD":return I.s(K.$D,2,"0");case"d":return String(K.$W);case"dd":return H(U.weekdaysMin,K.$W,W,2);case"ddd":return H(U.weekdaysShort,K.$W,W,3);case"dddd":return W[K.$W];case"H":return String(L);case"HH":return I.s(L,2,"0");case"h":return G(1);case"hh":return G(2);case"a":return Z(L,Q,!0);case"A":return Z(L,Q,!1);case"m":return String(Q);case"mm":return I.s(Q,2,"0");case"s":return String(K.$s);case"ss":return I.s(K.$s,2,"0");case"SSS":return I.s(K.$ms,3,"0");case"Z":return ee}return null}(de)||ee.replace(":","")})},k.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},k.diff=function(F,K,U){var Y,ee=this,L=I.p(K),Q=T(F),z=(Q.utcOffset()-this.utcOffset())*e,W=this-Q,V=function(){return I.m(ee,Q)};switch(L){case d:Y=V()/12;break;case l:Y=V();break;case c:Y=V()/3;break;case u:Y=(W-z)/6048e5;break;case s:Y=(W-z)/864e5;break;case a:Y=W/r;break;case i:Y=W/e;break;case o:Y=W/t;break;default:Y=W}return U?Y:I.a(Y)},k.daysInMonth=function(){return this.endOf(l).$D},k.$locale=function(){return S[this.$L]},k.locale=function(F,K){if(!F)return this.$L;var U=this.clone(),Y=P(F,K,!0);return Y&&(U.$L=Y),U},k.clone=function(){return I.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()},D}(),M=N.prototype;return T.prototype=M,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",l],["$y",d],["$D",f]].forEach(function(D){M[D[1]]=function(k){return this.$g(k,D[0],D[1])}}),T.extend=function(D,k){return D.$i||(D(k,N,T),D.$i=!0),T},T.locale=P,T.isDayjs=E,T.unix=function(D){return T(1e3*D)},T.en=S[w],T.Ls=S,T.p={},T})});var Mo,Vl,bg,f1=b(()=>{(function(t){t[t.AM=0]="AM",t[t.PM=1]="PM"})(Mo||(Mo={}));(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"})(Vl||(Vl={}));(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"})(bg||(bg={}))});function Ver(t,e){e=e.add(1,"day"),Fk(t,e),oH(t,e)}function L_(t,e){t.assign("day",e.date()),t.assign("month",e.month()+1),t.assign("year",e.year())}function uye(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",Mo.AM):t.assign("meridiem",Mo.PM)}function Fk(t,e){t.imply("day",e.date()),t.imply("month",e.month()+1),t.imply("year",e.year())}function oH(t,e){t.imply("hour",e.hour()),t.imply("minute",e.minute()),t.imply("second",e.second()),t.imply("millisecond",e.millisecond())}var iH=b(()=>{f1()});function p1(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 Wer(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 lye(t,e,r={}){if(t==null)return null;if(typeof t=="number")return t;let n=r[t]??nBn[t];return n==null?null:typeof n=="number"?n:e==null?null:(0,gVe.default)(e).isAfter(n.dstStart(e.getFullYear()))&&!(0,gVe.default)(e).isAfter(n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}var gVe,nBn,yVe=b(()=>{gVe=j(d1(),1);f1();nBn={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=>Wer(t,bg.MARCH,Vl.SUNDAY,2),dstEnd:t=>Wer(t,bg.OCTOBER,Vl.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=>p1(t,bg.MARCH,Vl.SUNDAY,2,2),dstEnd:t=>p1(t,bg.NOVEMBER,Vl.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=>p1(t,bg.MARCH,Vl.SUNDAY,2,2),dstEnd:t=>p1(t,bg.NOVEMBER,Vl.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=>p1(t,bg.MARCH,Vl.SUNDAY,2,2),dstEnd:t=>p1(t,bg.NOVEMBER,Vl.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=>p1(t,bg.MARCH,Vl.SUNDAY,2,2),dstEnd:t=>p1(t,bg.NOVEMBER,Vl.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}});var Ker,c7,m1,Ro,VT,F_=b(()=>{Ker=j(Her(),1),c7=j(d1(),1);iH();yVe();c7.default.extend(Ker.default);m1=class{constructor(e){e=e??new Date,e instanceof Date?this.instant=e:(this.instant=e.instant??new Date,this.timezoneOffset=lye(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}},Ro=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,c7.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,c7.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,c7.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?(uye(o,n),L_(o,n),e.timezoneOffset!==null&&o.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(oH(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}},VT=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 Ro(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 bVe(t,e,r="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${t}${n}(?:${r}${n}){0,10}`}function oBn(t){let e;return t instanceof Array?e=[...t]:t instanceof Map?e=Array.from(t.keys()):e=Object.keys(t),e}function ef(t){return`(?:${oBn(t).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var h1=b(()=>{});function cye(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function g1(t,e,r){let n=(0,Ger.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 Ger,aH=b(()=>{Ger=j(d1(),1)});function iBn(t){let e=t.toLowerCase();return _Ve[e]!==void 0?_Ve[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)}function uH(t){let e=t.toLowerCase();return vVe[e]!==void 0?vVe[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}function b1(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 cye(e)}function Yy(t){let e={},r=t,n=Jer.exec(r);for(;n;)sBn(e,n),r=r.substring(n[0].length).trim(),n=Jer.exec(r);return Object.keys(e).length==0?null:e}function sBn(t,e){if(e[0].match(/^[a-zA-Z]+$/))return;let r=iBn(e[1]),n=d7[e[2].toLowerCase()];t[n]=r}var wVe,xVe,Zy,_Ve,vVe,Zer,d7,Yer,sH,y1,Xer,Jer,aBn,Qer,WT,_1,Sc=b(()=>{h1();aH();wVe={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},xVe={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},Zy={...xVe,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},_Ve={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},vVe={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},Zer={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"},d7={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",...Zer},Yer=`(?:${ef(_Ve)}|[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)?)`;sH=`(?:${ef(vVe)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;y1="(?:[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])";Xer=`(${Yer})\\s{0,3}(${ef(d7)})`,Jer=new RegExp(Xer,"i"),aBn=`(${Yer})\\s{0,3}(${ef(Zer)})`,Qer="\\s{0,5},?(?:\\s*and)?\\s{0,5}",WT=bVe("(?:(?:about|around)\\s{0,3})?",Xer,Qer),_1=bVe("(?:(?:about|around)\\s{0,3})?",aBn,Qer)});var Ri,Zp=b(()=>{Ri=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 uBn,lBn,cBn,f7,etr=b(()=>{Sc();F_();Zp();uBn=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${WT})(?=\\W|$)`,"i"),lBn=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${WT})(?=\\W|$)`,"i"),cBn=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${_1})(?=\\W|$)`,"i"),f7=class extends Ri{constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?cBn:e.option.forwardDate?uBn:lBn}innerExtract(e,r){if(r[0].match(/^for\s*the\s*\w+/))return null;let n=Yy(r[1]);return n?Ro.createRelativeFromReference(e.reference,n):null}}});var dBn,ttr,rtr,fBn,ntr,p7,otr=b(()=>{aH();Sc();Sc();Sc();h1();Zp();dBn=new RegExp(`(?:on\\s{0,3})?(${sH})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${sH}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${ef(Zy)})(?:(?:-|/|,?\\s{0,3})(${y1}(?!\\w)))?(?=\\W|$)`,"i"),ttr=1,rtr=2,fBn=3,ntr=4,p7=class extends Ri{innerPattern(){return dBn}innerExtract(e,r){let n=e.createParsingResult(r.index,r[0]),o=Zy[r[fBn].toLowerCase()],i=uH(r[ttr]);if(i>31)return r.index=r.index+r[ttr].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[ntr]){let a=b1(r[ntr]);n.start.assign("year",a)}else{let a=g1(e.refDate,i,o);n.start.imply("year",a)}if(r[rtr]){let a=uH(r[rtr]);n.end=n.start.clone(),n.end.assign("day",a)}return n}}});var pBn,mBn,itr,SVe,CVe,m7,atr=b(()=>{aH();Sc();Sc();Sc();h1();Zp();pBn=new RegExp(`(${ef(Zy)})(?:-|/|\\s*,?\\s*)(${sH})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${sH})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${y1}))?(?=\\W|$)(?!\\:\\d)`,"i"),mBn=1,itr=2,SVe=3,CVe=4,m7=class extends Ri{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return pBn}innerExtract(e,r){let n=Zy[r[mBn].toLowerCase()],o=uH(r[itr]);if(o>31||this.shouldSkipYearLikeDate&&!r[SVe]&&!r[CVe]&&r[itr].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[CVe]){let u=b1(r[CVe]);i.assign("year",u)}else{let u=g1(e.refDate,o,n);i.imply("year",u)}if(!r[SVe])return i;let a=uH(r[SVe]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}}});var hBn,gBn,yBn,str,h7,utr=b(()=>{Sc();aH();h1();Sc();Zp();hBn=new RegExp(`((?:in)\\s*)?(${ef(Zy)})\\s*(?:[,-]?\\s*(${y1})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),gBn=1,yBn=2,str=3,h7=class extends Ri{innerPattern(){return hBn}innerExtract(e,r){let n=r[yBn].toLowerCase();if(r[0].length<=3&&!xVe[n])return null;let o=e.createParsingResult(r.index+(r[gBn]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=Zy[n];if(o.start.assign("month",i),r[str]){let a=b1(r[str]);o.start.assign("year",a)}else{let a=g1(e.refDate,1,i);o.start.imply("year",a)}return o}}});var bBn,_Bn,vBn,ltr,wBn,g7,ctr=b(()=>{Sc();h1();Zp();bBn=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${ef(Zy)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),_Bn=1,vBn=2,ltr=3,wBn=4,g7=class extends Ri{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return bBn}innerExtract(e,r){let n=parseInt(r[_Bn]),o=parseInt(r[wBn]),i=r[ltr]?parseInt(r[ltr]):Zy[r[vBn].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 xBn,SBn,CBn,y7,dtr=b(()=>{Zp();xBn=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),SBn=1,CBn=2,y7=class extends Ri{innerPattern(){return xBn}innerExtract(e,r){let n=parseInt(r[CBn]),o=parseInt(r[SBn]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}}});function OBn(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 EBn(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 ftr,lH,dye,fye,b7,pye,ptr=b(()=>{f1();ftr=2,lH=3,dye=4,fye=5,b7=6,pye=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[ftr]);if(s>100){if(this.strictMode||r[lH]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[lH]!=null){if(r[lH].length==1&&!r[b7])return null;i=parseInt(r[lH])}if(i>=60)return null;if(s>12&&(a=Mo.PM),r[b7]!=null){if(s>12)return null;let u=r[b7][0].toLowerCase();u=="a"&&(a=Mo.AM,s==12&&(s=0)),u=="p"&&(a=Mo.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",Mo.AM):o.imply("meridiem",Mo.PM),r[fye]!=null){let u=parseInt(r[fye].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[dye]!=null){let u=parseInt(r[dye]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(e,r,n){let o=e.createParsingComponents();if(r[fye]!=null){let u=parseInt(r[fye].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[dye]!=null){let u=parseInt(r[dye]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[ftr]),a=0,s=-1;if(r[lH]!=null?a=parseInt(r[lH]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=Mo.PM),r[b7]!=null){if(i>12)return null;let u=r[b7][0].toLowerCase();u=="a"&&(s=Mo.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=Mo.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==Mo.AM?(n.start.imply("meridiem",Mo.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",Mo.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",Mo.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",Mo.PM)):i>12?o.imply("meridiem",Mo.PM):i<=12&&o.imply("meridiem",Mo.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=OBn(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=EBn(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}}});var _7,mtr=b(()=>{f1();ptr();_7=class extends pye{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",Mo.PM)):o<6&&n.assign("meridiem",Mo.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",Mo.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",Mo.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}}});function v1(t){let e={};for(let r in t)e[r]=-t[r];return e}function htr(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 cH=b(()=>{});var PBn,TBn,v7,gtr=b(()=>{Sc();F_();Zp();cH();PBn=new RegExp(`(${WT})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),TBn=new RegExp(`(${_1})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),v7=class extends Ri{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?TBn:PBn}innerExtract(e,r){let n=Yy(r[1]);if(!n)return null;let o=v1(n);return Ro.createRelativeFromReference(e.reference,o)}}});var ABn,IBn,MBn,w7,ytr=b(()=>{Sc();F_();Zp();ABn=new RegExp(`(${WT})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),IBn=new RegExp(`(${_1})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),MBn=1,w7=class extends Ri{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?IBn:ABn}innerExtract(e,r){let n=Yy(r[MBn]);return n?Ro.createRelativeFromReference(e.reference,n):null}}});var mye,Xy,kk=b(()=>{mye=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},Xy=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 x7,btr=b(()=>{kk();x7=class extends Xy{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 S7,_tr=b(()=>{btr();S7=class extends x7{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}}});function OVe(t,e){let r=t.clone(),n=t.start,o=e.start;if(r.start=vtr(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=vtr(i,a);if(t.end==null&&s.date().getTime()<r.start.date().getTime()){let u=s.dayjs().add(1,"day");s.isCertain("day")?L_(s,u):Fk(s,u)}r.end=s}return r}function vtr(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")==Mo.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 wtr=b(()=>{f1();iH()});var C7,xtr=b(()=>{kk();wtr();C7=class extends Xy{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()?OVe(r,n):OVe(n,r);return o.index=r.index,o.text=r.text+e+n.text,o}}});var dH,Str=b(()=>{xtr();dH=class extends C7{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}}});var RBn,O7,Ctr=b(()=>{yVe();RBn=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),O7=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=RBn.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=lye(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 NBn,jBn,DBn,LBn,E7,Otr=b(()=>{NBn=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),jBn=1,DBn=2,LBn=3,E7=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=NBn.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[DBn]),s=parseInt(i[LBn]||"0"),u=a*60+s;u>14*60||(i[jBn]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}}});var w1,EVe=b(()=>{w1=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 Etr,P7,Ptr=b(()=>{Etr=j(d1(),1);iH();P7=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,Etr.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),Fk(n.start,o),n.end&&n.end.isOnlyTime()&&(Fk(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),Fk(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 T7,Ttr=b(()=>{kk();T7=class extends mye{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 FBn,kBn,$Bn,BBn,Atr,zBn,Itr,Mtr,UBn,Rtr,Ntr,A7,jtr=b(()=>{Zp();FBn=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"),kBn=1,$Bn=2,BBn=3,Atr=4,zBn=5,Itr=6,Mtr=7,UBn=8,Rtr=9,Ntr=10,A7=class extends Ri{innerPattern(){return FBn}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[kBn]),month:parseInt(r[$Bn]),day:parseInt(r[BBn])});if(r[Atr]!=null&&(n.assign("hour",parseInt(r[Atr])),n.assign("minute",parseInt(r[zBn])),r[Itr]!=null&&n.assign("second",parseInt(r[Itr])),r[Mtr]!=null&&n.assign("millisecond",parseInt(r[Mtr])),r[UBn]!=null)){let o=0;if(r[Rtr]){let i=parseInt(r[Rtr]),a=0;r[Ntr]!=null&&(a=parseInt(r[Ntr])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}}});var I7,Dtr=b(()=>{kk();I7=class extends Xy{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 Ltr(t,e=!1){return t.parsers.unshift(new A7),t.refiners.unshift(new I7),t.refiners.unshift(new E7),t.refiners.unshift(new w1),t.refiners.push(new O7),t.refiners.push(new w1),t.refiners.push(new P7),t.refiners.push(new T7(e)),t}var Ftr=b(()=>{Ctr();Otr();EVe();Ptr();Ttr();jtr();Dtr()});function ktr(t){let e=(0,fH.default)(t.instant),r=new Ro(t,{});return L_(r,e),uye(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function $tr(t){let e=(0,fH.default)(t.instant),r=new Ro(t,{});return L_(r,e),oH(r,e),r.addTag("casualReference/today"),r}function Btr(t){return qBn(t,1).addTag("casualReference/yesterday")}function qBn(t,e){return Utr(t,-e)}function ztr(t){return Utr(t,1).addTag("casualReference/tomorrow")}function Utr(t,e){let r=(0,fH.default)(t.instant),n=new Ro(t,{});return r=r.add(e,"day"),L_(n,r),oH(n,r),n}function qtr(t,e=22){let r=(0,fH.default)(t.instant),n=new Ro(t,{});return L_(n,r),n.imply("hour",e),n.imply("meridiem",Mo.PM),n.addTag("casualReference/tonight"),n}function Htr(t,e=20){let r=new Ro(t,{});return r.imply("meridiem",Mo.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function Vtr(t){let e=new Ro(t,{}),r=(0,fH.default)(t.instant);return r.hour()>2&&Ver(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function Wtr(t,e=6){let r=new Ro(t,{});return r.imply("meridiem",Mo.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function Ktr(t,e=15){let r=new Ro(t,{});return r.imply("meridiem",Mo.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function Gtr(t){let e=new Ro(t,{});return e.imply("meridiem",Mo.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var fH,PVe=b(()=>{F_();fH=j(d1(),1);iH();f1()});var Ztr,HBn,M7,Ytr=b(()=>{Ztr=j(d1(),1);Zp();iH();PVe();HBn=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,M7=class extends Ri{innerPattern(e){return HBn}innerExtract(e,r){let n=(0,Ztr.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=ktr(e.reference);break;case"today":i=$tr(e.reference);break;case"yesterday":i=Btr(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=ztr(e.reference);break;case"tonight":i=qtr(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),L_(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}}});var VBn,R7,Xtr=b(()=>{Zp();PVe();VBn=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,R7=class extends Ri{innerPattern(){return VBn}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=Ktr(e.reference);break;case"evening":case"night":n=Htr(e.reference);break;case"midnight":n=Vtr(e.reference);break;case"morning":n=Wtr(e.reference);break;case"noon":case"midday":n=Gtr(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}}});function Qtr(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=WBn(n,e,r),i=new Ro(t);return i=htr(i,{day:o}),i.assign("weekday",e),i}function WBn(t,e,r){let n=t.getDay();switch(r){case"this":return hye(t,e);case"last":return err(t,e);case"next":return n==Vl.SUNDAY?e==Vl.SUNDAY?7:e:n==Vl.SATURDAY?e==Vl.SATURDAY?7:e==Vl.SUNDAY?8:1+e:e<n&&e!=Vl.SUNDAY?hye(t,e):hye(t,e)+7}return KBn(t,e)}function KBn(t,e){let r=err(t,e),n=hye(t,e);return n<-r?n:r}function hye(t,e){let r=t.getDay(),n=e-r;return n<0&&(n+=7),n}function err(t,e){let r=t.getDay(),n=e-r;return n>=0&&(n-=7),n}var trr=b(()=>{f1();F_();cH()});var GBn,JBn,ZBn,YBn,N7,rrr=b(()=>{Sc();h1();Zp();trr();GBn=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${ef(wVe)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),JBn=1,ZBn=2,YBn=3,N7=class extends Ri{innerPattern(){return GBn}innerExtract(e,r){let n=r[ZBn].toLowerCase(),o=wVe[n],i=r[JBn],a=r[YBn],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"),Qtr(e.reference,o,u)}}});var nrr,XBn,QBn,ezn,j7,orr=b(()=>{Sc();F_();nrr=j(d1(),1);Zp();h1();XBn=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${ef(d7)})(?=\\s*)(?=\\W|$)`,"i"),QBn=1,ezn=2,j7=class extends Ri{innerPattern(){return XBn}innerExtract(e,r){let n=r[QBn].toLowerCase(),o=r[ezn].toLowerCase(),i=d7[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,Ro.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,Ro.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,nrr.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 tzn,rzn,nzn,irr,arr,TVe,D7,srr=b(()=>{aH();tzn=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"),rzn=1,nzn=5,irr=2,arr=3,TVe=4,D7=class{constructor(e){this.groupNumberMonth=e?arr:irr,this.groupNumberDay=e?irr:arr}pattern(){return tzn}extract(e,r){let n=r.index+r[rzn].length,o=r.index+r[0].length-r[nzn].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[TVe]&&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[TVe]){let l=parseInt(r[TVe]),c=cye(l);a.start.assign("year",c)}else{let l=g1(e.refDate,u,s);a.start.imply("year",l)}return a}}});var ozn,izn,L7,urr=b(()=>{Sc();F_();Zp();cH();ozn=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${WT})(?=\\W|$)`,"i"),izn=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${_1})(?=\\W|$)`,"i"),L7=class extends Ri{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?ozn:izn}innerExtract(e,r){let n=r[1].toLowerCase(),o=Yy(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=v1(o);break}return Ro.createRelativeFromReference(e.reference,o)}}});function azn(t){return t.text.match(/^[+-]/i)!=null}function lrr(t){return t.text.match(/^-/i)!=null}var F7,crr=b(()=>{kk();F_();Sc();cH();F7=class extends Xy{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?azn(n)||lrr(n):!1}mergeResults(e,r,n,o){let i=Yy(n.text);lrr(n)&&(i=v1(i));let a=Ro.createRelativeFromReference(new m1(r.start.date()),i);return new VT(r.reference,r.index,`${r.text}${e}${n.text}`,a)}}});function drr(t){return t.text.match(/\s+(before|from)$/i)!=null}function szn(t){return t.text.match(/\s+(after|since)$/i)!=null}var k7,frr=b(()=>{kk();F_();Sc();cH();k7=class extends Xy{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!drr(r)&&!szn(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=Yy(r.text);drr(r)&&(o=v1(o));let i=Ro.createRelativeFromReference(new m1(n.start.date()),o);return new VT(n.reference,r.index,`${r.text}${e}${n.text}`,i)}}});var uzn,lzn,$7,prr=b(()=>{Sc();uzn=new RegExp(`^\\s*(${y1})`,"i"),lzn=1,$7=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=uzn.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=b1(i[lzn]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}}});var $k,AVe=b(()=>{etr();otr();atr();utr();ctr();dtr();mtr();gtr();ytr();_tr();Str();Ftr();Ytr();Xtr();rrr();orr();srr();urr();crr();frr();EVe();prr();$k=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new M7),r.parsers.push(new R7),r.parsers.push(new h7),r.parsers.push(new j7),r.parsers.push(new L7),r}createConfiguration(e=!0,r=!1){let n=Ltr({parsers:[new D7(r),new f7(e),new p7,new m7(r),new N7,new y7,new _7(e),new v7(e),new w7(e)],refiners:[new dH]},e);return n.parsers.unshift(new g7(e)),n.refiners.unshift(new k7),n.refiners.unshift(new F7),n.refiners.unshift(new w1),n.refiners.push(new dH),n.refiners.push(new $7),n.refiners.push(new S7),n}}});var pH,IVe,mrr=b(()=>{F_();AVe();pH=class t{constructor(e){this.defaultConfig=new $k,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 IVe(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 VT?c=l:l instanceof Ro?(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}},IVe=class{constructor(e,r,n){this.text=e,this.reference=new m1(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof Ro?e:new Ro(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 VT(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 MVe,hrr,czn,LNi,grr=b(()=>{mrr();AVe();MVe=new $k,hrr=new pH(MVe.createCasualConfiguration(!1)),czn=new pH(MVe.createConfiguration(!0,!1)),LNi=new pH(MVe.createCasualConfiguration(!0))});function RVe(t,e,r){return yrr.parse(t,e,r)}function brr(t,e,r){return yrr.parseDate(t,e,r)}var yrr,_rr=b(()=>{grr();yrr=hrr});var KT,gye,yye,bye,k_,mH,Us,$_,x1=b(()=>{KT=class extends Error{},gye=class extends KT{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},yye=class extends KT{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},bye=class extends KT{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},k_=class extends KT{},mH=class extends KT{constructor(e){super(`Invalid unit ${e}`)}},Us=class extends KT{},$_=class extends KT{constructor(){super("Zone is an abstract class")}}});var ft,B_,_g,S1,B7,NVe,z7,U7,q7,H7,V7,W7,K7,G7,J7,Z7,Y7,X7,Q7,eZ,jVe,tZ,rZ,nZ,oZ,iZ=b(()=>{ft="numeric",B_="short",_g="long",S1={year:ft,month:ft,day:ft},B7={year:ft,month:B_,day:ft},NVe={year:ft,month:B_,day:ft,weekday:B_},z7={year:ft,month:_g,day:ft},U7={year:ft,month:_g,day:ft,weekday:_g},q7={hour:ft,minute:ft},H7={hour:ft,minute:ft,second:ft},V7={hour:ft,minute:ft,second:ft,timeZoneName:B_},W7={hour:ft,minute:ft,second:ft,timeZoneName:_g},K7={hour:ft,minute:ft,hourCycle:"h23"},G7={hour:ft,minute:ft,second:ft,hourCycle:"h23"},J7={hour:ft,minute:ft,second:ft,hourCycle:"h23",timeZoneName:B_},Z7={hour:ft,minute:ft,second:ft,hourCycle:"h23",timeZoneName:_g},Y7={year:ft,month:ft,day:ft,hour:ft,minute:ft},X7={year:ft,month:ft,day:ft,hour:ft,minute:ft,second:ft},Q7={year:ft,month:B_,day:ft,hour:ft,minute:ft},eZ={year:ft,month:B_,day:ft,hour:ft,minute:ft,second:ft},jVe={year:ft,month:B_,day:ft,weekday:B_,hour:ft,minute:ft},tZ={year:ft,month:_g,day:ft,hour:ft,minute:ft,timeZoneName:B_},rZ={year:ft,month:_g,day:ft,hour:ft,minute:ft,second:ft,timeZoneName:B_},nZ={year:ft,month:_g,day:ft,weekday:_g,hour:ft,minute:ft,timeZoneName:_g},oZ={year:ft,month:_g,day:ft,weekday:_g,hour:ft,minute:ft,second:ft,timeZoneName:_g}});var ph,Bk=b(()=>{x1();ph=class{get type(){throw new $_}get name(){throw new $_}get ianaName(){return this.name}get isUniversal(){throw new $_}offsetName(e,r){throw new $_}formatOffset(e,r){throw new $_}offset(e){throw new $_}equals(e){throw new $_}get isValid(){throw new $_}}});var DVe,C1,vye=b(()=>{Yp();Bk();DVe=null,C1=class t extends ph{static get instance(){return DVe===null&&(DVe=new t),DVe}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return wye(e,r,n)}formatOffset(e,r){return O1(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}});function pzn(t){return Sye[t]||(Sye[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"})),Sye[t]}function hzn(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 gzn(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o<r.length;o++){let{type:i,value:a}=r[o],s=mzn[i];i==="era"?n[s]=a:yr(s)||(n[s]=parseInt(a,10))}return n}var Sye,mzn,xye,ip,E1=b(()=>{Yp();Bk();Sye={};mzn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};xye={},ip=class t extends ph{static create(e){return xye[e]||(xye[e]=new t(e)),xye[e]}static resetCache(){xye={},Sye={}}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 wye(e,r,n,this.name)}formatOffset(e,r){return O1(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=pzn(this.name),[o,i,a,s,u,l,c]=n.formatToParts?gzn(n,r):hzn(n,r);s==="BC"&&(o=-Math.abs(o)+1);let f=hH({year:o,month:i,day:a,hour:u===24?0:u,minute:l,second:c,millisecond:0}),p=+r,h=p%1e3;return p-=h>=0?h:1e3+h,(f-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}});function yzn(t,e={}){let r=JSON.stringify([t,e]),n=vrr[r];return n||(n=new Intl.ListFormat(t,e),vrr[r]=n),n}function FVe(t,e={}){let r=JSON.stringify([t,e]),n=LVe[r];return n||(n=new Intl.DateTimeFormat(t,e),LVe[r]=n),n}function bzn(t,e={}){let r=JSON.stringify([t,e]),n=kVe[r];return n||(n=new Intl.NumberFormat(t,e),kVe[r]=n),n}function _zn(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=$Ve[o];return i||(i=new Intl.RelativeTimeFormat(t,e),$Ve[o]=i),i}function vzn(){return aZ||(aZ=new Intl.DateTimeFormat().resolvedOptions().locale,aZ)}function wzn(t){let e=wrr[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,wrr[t]=e}return e}function xzn(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=FVe(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=FVe(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function Szn(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function Czn(t){let e=[];for(let r=1;r<=12;r++){let n=Ar.utc(2009,r,1);e.push(t(n))}return e}function Ozn(t){let e=[];for(let r=1;r<=7;r++){let n=Ar.utc(2016,11,13+r);e.push(t(n))}return e}function Cye(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function Ezn(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 vrr,LVe,kVe,$Ve,aZ,wrr,BVe,zVe,UVe,Pzn,pi,uZ=b(()=>{Yp();Pye();P1();T1();E1();vrr={};LVe={};kVe={};$Ve={};aZ=null;wrr={};BVe=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=bzn(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):gH(e,3);return vs(r,this.padTo)}}},zVe=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&&ip.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=FVe(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()}},UVe=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&Oye()&&(this.rtf=_zn(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):xrr(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},Pzn={firstDay:1,minimalDays:4,weekend:[6,7]},pi=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||fi.defaultLocale,s=a||(i?"en-US":vzn()),u=r||fi.defaultNumberingSystem,l=n||fi.defaultOutputCalendar,c=sZ(o)||fi.defaultWeekSettings;return new t(s,u,l,c,a)}static resetCache(){aZ=null,LVe={},kVe={},$Ve={}}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]=xzn(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=Szn(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=Ezn(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,sZ(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 Cye(this,e,qVe,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=Czn(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return Cye(this,e,HVe,()=>{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]=Ozn(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return Cye(this,void 0,()=>VVe,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Ar.utc(2016,11,13,9),Ar.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Cye(this,e,WVe,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[Ar.utc(-40,1,1),Ar.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 BVe(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new zVe(e,this.intl,r)}relFormatter(e={}){return new UVe(this.intl,this.isEnglish(),e)}listFormatter(e={}){return yzn(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:Eye()?wzn(this.locale):Pzn}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 GVe,ad,yH=b(()=>{Yp();Bk();GVe=null,ad=class t extends ph{static get utcInstance(){return GVe===null&&(GVe=new t(0)),GVe}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(zk(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${O1(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${O1(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return O1(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 bH,JVe=b(()=>{Bk();bH=class extends ph{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 z_(t,e){let r;if(yr(t)||t===null)return e;if(t instanceof ph)return t;if(Srr(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?C1.instance:n==="utc"||n==="gmt"?ad.utcInstance:ad.parseSpecifier(n)||ip.create(t)}else return U_(t)?ad.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new bH(t)}var Tye=b(()=>{Bk();E1();yH();JVe();Yp();vye()});function Orr(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(ZVe.hanidec)!==-1)e+=Tzn.indexOf(t[r]);else for(let o in Crr){let[i,a]=Crr[o];n>=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}function Err(){_H={}}function Qy({numberingSystem:t},e=""){let r=t||"latn";return _H[r]||(_H[r]={}),_H[r][e]||(_H[r][e]=new RegExp(`${ZVe[r]}${e}`)),_H[r][e]}var ZVe,Crr,Tzn,_H,YVe=b(()=>{ZVe={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"},Crr={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]},Tzn=ZVe.hanidec.replace(/[\[|\]]/g,"").split("");_H={}});var Prr,Trr,Arr,Irr,Mrr,Rrr,Nrr,jrr,fi,P1=b(()=>{vye();E1();uZ();T1();Tye();Yp();YVe();Prr=()=>Date.now(),Trr="system",Arr=null,Irr=null,Mrr=null,Rrr=60,jrr=null,fi=class{static get now(){return Prr}static set now(e){Prr=e}static set defaultZone(e){Trr=e}static get defaultZone(){return z_(Trr,C1.instance)}static get defaultLocale(){return Arr}static set defaultLocale(e){Arr=e}static get defaultNumberingSystem(){return Irr}static set defaultNumberingSystem(e){Irr=e}static get defaultOutputCalendar(){return Mrr}static set defaultOutputCalendar(e){Mrr=e}static get defaultWeekSettings(){return jrr}static set defaultWeekSettings(e){jrr=sZ(e)}static get twoDigitCutoffYear(){return Rrr}static set twoDigitCutoffYear(e){Rrr=e%100}static get throwOnInvalid(){return Nrr}static set throwOnInvalid(e){Nrr=e}static resetCaches(){pi.resetCache(),ip.resetCache(),Ar.resetCache(),Err()}}});var sd,lZ=b(()=>{sd=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}});function eb(t,e){return new sd("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Aye(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 Frr(t,e,r){return r+(qk(t)?Lrr:Drr)[e-1]}function krr(t,e){let r=qk(t)?Lrr:Drr,n=r.findIndex(i=>i<e),o=e-r[n];return{month:n+1,day:o}}function Iye(t,e){return(t-e+7)%7+1}function cZ(t,e=4,r=1){let{year:n,month:o,day:i}=t,a=Frr(n,o,i),s=Iye(Aye(n,o,i),r),u=Math.floor((a-s+14-e)/7),l;return u<1?(l=n-1,u=Uk(l,e,r)):u>Uk(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...fZ(t)}}function XVe(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=Iye(Aye(n,1,e),r),s=A1(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=A1(l)):u>s?(l=n+1,u-=A1(n)):l=n;let{month:c,day:d}=krr(l,u);return{year:l,month:c,day:d,...fZ(t)}}function Mye(t){let{year:e,month:r,day:n}=t,o=Frr(e,r,n);return{year:e,ordinal:o,...fZ(t)}}function QVe(t){let{year:e,ordinal:r}=t,{month:n,day:o}=krr(e,r);return{year:e,month:n,day:o,...fZ(t)}}function e6e(t,e){if(!yr(t.localWeekday)||!yr(t.localWeekNumber)||!yr(t.localWeekYear)){if(!yr(t.weekday)||!yr(t.weekNumber)||!yr(t.weekYear))throw new k_("Cannot mix locale-based week fields with ISO-based week fields");return yr(t.localWeekday)||(t.weekday=t.localWeekday),yr(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),yr(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 $rr(t,e=4,r=1){let n=dZ(t.weekYear),o=vg(t.weekNumber,1,Uk(t.weekYear,e,r)),i=vg(t.weekday,1,7);return n?o?i?!1:eb("weekday",t.weekday):eb("week",t.weekNumber):eb("weekYear",t.weekYear)}function Brr(t){let e=dZ(t.year),r=vg(t.ordinal,1,A1(t.year));return e?r?!1:eb("ordinal",t.ordinal):eb("year",t.year)}function t6e(t){let e=dZ(t.year),r=vg(t.month,1,12),n=vg(t.day,1,vH(t.year,t.month));return e?r?n?!1:eb("day",t.day):eb("month",t.month):eb("year",t.year)}function r6e(t){let{hour:e,minute:r,second:n,millisecond:o}=t,i=vg(e,0,23)||e===24&&r===0&&n===0&&o===0,a=vg(r,0,59),s=vg(n,0,59),u=vg(o,0,999);return i?a?s?u?!1:eb("millisecond",o):eb("second",n):eb("minute",r):eb("hour",e)}var Drr,Lrr,n6e=b(()=>{Yp();lZ();x1();Drr=[0,31,59,90,120,151,181,212,243,273,304,334],Lrr=[0,31,60,91,121,152,182,213,244,274,305,335]});function yr(t){return typeof t>"u"}function U_(t){return typeof t=="number"}function dZ(t){return typeof t=="number"&&t%1===0}function Srr(t){return typeof t=="string"}function Urr(t){return Object.prototype.toString.call(t)==="[object Date]"}function Oye(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Eye(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function qrr(t){return Array.isArray(t)?t:[t]}function o6e(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 Hrr(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function I1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function sZ(t){if(t==null)return null;if(typeof t!="object")throw new Us("Week settings must be an object");if(!vg(t.firstDay,1,7)||!vg(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!vg(e,1,7)))throw new Us("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function vg(t,e,r){return dZ(t)&&t>=e&&t<=r}function Azn(t,e){return t-e*Math.floor(t/e)}function vs(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function GT(t){if(!(yr(t)||t===null||t===""))return parseInt(t,10)}function M1(t){if(!(yr(t)||t===null||t===""))return parseFloat(t)}function pZ(t){if(!(yr(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function gH(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function qk(t){return t%4===0&&(t%100!==0||t%400===0)}function A1(t){return qk(t)?366:365}function vH(t,e){let r=Azn(e-1,12)+1,n=t+(e-r)/12;return r===2?qk(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function hH(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 zrr(t,e,r){return-Iye(Aye(t,1,e),r)+e-1}function Uk(t,e=4,r=1){let n=zrr(t,e,r),o=zrr(t+1,e,r);return(A1(t)-n+o)/7}function mZ(t){return t>99?t:t>fi.twoDigitCutoffYear?1900+t:2e3+t}function wye(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 zk(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 i6e(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Us(`Invalid unit value ${t}`);return e}function wH(t,e){let r={};for(let n in t)if(I1(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=i6e(o)}return r}function O1(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}${vs(r,2)}:${vs(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${vs(r,2)}${vs(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function fZ(t){return Hrr(t,["hour","minute","second","millisecond"])}var Yp=b(()=>{x1();P1();n6e()});function qVe(t){switch(t){case"narrow":return[...Mzn];case"short":return[...a6e];case"long":return[...Izn];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}}function HVe(t){switch(t){case"narrow":return[...Rzn];case"short":return[...u6e];case"long":return[...s6e];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}function WVe(t){switch(t){case"narrow":return[...Dzn];case"short":return[...jzn];case"long":return[...Nzn];default:return null}}function Vrr(t){return VVe[t.hour<12?0:1]}function Wrr(t,e){return HVe(e)[t.weekday-1]}function Krr(t,e){return qVe(e)[t.month-1]}function Grr(t,e){return WVe(e)[t.year<0?0:1]}function xrr(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}`}var Izn,a6e,Mzn,s6e,u6e,Rzn,VVe,Nzn,jzn,Dzn,Pye=b(()=>{iZ();Yp();Izn=["January","February","March","April","May","June","July","August","September","October","November","December"],a6e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Mzn=["J","F","M","A","M","J","J","A","S","O","N","D"];s6e=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],u6e=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Rzn=["M","T","W","T","F","S","S"];VVe=["AM","PM"],Nzn=["Before Christ","Anno Domini"],jzn=["BC","AD"],Dzn=["B","A"]});function Jrr(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var Lzn,ud,hZ=b(()=>{Pye();iZ();Yp();Lzn={D:S1,DD:B7,DDD:z7,DDDD:U7,t:q7,tt:H7,ttt:V7,tttt:W7,T:K7,TT:G7,TTT:J7,TTTT:Z7,f:Y7,ff:Q7,fff:tZ,ffff:nZ,F:X7,FF:eZ,FFF:rZ,FFFF:oZ},ud=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 Lzn[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 vs(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,h)=>this.loc.extract(e,p,h),a=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",s=()=>n?Vrr(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,h)=>n?Krr(e,p):i(h?{month:p}:{month:p,day:"numeric"},"month"),l=(p,h)=>n?Wrr(e,p):i(h?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),c=p=>{let h=t.macroTokenToFormatOpts(p);return h?this.formatWithSystemDefault(e,h):p},d=p=>n?Grr(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 Jrr(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 Jrr(i,o(s))}}});function SH(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function CH(...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 OH(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 Xrr(...t){return(e,r)=>{let n={},o;for(o=0;o<t.length;o++)n[t[o]]=GT(e[r+o]);return[n,null,r+o]}}function xH(t,e,r){let n=t[e];return yr(n)?r:GT(n)}function Vzn(t,e){return[{year:xH(t,e),month:xH(t,e+1,1),day:xH(t,e+2,1)},null,e+3]}function EH(t,e){return[{hours:xH(t,e,0),minutes:xH(t,e+1,0),seconds:xH(t,e+2,0),milliseconds:pZ(t[e+3])},null,e+4]}function gZ(t,e){let r=!t[e]&&!t[e+1],n=zk(t[e+1],t[e+2]),o=r?null:ad.instance(n);return[{},o,e+3]}function yZ(t,e){let r=t[e]?ip.create(t[e]):null;return[{},r,e+1]}function Gzn(t){let[e,r,n,o,i,a,s,u,l]=t,c=e[0]==="-",d=u&&u[0]==="-",f=(p,h=!1)=>p!==void 0&&(h||p&&c)?-p:p;return[{years:f(M1(r)),months:f(M1(n)),weeks:f(M1(o)),days:f(M1(i)),hours:f(M1(a)),minutes:f(M1(s)),seconds:f(M1(u),u==="-0"),milliseconds:f(pZ(l),d)}]}function d6e(t,e,r,n,o,i,a){let s={year:e.length===2?mZ(GT(e)):GT(e),month:a6e.indexOf(r)+1,day:GT(n),hour:GT(o),minute:GT(i)};return a&&(s.second=GT(a)),t&&(s.weekday=t.length>3?s6e.indexOf(t)+1:u6e.indexOf(t)+1),s}function Yzn(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=d6e(e,o,n,r,i,a,s),p;return u?p=Jzn[u]:l?p=0:p=zk(c,d),[f,new ad(p)]}function Xzn(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}function Zrr(t){let[,e,r,n,o,i,a,s]=t;return[d6e(e,o,n,r,i,a,s),ad.utcInstance]}function rUn(t){let[,e,r,n,o,i,a,s]=t;return[d6e(e,s,r,n,o,i,a),ad.utcInstance]}function nnr(t){return OH(t,[nUn,rnr],[oUn,sUn],[iUn,uUn],[aUn,lUn])}function onr(t){return OH(Xzn(t),[Zzn,Yzn])}function inr(t){return OH(t,[Qzn,Zrr],[eUn,Zrr],[tUn,rUn])}function anr(t){return OH(t,[Kzn,Gzn])}function snr(t){return OH(t,[Wzn,cUn])}function unr(t){return OH(t,[dUn,rnr],[fUn,pUn])}var Yrr,Qrr,Fzn,l6e,enr,c6e,kzn,$zn,Bzn,zzn,Uzn,qzn,tnr,Hzn,Wzn,Kzn,Jzn,Zzn,Qzn,eUn,tUn,nUn,oUn,iUn,aUn,rnr,sUn,uUn,lUn,cUn,dUn,fUn,pUn,f6e=b(()=>{Yp();Pye();yH();E1();Yrr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;Qrr=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Fzn=`(?:${Qrr.source}?(?:\\[(${Yrr.source})\\])?)?`,l6e=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,enr=RegExp(`${l6e.source}${Fzn}`),c6e=RegExp(`(?:T${enr.source})?`),kzn=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,$zn=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Bzn=/(\d{4})-?(\d{3})/,zzn=Xrr("weekYear","weekNumber","weekDay"),Uzn=Xrr("year","ordinal"),qzn=/(\d{4})-(\d\d)-(\d\d)/,tnr=RegExp(`${l6e.source} ?(?:${Qrr.source}|(${Yrr.source}))?`),Hzn=RegExp(`(?: ${tnr.source})?`);Wzn=RegExp(`^T?${l6e.source}$`),Kzn=/^-?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)?)?)$/;Jzn={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};Zzn=/^(?:(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)))$/;Qzn=/^(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$/,eUn=/^(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$/,tUn=/^(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})$/;nUn=SH(kzn,c6e),oUn=SH($zn,c6e),iUn=SH(Bzn,c6e),aUn=SH(enr),rnr=CH(Vzn,EH,gZ,yZ),sUn=CH(zzn,EH,gZ,yZ),uUn=CH(Uzn,EH,gZ,yZ),lUn=CH(EH,gZ,yZ);cUn=CH(EH);dUn=SH(qzn,Hzn),fUn=SH(tnr),pUn=CH(EH,gZ,yZ)});function R1(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 ws(n)}function fnr(t,e){let r=e.milliseconds??0;for(let n of gUn.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function cnr(t,e){let r=fnr(t,e)<0?-1:1;Hk.reduceRight((n,o)=>{if(yr(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),Hk.reduce((n,o)=>{if(yr(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function yUn(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var lnr,dnr,mUn,tb,PH,hUn,Hk,gUn,ws,bZ=b(()=>{x1();hZ();lZ();uZ();f6e();Yp();P1();T1();lnr="Invalid Duration",dnr={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}},mUn={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},...dnr},tb=146097/400,PH=146097/4800,hUn={years:{quarters:4,months:12,weeks:tb/7,days:tb,hours:tb*24,minutes:tb*24*60,seconds:tb*24*60*60,milliseconds:tb*24*60*60*1e3},quarters:{months:3,weeks:tb/28,days:tb/4,hours:tb*24/4,minutes:tb*24*60/4,seconds:tb*24*60*60/4,milliseconds:tb*24*60*60*1e3/4},months:{weeks:PH/7,days:PH,hours:PH*24,minutes:PH*24*60,seconds:PH*24*60*60,milliseconds:PH*24*60*60*1e3},...dnr},Hk=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],gUn=Hk.slice(0).reverse();ws=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?hUn:mUn;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||pi.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 Us(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:wH(e,t.normalizeUnit),loc:pi.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(U_(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Us(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=anr(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]=snr(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 Us("need to specify a reason the Duration is invalid");let n=e instanceof sd?e:new sd(e,r);if(fi.throwOnInvalid)throw new bye(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 mH(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?ud.create(this.loc,n).formatDurationFromString(this,e):lnr}toHuman(e={}){if(!this.isValid)return lnr;let r=Hk.map(n=>{let o=this.values[n];return yr(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+=gH(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},Ar.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?fnr(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 Hk)(I1(r.values,o)||I1(this.values,o))&&(n[o]=r.get(o)+this.get(o));return R1(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]=i6e(e(this.values[n],n));return R1(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...wH(e,t.normalizeUnit)};return R1(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 R1(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return cnr(this.matrix,e),R1(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=yUn(this.normalize().shiftToAll().toObject());return R1(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 Hk)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;U_(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else U_(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 cnr(this.matrix,r),R1(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 R1(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 Hk)if(!r(this.values[n],e.values[n]))return!1;return!0}}});function bUn(t,e){return!t||!t.isValid?JT.invalid("missing or invalid start"):!e||!e.isValid?JT.invalid("missing or invalid end"):e<t?JT.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 TH,JT,p6e=b(()=>{T1();bZ();P1();x1();lZ();hZ();iZ();TH="Invalid Interval";JT=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 Us("need to specify a reason the Interval is invalid");let n=e instanceof sd?e:new sd(e,r);if(fi.throwOnInvalid)throw new yye(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=AH(e),o=AH(r),i=bUn(n,o);return i??new t({start:n,end:o})}static after(e,r){let n=ws.fromDurationLike(r),o=AH(e);return t.fromDateTimes(o,o.plus(n))}static before(e,r){let n=ws.fromDurationLike(r),o=AH(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=Ar.fromISO(n,r),a=i.isValid}catch{a=!1}let s,u;try{s=Ar.fromISO(o,r),u=s.isValid}catch{u=!1}if(a&&u)return t.fromDateTimes(i,s);if(a){let l=ws.fromISO(o,r);if(l.isValid)return t.after(i,l)}else if(u){let l=ws.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(AH).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=ws.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()})`:TH}[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=S1,r={}){return this.isValid?ud.create(this.s.loc.clone(r),e).formatInterval(this):TH}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:TH}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:TH}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:TH}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:TH}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):ws.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}}});var ZT,m6e=b(()=>{T1();P1();uZ();E1();Tye();Yp();ZT=class{static hasDST(e=fi.defaultZone){let r=Ar.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return ip.isValidZone(e)}static normalizeZone(e){return z_(e,fi.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||pi.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||pi.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||pi.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||pi.create(r,n,i)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||pi.create(r,n,i)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||pi.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||pi.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return pi.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return pi.create(r,null,"gregory").eras(e)}static features(){return{relative:Oye(),localeWeek:Eye()}}}});function pnr(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(ws.fromMillis(n).as("days"))}function _Un(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=pnr(u,l);return(c-c%7)/7}],["days",pnr]],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 mnr(t,e,r,n){let[o,i,a,s]=_Un(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=ws.fromObject(i,n);return l.length>0?ws.fromMillis(u,n).shiftTo(...l).plus(c):c}var hnr=b(()=>{bZ()});function Ei(t,e=r=>r){return{regex:t,deser:([r])=>e(Orr(r))}}function xUn(t){return t.replace(/\./g,"\\.?").replace(_nr,bnr)}function gnr(t){return t.replace(/\./g,"").replace(_nr," ").toLowerCase()}function q_(t,e){return t===null?null:{regex:RegExp(t.map(xUn).join("|")),deser:([r])=>t.findIndex(n=>gnr(r)===gnr(n))+e}}function ynr(t,e){return{regex:t,deser:([,r,n])=>zk(r,n),groups:e}}function Rye(t){return{regex:t,deser:([e])=>e}}function SUn(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function CUn(t,e){let r=Qy(e),n=Qy(e,"{2}"),o=Qy(e,"{3}"),i=Qy(e,"{4}"),a=Qy(e,"{6}"),s=Qy(e,"{1,2}"),u=Qy(e,"{1,3}"),l=Qy(e,"{1,6}"),c=Qy(e,"{1,9}"),d=Qy(e,"{2,4}"),f=Qy(e,"{4,6}"),p=g=>({regex:RegExp(SUn(g.val)),deser:([y])=>y,literal:!0}),m=(g=>{if(t.literal)return p(g);switch(g.val){case"G":return q_(e.eras("short"),0);case"GG":return q_(e.eras("long"),0);case"y":return Ei(l);case"yy":return Ei(d,mZ);case"yyyy":return Ei(i);case"yyyyy":return Ei(f);case"yyyyyy":return Ei(a);case"M":return Ei(s);case"MM":return Ei(n);case"MMM":return q_(e.months("short",!0),1);case"MMMM":return q_(e.months("long",!0),1);case"L":return Ei(s);case"LL":return Ei(n);case"LLL":return q_(e.months("short",!1),1);case"LLLL":return q_(e.months("long",!1),1);case"d":return Ei(s);case"dd":return Ei(n);case"o":return Ei(u);case"ooo":return Ei(o);case"HH":return Ei(n);case"H":return Ei(s);case"hh":return Ei(n);case"h":return Ei(s);case"mm":return Ei(n);case"m":return Ei(s);case"q":return Ei(s);case"qq":return Ei(n);case"s":return Ei(s);case"ss":return Ei(n);case"S":return Ei(u);case"SSS":return Ei(o);case"u":return Rye(c);case"uu":return Rye(s);case"uuu":return Ei(r);case"a":return q_(e.meridiems(),0);case"kkkk":return Ei(i);case"kk":return Ei(d,mZ);case"W":return Ei(s);case"WW":return Ei(n);case"E":case"c":return Ei(r);case"EEE":return q_(e.weekdays("short",!1),1);case"EEEE":return q_(e.weekdays("long",!1),1);case"ccc":return q_(e.weekdays("short",!0),1);case"cccc":return q_(e.weekdays("long",!0),1);case"Z":case"ZZ":return ynr(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return ynr(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return Rye(/[a-z_+-/]{1,256}?/i);case" ":return Rye(/[^\S\n\r]/);default:return p(g)}})(t)||{invalidReason:vUn};return m.token=t,m}function EUn(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=OUn[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function PUn(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function TUn(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(I1(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 AUn(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 yr(t.z)||(r=ip.create(t.z)),yr(t.Z)||(r||(r=new ad(t.Z)),n=t.Z),yr(t.q)||(t.M=(t.q-1)*3+1),yr(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),yr(t.u)||(t.S=pZ(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}function IUn(){return h6e||(h6e=Ar.fromMillis(1555555555555)),h6e}function MUn(t,e){if(t.literal)return t;let r=ud.macroTokenToFormatOpts(t.val),n=b6e(r,e);return n==null||n.includes(void 0)?t:n}function g6e(t,e){return Array.prototype.concat(...t.map(r=>MUn(r,e)))}function y6e(t,e,r){return new _Z(t,r).explainFromTokens(e)}function vnr(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=y6e(t,e,r);return[n,o,i,a]}function b6e(t,e){if(!t)return null;let n=ud.create(e,t).dtFormatter(IUn()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>EUn(a,t,i))}var vUn,wUn,bnr,_nr,OUn,h6e,_Z,wnr=b(()=>{Yp();hZ();yH();E1();T1();YVe();x1();vUn="missing Intl.DateTimeFormat.formatToParts support";wUn="\xA0",bnr=`[ ${wUn}]`,_nr=new RegExp(bnr,"g");OUn={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"}};h6e=null;_Z=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=g6e(ud.parseFormat(r),e),this.units=this.tokens.map(n=>CUn(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=PUn(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=TUn(e,this.regex,this.handlers),[o,i,a]=n?AUn(n):[null,null,void 0];if(I1(n,"a")&&I1(n,"H"))throw new k_("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 vZ(t){return new sd("unsupported zone",`the zone "${t.name}" is not supported`)}function v6e(t){return t.weekData===null&&(t.weekData=cZ(t.c)),t.weekData}function w6e(t){return t.localWeekData===null&&(t.localWeekData=cZ(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function Vk(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Ar({...r,...e,old:r})}function Anr(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 Nye(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 Dye(t,e,r){return Anr(hH(t),e,r)}function Snr(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,vH(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=ws.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=hH(i),[u,l]=Anr(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function IH(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=Ar.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return Ar.invalid(new sd("unparsable",`the input "${o}" can't be parsed as ${n}`))}function jye(t,e,r=!0){return t.isValid?ud.create(pi.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function x6e(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=vs(t.c.year,r?6:4),e?(n+="-",n+=vs(t.c.month),n+="-",n+=vs(t.c.day)):(n+=vs(t.c.month),n+=vs(t.c.day)),n}function Cnr(t,e,r,n,o,i){let a=vs(t.c.hour);return e?(a+=":",a+=vs(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=vs(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=vs(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=vs(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=vs(Math.trunc(-t.o/60)),a+=":",a+=vs(Math.trunc(-t.o%60))):(a+="+",a+=vs(Math.trunc(t.o/60)),a+=":",a+=vs(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}function LUn(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 mH(t);return e}function Onr(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return LUn(t)}}function FUn(t){return Fye[t]||(Lye===void 0&&(Lye=fi.now()),Fye[t]=t.offset(Lye)),Fye[t]}function Enr(t,e){let r=z_(e.zone,fi.defaultZone);if(!r.isValid)return Ar.invalid(vZ(r));let n=pi.fromObject(e),o,i;if(yr(t.year))o=fi.now();else{for(let u of Mnr)yr(t[u])&&(t[u]=Inr[u]);let a=t6e(t)||r6e(t);if(a)return Ar.invalid(a);let s=FUn(r);[o,i]=Dye(t,s,r)}return new Ar({ts:o,zone:r,loc:n,o:i})}function Pnr(t,e,r){let n=yr(r.round)?!0:r.round,o=(a,s)=>(a=gH(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 Tnr(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]}function AH(t){if(Ar.isDateTime(t))return t;if(t&&t.valueOf&&U_(t.valueOf()))return Ar.fromJSDate(t);if(t&&typeof t=="object")return Ar.fromObject(t);throw new Us(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var _6e,xnr,Inr,RUn,NUn,Mnr,jUn,DUn,Lye,Fye,Ar,T1=b(()=>{bZ();p6e();P1();m6e();hZ();yH();uZ();Yp();Tye();hnr();f6e();wnr();n6e();iZ();x1();lZ();_6e="Invalid DateTime",xnr=864e13;Inr={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},RUn={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},NUn={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Mnr=["year","month","day","hour","minute","second","millisecond"],jUn=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],DUn=["year","ordinal","hour","minute","second","millisecond"];Fye={},Ar=class t{constructor(e){let r=e.zone||fi.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new sd("invalid input"):null)||(r.isValid?null:vZ(r));this.ts=yr(e.ts)?fi.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=U_(e.o)&&!e.old?e.o:r.offset(this.ts);o=Nye(this.ts,s),n=Number.isNaN(o.year)?new sd("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=e.loc||pi.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]=Tnr(arguments),[n,o,i,a,s,u,l]=r;return Enr({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=Tnr(arguments),[n,o,i,a,s,u,l]=r;return e.zone=ad.utcInstance,Enr({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=Urr(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let o=z_(r.zone,fi.defaultZone);return o.isValid?new t({ts:n,zone:o,loc:pi.fromObject(r)}):t.invalid(vZ(o))}static fromMillis(e,r={}){if(U_(e))return e<-xnr||e>xnr?t.invalid("Timestamp out of range"):new t({ts:e,zone:z_(r.zone,fi.defaultZone),loc:pi.fromObject(r)});throw new Us(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(U_(e))return new t({ts:e*1e3,zone:z_(r.zone,fi.defaultZone),loc:pi.fromObject(r)});throw new Us("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=z_(r.zone,fi.defaultZone);if(!n.isValid)return t.invalid(vZ(n));let o=pi.fromObject(r),i=wH(e,Onr),{minDaysInFirstWeek:a,startOfWeek:s}=e6e(i,o),u=fi.now(),l=yr(r.specificOffset)?n.offset(u):r.specificOffset,c=!yr(i.ordinal),d=!yr(i.year),f=!yr(i.month)||!yr(i.day),p=d||f,h=i.weekYear||i.weekNumber;if((p||c)&&h)throw new k_("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new k_("Can't mix ordinal dates with month/day");let m=h||i.weekday&&!p,g,y,_=Nye(u,l);m?(g=jUn,y=RUn,_=cZ(_,a,s)):c?(g=DUn,y=NUn,_=Mye(_)):(g=Mnr,y=Inr);let w=!1;for(let N of g){let M=i[N];yr(M)?w?i[N]=y[N]:i[N]=_[N]:w=!0}let S=m?$rr(i,a,s):c?Brr(i):t6e(i),C=S||r6e(i);if(C)return t.invalid(C);let E=m?XVe(i,a,s):c?QVe(i):i,[P,T]=Dye(E,l,n),I=new t({ts:P,zone:n,o:T,loc:o});return i.weekday&&p&&e.weekday!==I.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${I.toISO()}`):I.isValid?I:t.invalid(I.invalid)}static fromISO(e,r={}){let[n,o]=nnr(e);return IH(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=onr(e);return IH(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=inr(e);return IH(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(yr(e)||yr(r))throw new Us("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=pi.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=vnr(a,e,r);return c?t.invalid(c):IH(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]=unr(e);return IH(n,o,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Us("need to specify a reason the DateTime is invalid");let n=e instanceof sd?e:new sd(e,r);if(fi.throwOnInvalid)throw new gye(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=b6e(e,pi.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(e,r={}){return g6e(ud.parseFormat(e),pi.fromObject(r)).map(o=>o.val).join("")}static resetCache(){Lye=void 0,Fye={}}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?v6e(this).weekYear:NaN}get weekNumber(){return this.isValid?v6e(this).weekNumber:NaN}get weekday(){return this.isValid?v6e(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?w6e(this).weekday:NaN}get localWeekNumber(){return this.isValid?w6e(this).weekNumber:NaN}get localWeekYear(){return this.isValid?w6e(this).weekYear:NaN}get ordinal(){return this.isValid?Mye(this.c).ordinal:NaN}get monthShort(){return this.isValid?ZT.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?ZT.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?ZT.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?ZT.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=hH(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=Nye(u,a),d=Nye(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[Vk(this,{ts:u}),Vk(this,{ts:l})]:[this]}get isInLeapYear(){return qk(this.year)}get daysInMonth(){return vH(this.year,this.month)}get daysInYear(){return this.isValid?A1(this.year):NaN}get weeksInWeekYear(){return this.isValid?Uk(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Uk(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:o}=ud.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(e=0,r={}){return this.setZone(ad.instance(e),r)}toLocal(){return this.setZone(fi.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=z_(e,fi.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]=Dye(a,i,e)}return Vk(this,{ts:o,zone:e})}else return t.invalid(vZ(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return Vk(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=wH(e,Onr),{minDaysInFirstWeek:n,startOfWeek:o}=e6e(r,this.loc),i=!yr(r.weekYear)||!yr(r.weekNumber)||!yr(r.weekday),a=!yr(r.ordinal),s=!yr(r.year),u=!yr(r.month)||!yr(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new k_("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new k_("Can't mix ordinal dates with month/day");let d;i?d=XVe({...cZ(this.c,n,o),...r},n,o):yr(r.ordinal)?(d={...this.toObject(),...r},yr(r.day)&&(d.day=Math.min(vH(d.year,d.month),d.day))):d=QVe({...Mye(this.c),...r});let[f,p]=Dye(d,this.o,this.zone);return Vk(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=ws.fromDurationLike(e);return Vk(this,Snr(this,r))}minus(e){if(!this.isValid)return this;let r=ws.fromDurationLike(e).negate();return Vk(this,Snr(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=ws.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?ud.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):_6e}toLocaleString(e=S1,r={}){return this.isValid?ud.create(this.loc.clone(r),e).formatDateTime(this):_6e}toLocaleParts(e={}){return this.isValid?ud.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=x6e(this,a);return s+="T",s+=Cnr(this,a,r,n,o,i),s}toISODate({format:e="extended"}={}){return this.isValid?x6e(this,e==="extended"):null}toISOWeekDate(){return jye(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":"")+Cnr(this,a==="extended",r,e,n,i):null}toRFC2822(){return jye(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return jye(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?x6e(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")),jye(this,o,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():_6e}[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 ws.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=qrr(r).map(ws.normalizeUnit),a=e.valueOf()>this.valueOf(),s=a?this:e,u=a?e:this,l=mnr(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?JT.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),Pnr(r,this.plus(n),{...e,numeric:"always",units:o,unit:i})}toRelativeCalendar(e={}){return this.isValid?Pnr(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 Us("min requires all arguments be DateTimes");return o6e(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Us("max requires all arguments be DateTimes");return o6e(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=pi.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return y6e(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=pi.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new _Z(i,e)}static fromFormatParser(e,r,n={}){if(yr(e)||yr(r))throw new Us("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=pi.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!a.equals(r.locale))throw new Us(`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):IH(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return S1}static get DATE_MED(){return B7}static get DATE_MED_WITH_WEEKDAY(){return NVe}static get DATE_FULL(){return z7}static get DATE_HUGE(){return U7}static get TIME_SIMPLE(){return q7}static get TIME_WITH_SECONDS(){return H7}static get TIME_WITH_SHORT_OFFSET(){return V7}static get TIME_WITH_LONG_OFFSET(){return W7}static get TIME_24_SIMPLE(){return K7}static get TIME_24_WITH_SECONDS(){return G7}static get TIME_24_WITH_SHORT_OFFSET(){return J7}static get TIME_24_WITH_LONG_OFFSET(){return Z7}static get DATETIME_SHORT(){return Y7}static get DATETIME_SHORT_WITH_SECONDS(){return X7}static get DATETIME_MED(){return Q7}static get DATETIME_MED_WITH_SECONDS(){return eZ}static get DATETIME_MED_WITH_WEEKDAY(){return jVe}static get DATETIME_FULL(){return tZ}static get DATETIME_FULL_WITH_SECONDS(){return rZ}static get DATETIME_HUGE(){return nZ}static get DATETIME_HUGE_WITH_SECONDS(){return oZ}}});var Rnr=b(()=>{T1();bZ();p6e();m6e();Bk();yH();E1();JVe();vye();P1()});function S6e(t){let e=t.match(/^(?:UTC|GMT)?([-+]?\d{1,2})(?::(\d{2}))?$/i);if(!e)throw new Error(`Invalid timezone offset format: ${t}. Use formats like '+8', '-5', '+5:30', 'UTC+8', 'GMT-5'`);let r=parseInt(e[1]),n=parseInt(e[2]||"0");if(Math.abs(r)>14||n>=60)throw new Error(`Invalid timezone offset: ${t}. Hours must be between -14 and +14, minutes must be less than 60`);let o=r>=0?"+":"",i=n>0?`:${n.toString().padStart(2,"0")}`:"";return`UTC${o}${r}${i}`}async function kUn(t){let e=Ar.now();if(t)try{let i=S6e(t),a=e.setZone(i);if(!a.isValid)throw new Error(`Failed to apply timezone offset: ${t}`);e=a}catch(i){throw new Error(`${i.message}`)}let r=e.toJSDate(),n=e.offset,o=e.offsetNameShort||"Unknown";return{epoch:Math.floor(r.getTime()),isoString:r.toISOString(),userLocaleString:e.toLocaleString(Ar.DATETIME_FULL),localDateString:e.toISODate()||"",timezoneOffset:n,timezone:o}}function $Un(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 BUn(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 zUn(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=RVe(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=Ar.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 UUn(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=jnr[r[1]],o=e.year;n>e.month&&o--;let i=Ar.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 qUn(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=Ar.fromObject({year:n,month:1,day:1}),i=Ar.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 HUn(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=Ar.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 VUn(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=jnr[r[1].toLowerCase()],o=parseInt(r[2]),i=Ar.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 WUn(t){let e=Ar.now(),r=t.toLowerCase().replace("@vault","").trim(),n=$Un(r,e)||BUn(r,e)||zUn(r,e)||UUn(r,e)||VUn(r,e)||HUn(r,e)||qUn(r,e);if(n)return{startTime:wZ(n.start),endTime:wZ(n.end)};let o=RVe(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=Ar.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?Ar.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:wZ(i),endTime:wZ(a)}}console.warn(`Unable to parse time expression: ${t}`)}function wZ(t){let e=t.toJSDate(),r=t.offset,n=t.offsetNameShort||"Unknown";return{epoch:Math.floor(e.getTime()),isoString:e.toISOString(),userLocaleString:t.toLocaleString(Ar.DATETIME_FULL),localDateString:t.toISODate()||"",timezoneOffset:r,timezone:n}}function KUn(t){let e=t.toString().length===10?t*1e3:t,r=Ar.fromMillis(e);return wZ(r)}function GUn(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 JUn(t="25min"){let e=GUn(t);return new Promise(r=>{setTimeout(()=>{new Nnr.Notice(`Pomodoro timer (${t}) completed! Take a break!`),r()},e)})}async function ZUn(t,e,r){let n=S6e(e),o=S6e(r);try{let i=Ar.now().setZone(n),a=brr(t,i.toJSDate());if(!a)throw new Error(`Could not parse time: ${t}`);let s=Ar.fromJSDate(a,{zone:n}),u=s.setZone(o);if(!u.isValid)throw new Error("Invalid timezone conversion");let l=u.toJSDate(),c=u.offset;return{epoch:Math.floor(l.getTime()),isoString:l.toISOString(),userLocaleString:u.toLocaleString(Ar.DATETIME_FULL),localDateString:u.toISODate()||"",timezoneOffset:c,timezone:u.offsetNameShort||o,originalTime:s.toLocaleString(Ar.TIME_SIMPLE)+" "+s.offsetNameShort,convertedTime:u.toLocaleString(Ar.TIME_SIMPLE)+" "+u.offsetNameShort}}catch(i){throw new Error(`Failed to convert time: ${i.message}`)}}var Nnr,kye,jnr,$ye,Bye,xZ,zye,C6e=b(()=>{_rr();Rnr();Nnr=require("obsidian");vd();Lk();kye=Hl({name:"getCurrentTime",description:"Get the current time in local timezone or at a specified UTC offset. Returns epoch time, ISO string, and formatted strings.",schema:ht.object({timezoneOffset:ht.string().optional().describe(`Optional UTC offset. IMPORTANT: Must be a numeric offset, NOT a timezone name.
EXAMPLES OF CORRECT USAGE:
- "what time is it" \u2192 No parameter (uses local time)
- "what time is it in Tokyo" \u2192 timezoneOffset: "+9"
- "what time is it in Beijing" \u2192 timezoneOffset: "+8"
- "what time is it in New York" \u2192 timezoneOffset: "-5" (or "-4" during DST)
- "what time is it in Mumbai" \u2192 timezoneOffset: "+5:30"
SUPPORTED FORMATS:
- Simple: "+8", "-5", "+5:30"
- With prefix: "UTC+8", "GMT-5", "UTC+5:30"
COMMON TIMEZONE OFFSETS:
- Tokyo: UTC+9
- Beijing/Singapore: UTC+8
- Mumbai: UTC+5:30
- Dubai: UTC+4
- London: UTC+0 (UTC+1 during BST)
- New York: UTC-5 (UTC-4 during DST)
- Los Angeles: UTC-8 (UTC-7 during DST)`)}),handler:async({timezoneOffset:t})=>kUn(t),isBackground:!0}),jnr={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};$ye=Hl({name:"getTimeRangeMs",description:"Convert natural language time expressions to date ranges for use with localSearch",schema:ht.object({timeExpression:ht.string().describe(`Natural language time expression to convert to a date range.
COMMON EXPRESSIONS:
- Relative past: "yesterday", "last week", "last month", "last year"
- Relative ranges: "this week", "this month", "this year"
- Specific dates: "July 1", "July 1 2023", "2023-07-01"
- Date ranges: "from July 1 to July 15", "between May and June"
- Time periods: "last 7 days", "past 30 days", "previous 3 months"
IMPORTANT: This tool is typically used as the first step before localSearch when searching notes by time.
EXAMPLE WORKFLOW:
1. User: "what did I do last week"
2. First call getTimeRangeMs with timeExpression: "last week"
3. Then use the returned time range with localSearch`)}),handler:async({timeExpression:t})=>WUn(t),isBackground:!0});Bye=Hl({name:"getTimeInfoByEpoch",description:"Convert a Unix timestamp (in seconds or milliseconds) to detailed time information",schema:ht.object({epoch:ht.number().describe("Unix timestamp in seconds or milliseconds")}),handler:async({epoch:t})=>KUn(t),isBackground:!0});xZ=Hl({name:"startPomodoro",description:"Start a Pomodoro timer with a customizable interval",schema:ht.object({interval:ht.string().default("25min").describe("Time interval (e.g., '25min', '5s', '1h'). Default is 25min.")}),handler:async({interval:t})=>(JUn(t),`Pomodoro timer started. It will end in ${t}.`)});zye=Hl({name:"convertTimeBetweenTimezones",description:"Convert a specific time from one timezone to another using UTC offsets",schema:ht.object({time:ht.string().describe(`Time to convert. Supports various formats:
- 12-hour: "6pm", "3:30 PM", "11:45 am"
- 24-hour: "18:00", "15:30", "23:45"
- Relative: "noon", "midnight"`),fromOffset:ht.string().describe(`Source UTC offset. Must be numeric, not timezone name.
Examples: "-8" for PT, "+0" for London, "+8" for Beijing`),toOffset:ht.string().describe(`Target UTC offset. Must be numeric, not timezone name.
Examples: "+9" for Tokyo, "-5" for NY, "+5:30" for Mumbai
EXAMPLE USAGE:
- "what time is 6pm PT in Tokyo" \u2192 time: "6pm", fromOffset: "-8", toOffset: "+9"
- "convert 3:30 PM EST to London time" \u2192 time: "3:30 PM", fromOffset: "-5", toOffset: "+0"
- "what is 9am Beijing time in New York" \u2192 time: "9am", fromOffset: "+8", toOffset: "-5"`)}),handler:async({time:t,fromOffset:e,toOffset:r})=>ZUn(t,e,r),isBackground:!0})});var Dnr,Lnr,Uye,O6e=b(()=>{Ey();fr();vd();Lk();Dnr=5e4,Lnr=Hl({name:"youtubeTranscription",description:"Get transcripts of YouTube videos when the user provides YouTube URLs",schema:ht.object({}),isPlusOnly:!0,requiresUserMessageContent:!0,handler:async t=>{let{_userMessageContent:e}=t;if(typeof e!="string")return JSON.stringify({success:!1,message:"Invalid input: User message must be a string"});if(e.length>Dnr)return JSON.stringify({success:!1,message:`Input too long: Maximum allowed length is ${Dnr} characters`});let r=yee(e);if(r.length===0)return JSON.stringify({success:!1,message:"No YouTube URLs found in the user prompt. URLs must be in the user prompt instead of the context notes."});let n=await Promise.all(r.map(async i=>{try{let a=await Gi.getInstance().youtube4llm(i);return a.response.transcript?{url:i,success:!0,transcript:a.response.transcript,elapsed_time_ms:a.elapsed_time_ms}:{url:i,success:!1,message:"Transcript not available. Only English videos with auto transcript enabled are supported"}}catch(a){return console.error(`Error transcribing YouTube video ${i}:`,a),{url:i,success:!1,message:"An error occurred while transcribing the YouTube video"}}})),o=n.some(i=>i.success);return JSON.stringify({success:o,results:n,total_urls:r.length})}}),Uye=Hl({name:"simpleYoutubeTranscription",description:"Get the transcript of a YouTube video",schema:ht.object({url:ht.string().url().describe("The YouTube video URL")}),isPlusOnly:!0,handler:async({url:t})=>{try{let e=await Gi.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."})}}})});var SZ,Wk,qye=b(()=>{lR();sa();lVe();dVe();C6e();O6e();r7();fr();Ey();SZ=["@vault","@composer","@websearch","@youtube","@pomodoro"],Wk=class{static initTools(e){this.tools.length===0&&(this.tools=[kye,zye,Bye,$ye,u7,qer,xZ,l7,Uye,sye(e.getRoot())])}static async analyzeIntent(e){try{let r=await Gi.getInstance().broca(e,Rj());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||{};if(u.name==="getTimeRangeMs"&&(a=await NO.callTool(u,l)),u.name=="getFileTree"&&Rj())continue;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")){let u=this.removeAtCommands(e);r.push({tool:u7,args:{timeRange:i||void 0,query:u,salientTerms:a}})}if(o.includes("@websearch")||o.includes("@web")){let u=this.removeAtCommands(e),c=await Hd.instance.getCurrentChainManager().memoryManager.getMemory().loadMemoryVariables({}),d=YB(c);r.push({tool:l7,args:{query:u,chatHistory:d}})}if(o.includes("@pomodoro")){let u=e.match(/@pomodoro\s+(\S+)/i),l=u?u[1]:"25min";r.push({tool:xZ,args:{interval:l}})}let s=yee(e);for(let u of s)r.some(c=>c.tool.name===Uye.name&&c.args.url===u)||r.push({tool:Uye,args:{url:u}})}static removeAtCommands(e){return e.split(" ").filter(r=>!SZ.includes(r.toLowerCase())).join(" ").trim()}};Wk.tools=[]});var MH,E6e=b(()=>{MH=class{static tryParseJson(e){try{let r=JSON.parse(e);return Array.isArray(r)?r:[r]}catch{return[]}}static format(e,r){try{let n=r;if(typeof n=="string"&&n.startsWith("ENC:"))try{n=decodeURIComponent(n.slice(4))}catch{}let o;try{o=JSON.parse(n)}catch{o=n}switch(e){case"localSearch":return this.formatLocalSearch(o);case"webSearch":return this.formatWebSearch(o);case"simpleYoutubeTranscriptionTool":case"youtubeTranscription":return this.formatYoutubeTranscription(o);case"writeToFile":return this.formatWriteToFile(o);case"replaceInFile":return this.formatReplaceInFile(o);default:return r}}catch{return r}}static formatLocalSearch(e){if(typeof e=="string"){let s=e.match(/<localSearch[^>]*>([\s\S]*)<\/localSearch>/);if(s){let u=s[1].trim(),l=u.match(/<document>/g),c=l?l.length:0;if(c===0)return`\u{1F4DA} Found 0 relevant notes
No matching notes found.`;let d=[],f=/<document>\s*<title>([^<]*)<\/title>(?:\s*<path>([^<]*)<\/path>)?(?:\s*<modified>([^<]*)<\/modified>)?[\s\S]*?<\/document>/g,p;for(;(p=f.exec(u))!==null;)d.push({title:p[1]||"Untitled",path:p[2]||"",mtime:p[3]||null});let m=d.slice(0,10).map((y,_)=>{let w=[`${_+1}. ${y.title}`];return y.mtime&&w.push(` \u{1F552} Modified: ${y.mtime}`),y.path&&y.path!==y.title&&w.push(` \u{1F4C1} ${y.path}`),w.join(`
`)}).join(`
`),g=c>10?`
... and ${c-10} more results`:"";return`\u{1F4DA} Found ${c} relevant notes
Top results:
${m}${g}`}}let r=this.parseSearchResults(e);if(!Array.isArray(r))return typeof e=="string"?e:JSON.stringify(e,null,2);let n=r.length;if(n===0)return`\u{1F4DA} Found 0 relevant notes
No matching notes found.`;let i=r.slice(0,10).map((s,u)=>this.formatSearchItem(s,u)).join(`
`),a=n>10?`
... and ${n-10} more results`:"";return`\u{1F4DA} Found ${n} relevant notes
Top results:
${i}${a}`}static parseSearchResults(e){if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null)return[e];if(typeof e=="string"){let r=e.trim();return!r.startsWith("[")&&!r.startsWith("{")?[]:this.tryParseJson(e)}return[]}static formatSearchItem(e,r){let n=e.path?.split("/").pop()?.replace(/\.md$/,"")||e.title||"Untitled",o=e.rerank_score||e.score||0,i=typeof o=="number"?o.toFixed(4):o,a=e.source==="time-filtered"?"Recency":"Relevance",s=[`${r+1}. ${n}`];if(e.source==="time-filtered"){if(e.mtime)try{let l=new Date(e.mtime),c=isNaN(l.getTime())?String(e.mtime):l.toISOString();s.push(` \u{1F552} Modified: ${c}${e.includeInContext?" \u2713":""}`)}catch{s.push(` \u{1F552} Modified: ${String(e.mtime)}${e.includeInContext?" \u2713":""}`)}}else e.source==="title-match"?s.push(` \u{1F516} Title match${e.includeInContext?" \u2713":""}`):s.push(` \u{1F4CA} ${a}: ${i}${e.includeInContext?" \u2713":""}`);let u=this.extractContentSnippet(e.content);return u&&s.push(` \u{1F4AC} "${u}${e.content?.length>150?"...":""}"`),e.path&&!e.path.endsWith(`/${n}.md`)&&s.push(` \u{1F4C1} ${e.path}`),s.join(`
`)}static extractContentSnippet(e,r=150){return e?(e.match(/NOTE BLOCK CONTENT:\s*([\s\S]*)/)?.[1]||e).substring(0,r).replace(/\s+/g," ").trim():""}static formatWebSearch(e){if(Array.isArray(e)&&e.length>0&&e[0].type==="web_search"){let r=["\u{1F310} Web Search Results"],n=e[0];return n.content&&(r.push(""),r.push(n.content)),n.citations&&n.citations.length>0&&(r.push(""),r.push("Sources:"),n.citations.forEach((o,i)=>{r.push(`[${i+1}] ${o}`)})),n.instruction&&(r.push(""),r.push(`Note: ${n.instruction}`)),r.join(`
`)}if(typeof e=="string"){let r=e.split(`
`),n=["\u{1F310} Web Search Results"],o=!1,i=[],a=[];for(let s of r){if(s.includes("Sources:")){o=!0;continue}o?a.push(s):s.includes("Here are the web search results")||i.push(s)}return i.length>0&&(n.push(""),n.push(...i.filter(s=>s.trim()))),a.length>0&&(n.push(""),n.push("Sources:"),a.forEach(s=>{s.trim()&&n.push(s)})),n.join(`
`)}return e}static formatYoutubeTranscription(e){let r;if(typeof e=="string")try{r=JSON.parse(e)}catch{return e}else if(typeof e=="object")r=e;else return String(e);if(r.success===!1)return`\u{1F4FA} YouTube Transcription Failed
${r.message}`;if(r.results&&Array.isArray(r.results)){let n=[`\u{1F4FA} YouTube Transcripts (${r.total_urls} video${r.total_urls>1?"s":""})`];n.push("");for(let o of r.results){if(o.success){n.push(`\u{1F4F9} Video: ${o.url}`),n.push("");let i=o.transcript.split(`
`),a=0;for(let s of i)if(s.trim()&&(s.match(/^\[(\d+:\d+)\]/)?(a>0&&n.push(""),n.push(`\u23F0 ${s}`)):n.push(` ${s.trim()}`),a++,a>30)){n.push(""),n.push("... (transcript truncated for display)");break}o.elapsed_time_ms&&(n.push(""),n.push(`Processing time: ${(o.elapsed_time_ms/1e3).toFixed(1)}s`))}else n.push(`\u274C Failed to transcribe: ${o.url}`),n.push(` ${o.message}`);n.push(""),n.push("---"),n.push("")}return n.join(`
`).trimEnd()}if(r.transcript){let n=["\u{1F4FA} YouTube Transcript"];n.push("");let o=r.transcript.split(`
`),i=0;for(let a of o)if(a.trim()&&(a.match(/^\[(\d+:\d+)\]/)?(i>0&&n.push(""),n.push(`\u23F0 ${a}`)):n.push(` ${a.trim()}`),i++,i>50)){n.push(""),n.push("... (transcript truncated for display)");break}return r.elapsed_time_ms&&(n.push(""),n.push(`Processing time: ${(r.elapsed_time_ms/1e3).toFixed(1)}s`)),n.join(`
`)}return typeof e=="object"?JSON.stringify(e,null,2):String(e)}static formatWriteToFile(e){let r=typeof e=="object"?e.result:e,n=String(r).toLowerCase();return n.includes("accepted")?"\u2705 File change: accepted":n.includes("rejected")?"\u274C File change: rejected":typeof e=="object"&&e.message?e.message:String(r)}static formatReplaceInFile(e){let r=0,n="";if(typeof e=="object")r=e.blocksApplied||0,n=e.result||"";else if(typeof e=="string"){let i=e.match(/Applied (\d+) SEARCH\/REPLACE block/);i&&(r=parseInt(i[1])),n=e}let o=String(n).toLowerCase();if(o.includes("accepted")){let i=r===1?"replacement":"replacements";return r>0?`\u2705 ${r} ${i} accepted`:"\u2705 File replacements: accepted"}else if(o.includes("rejected"))return r===0?"\u274C No replacements made":"\u274C File replacements: rejected";return typeof e=="object"&&e.message?e.message:String(n)}}});var Hye,Fnr=b(()=>{E6e();Hye=class{constructor(e,r){this.toolManager=e;this.writeToFileTool=r;this.buffer=""}findCompleteBlock(e){let r=/<writeToFile>[\s\S]*?<\/writeToFile>/,n=e.match(r);return!n||n.index===void 0?null:{block:n[0],endIdx:n.index+n[0].length}}async*processChunk(e){let r="";if(Array.isArray(e.content))for(let o of e.content)o.type==="text"&&o.text!=null&&(r+=o.text);else e.content!=null&&(r=e.content);r&&(this.buffer+=r),yield e;let n=this.findCompleteBlock(this.buffer);for(;n;){let{block:o,endIdx:i}=n,a=o.match(/<path>([\s\S]*?)<\/path>/),s=o.match(/<content>([\s\S]*?)<\/content>/),u=a?a[1].trim():void 0,l=s?s[1].trim():void 0;try{let c=await this.toolManager.callTool(this.writeToFileTool,{path:u,content:l}),d=MH.format("writeToFile",c);yield{...e,content:`
${d}
`}}catch(c){yield{...e,content:`
Error: ${c?.message||c}
`}}this.buffer=this.buffer.substring(i),n=this.findCompleteBlock(this.buffer)}}}});function P6e(t){let e=[];for(let r of t)if(r){if(typeof r._getType=="function"){let n=r._getType();n==="human"?e.push({role:"user",content:r.content}):n==="ai"&&e.push({role:"assistant",content:r.content})}else if(r.content!==void 0){let n=YUn(r);n&&e.push({role:n,content:r.content})}}return e}function YUn(t){return t.role==="human"||t.role==="user"||t.sender==="user"?"user":t.role==="ai"||t.role==="assistant"||t.sender==="AI"?"assistant":null}function Vye(t,e){let r=P6e(t);for(let n of r)e.push({role:n.role,content:n.content})}function knr(t){return t.map(e=>{let r;return typeof e.content=="string"?r=e.content:Array.isArray(e.content)?r=e.content.filter(o=>o.type==="text").map(o=>o.text||"").join(" ")||"[Image content]":r=String(e.content||""),{role:e.role,content:r}})}var T6e=b(()=>{});function A6e(t){if(!Array.isArray(t))return"";let e=t.filter(n=>n.includeInContext!==!1);return e.length===0?"No relevant documents found.":e.map(n=>{let o=n.title||"Untitled",i=n.path||"",a=null;if(n.mtime){let s=new Date(n.mtime);isNaN(s.getTime())||(a=s.toISOString())}return`<document>
<title>${o}</title>${i&&i!==o?`
<path>${i}</path>`:""}${a?`
<modified>${a}</modified>`:""}
<content>
${n.content||""}
</content>
</document>`}).filter(n=>n.length>0).join(`
`)}function $nr(t){try{let e=JSON.parse(t);return Array.isArray(e)?A6e(e):"Invalid search results format."}catch(e){return $t("Failed to format localSearch result string:",e),"Error processing search results."}}function Bnr(t){return Array.isArray(t)?t.map(e=>({title:e.title||e.path||"Untitled",path:e.path||e.title||"",score:e.rerank_score||e.score||0,explanation:e.explanation||null})):[]}var znr=b(()=>{Kt()});async function I6e(t,e,r){try{if(!t||!t.name)return{toolName:t?.name||"unknown",result:"Error: Invalid tool call - missing tool name",success:!1};let o=e.find(u=>u.name===t.name);if(!o){let u=e.map(l=>l.name).join(", ");return{toolName:t.name,result:`Error: Tool '${t.name}' not found. Available tools: ${u}. Make sure you have the tool enabled in the Agent settings.`,success:!1}}if(o.isPlusOnly&&!await sO())return{toolName:t.name,result:`Error: ${Kk(t.name)} requires a Copilot Plus subscription`,success:!1};let i={...t.args};o.requiresUserMessageContent&&r&&(i._userMessageContent=r);let a=6e4;typeof o.timeoutMs=="number"&&(a=o.timeoutMs);let s;return!a||a===1/0?s=await NO.callTool(o,i):s=await Promise.race([NO.callTool(o,i),new Promise((u,l)=>setTimeout(()=>l(new Error(`Tool execution timed out after ${a}ms`)),a))]),s==null?($t(`Tool ${t.name} returned null/undefined result`),{toolName:t.name,result:JSON.stringify({message:"Tool executed but returned no result",status:"empty"}),success:!0}):{toolName:t.name,result:typeof s=="string"?s:JSON.stringify(s),success:!0}}catch(o){return ie(`Error executing tool ${t.name}:`,o),{toolName:t.name,result:`Error: ${Xn(o)}`,success:!1}}}function Kk(t){return t==="localSearch"?oe().enableSemanticSearchV3?"vault search (semantic)":"vault search (index-free)":{webSearch:"web search",getFileTree:"file tree",getCurrentTime:"current time",getTimeRangeMs:"time range",getTimeInfoByEpoch:"time info",convertTimeBetweenTimezones:"timezone converter",startPomodoro:"pomodoro timer",pomodoroTool:"pomodoro timer",simpleYoutubeTranscriptionTool:"YouTube transcription",youtubeTranscription:"YouTube transcription",indexVault:"vault indexing",indexTool:"index",writeToFile:"file editor",replaceInFile:"file editor"}[t]||t}function RH(t){return{localSearch:"\u{1F50D}",webSearch:"\u{1F310}",getFileTree:"\u{1F4C1}",getCurrentTime:"\u{1F552}",getTimeRangeMs:"\u{1F4C5}",getTimeInfoByEpoch:"\u{1F570}\uFE0F",convertTimeBetweenTimezones:"\u{1F30D}",startPomodoro:"\u23F1\uFE0F",pomodoroTool:"\u23F1\uFE0F",simpleYoutubeTranscriptionTool:"\u{1F4FA}",youtubeTranscription:"\u{1F4FA}",indexVault:"\u{1F4DA}",indexTool:"\u{1F4DA}",writeToFile:"\u270F\uFE0F",replaceInFile:"\u{1F504}"}[t]||"\u{1F527}"}function Unr(t,e){if(t=="writeToFile"||t=="replaceInFile")return"Accept / reject in the Preview";if(t==="localSearch"&&e?.salientTerms&&!oe().enableSemanticSearchV3){let n=Array.isArray(e.salientTerms)?e.salientTerms:[];if(n.length>0)return`Terms: ${n.slice(0,3).join(", ")}${n.length>3?"...":""}`}return null}function M6e(t,e){let r=Kk(t.name),n=RH(t.name),o=Object.keys(t.args).length>0?JSON.stringify(t.args,null,2):"(no parameters)";B(`${n} [Iteration ${e}] ${r.toUpperCase()}`),B("Parameters:",o),B("---")}function R6e(t,e){let r=Kk(t),n=RH(t),o=e.success?"\u2705 SUCCESS":"\u274C FAILED";B(`${n} ${r.toUpperCase()} RESULT: ${o}`);let i=300;e.result.length>i?B(`Result: ${e.result.substring(0,i)}... (truncated, ${e.result.length} chars total)`):B("Result:",e.result),B("---")}function CZ(t){let e=new Map;for(let r of t){let n=r.path||r.title,o=e.get(n);(!o||r.score>o.score)&&e.set(n,r)}return Array.from(e.values()).sort((r,n)=>n.score-r.score)}var Wye=b(()=>{Kt();oy();bt();r7();fr()});var jO,Kye=b(()=>{XHe();nr();pze();Ey();Kt();bt();r7();sVe();fr();qye();iG();Fnr();p4();T6e();oy();znr();Wye();jO=class extends BP{isYoutubeOnlyMessage(e){let r=e.trim(),n=r.includes("@youtube"),o=YSe(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 cF.processUrlBatch(e,r,this.chainManager.app.vault);return cF.showFailedImagesNotice(r),n}async processChatInputImages(e){let r=[],n=await cF.processChatImageBatch(e,r,this.chainManager.app.vault);return cF.showFailedImagesNotice(r),n}async extractEmbeddedImages(e,r){let n=/!\[\[(.*?\.(png|jpg|jpeg|gif|webp|bmp|svg))\]\]/g,o=/!\[.*?\]\(([^)]+)\)/g,i=[],a=[...e.matchAll(n)];for(let u of a){let l=u[1];if(r){let c=app.metadataCache.getFirstLinkpathDest(l,r);c?i.push(c.path):($t(`Could not resolve embedded image: ${l} from source: ${r}`),i.push(l))}else i.push(l)}let s=[...e.matchAll(o)];for(let u of s){let l=u[1].trim();if(!l)continue;if(l.match(/^https?:\/\//)){i.push(l);continue}let c=l.replace(/^\.\//,"").replace(/^\//,"");if(r){let d=app.metadataCache.getFirstLinkpathDest(c,r);d?i.push(d.path):i.push(c)}else i.push(c)}return i}async buildMessageContent(e,r){let n=[],o=[],i=oe(),a=[],s=r.context?.urls;if(s&&s.length>0&&a.push({urls:s,type:"context"}),i.passMarkdownImages){let d;if(r.context?.notes&&r.context.notes.length>0)d=r.context.notes[0].path;else{let p=this.chainManager.app?.workspace.getActiveFile();p&&(d=p.path)}let f=await this.extractEmbeddedImages(e,d);f.length>0&&a.push({urls:f,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")}appendComposerInstructionsIfNeeded(e,r){if(!r.message||!r.message.includes("@composer"))return e;let n=`<OUTPUT_FORMAT>
${$et}
</OUTPUT_FORMAT>`;return`${e}
${n}`}async streamMultimodalResponse(e,r,n,o){let s=(await this.chainManager.memoryManager.getMemory().loadMemoryVariables({})).history||[],u=[],l=await this.getSystemPrompt();s.length>0&&(l+=`
The following is the relevant conversation history. Use this context to maintain consistency in your responses:`);let c=this.chainManager.chatModelManager.getChatModel();l&&u.push({role:JA(c),content:`${l}
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.`}),Vye(s,u);let d=this.chainManager.chatModelManager.getChatModel(),p=this.isMultimodalModel(d)?await this.buildMessageContent(e,r):e;u.push({role:"user",content:p});let h=p instanceof Array?p[0].text:p;B("Enhanced user message: ",h),B(`==== Final Request to AI ====
`,u);let m=new Hye(NO,aye),g=new g_(o),y=await Sd(()=>this.chainManager.chatModelManager.getChatModel().stream(u,{signal:n.signal}));for await(let _ of y){if(n.signal.aborted){B("CopilotPlus multimodal stream iteration aborted",{reason:n.signal.reason});break}for await(let w of m.processChunk(_))g.processChunk(w)}return g.close()}async run(e,r,n,o,i){let{updateLoadingMessage:a}=i,s="",u=[],l="";if(!await sO({isCopilotPlus:!0}))return await this.handleError(new Error("Invalid license key"),o,n),"";let d=f=>{l=f,n(f)};try{if(this.isYoutubeOnlyMessage(e.message)){let M=YSe(e.message),D="Transcript not available. Only videos with the auto transcript option turned on are supported at the moment.";if(M)try{let k=await Gi.getInstance().youtube4llm(M);return k.response.transcript?this.handleResponse(k.response.transcript,e,r,o,n):this.handleResponse(D,e,r,o,n)}catch(k){return ie("Error processing YouTube video:",k),this.handleResponse(D,e,r,o,n)}}B("==== Step 1: Analyzing intent ====");let f,p=e.originalMessage||e.message;try{f=await Wk.analyzeIntent(p)}catch(M){return this.handleResponse(Pet(M),e,r,o,n)}let h=e.message.split(" ").filter(M=>!SZ.includes(M.toLowerCase())).join(" ").trim(),{toolOutputs:m,sources:g}=await this.executeToolCalls(f,a);u=g;let _=m.find(M=>M.tool==="localSearch"&&M.output!=null)&&u.length>0,C=(await this.chainManager.memoryManager.getMemory().loadMemoryVariables({})).history||[],E=P6e(C),P=knr(E),T=h;P.length>0&&(B("==== Condensing Question ===="),T=await eye(h,P),B("Condensed standalone question: ",T));let I=this.prepareEnhancedUserMessage(T,m,f),N=m.some(M=>M.tool!=="localSearch"&&M.output!=null);_&&!N&&(I=`Answer the question with as detailed as possible based only on the following context:
${I}`),I=this.appendComposerInstructionsIfNeeded(I,e),B("==== Invoking LLM with all tool results ===="),s=await this.streamMultimodalResponse(I,e,r,d)}catch(f){a?.(Tv.DEFAULT),f.name==="AbortError"||r.signal.aborted?B("CopilotPlus stream aborted by user",{reason:r.signal.reason}):await this.handleError(f,o,n)}return r.signal.aborted&&r.signal.reason==="new-chat"?(n(""),""):(r.signal.aborted&&l&&(s=l),this.handleResponse(s,e,r,o,n,u))}getSources(e){return!e||!Array.isArray(e)?($t("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){$t("Invalid document structure:",n);continue}let o=n.path||n.title,i=r.get(o),a=n&&"rerank_score"in n,s=a?n.rerank_score:n.score;(!i||s>(i.score??0))&&r.set(o,{title:n.title,path:n.path||n.title,score:s,isReranked:a,explanation:n.explanation||null})}return Array.from(r.values()).sort((n,o)=>(o.score??0)-(n.score??0))}async executeToolCalls(e,r){let n=[],o=[];for(let i of e){B(`==== Step 2: Calling tool: ${i.tool.name} ====`),i.tool.name==="localSearch"?r?.(Tv.READING_FILES):i.tool.name==="webSearch"?r?.(Tv.SEARCHING_WEB):i.tool.name==="getFileTree"&&r?.(Tv.READING_FILE_TREE);let a=await NO.callTool(i.tool,i.args);if(i.tool.name==="localSearch"){let u={result:typeof a=="string"?a:JSON.stringify(a),success:a!=null},l=this.getTimeExpression(e),c=this.processLocalSearchResult(u,l);o.push(...c.sources),n.push({tool:i.tool.name,output:c.formattedForLLM})}else n.push({tool:i.tool.name,output:a})}return{toolOutputs:n,sources:CZ(o)}}prepareEnhancedUserMessage(e,r,n){let o="",i=!1,a=r.find(s=>s.tool==="localSearch"&&s.output!=null);if(a&&typeof a.output=="string")try{let s=JSON.parse(a.output);Array.isArray(s)&&s.length>0&&(i=!0)}catch{}if(r.length>0){let s=r.filter(u=>u.output!=null);s.length>0&&(o=(i&&s.length===1?"":`
# Additional context:
`)+s.map(l=>{let c=l.output;return typeof c!="string"&&(c=JSON.stringify(c)),l.tool==="localSearch"?c:`<${l.tool}>
${c}
</${l.tool}>`}).join(`
`))}return i&&r.filter(s=>s.output!=null).length===1?`${o}
Question: ${e}`:`${e}${o}`}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),0),i=n;if(o>nCe){let s=nCe/o;B("Truncating document contents to fit context length. Truncation ratio:",s),i=n.map(u=>({...u,content:u.content?.slice(0,Math.floor((u.content?.length||0)*s))||""}))}let a=A6e(i);return r?`<localSearch timeRange="${r}">
${a}
</localSearch>`:`<localSearch>
${a}
</localSearch>`}processLocalSearchResult(e,r){let n=[],o;if(!e.success)return o=`<localSearch>
Search failed.
</localSearch>`,{formattedForLLM:o,sources:n};try{let i=JSON.parse(e.result);if(!Array.isArray(i))return o=`<localSearch>
Invalid search results format.
</localSearch>`,{formattedForLLM:o,sources:n};n=Bnr(i),o=this.prepareLocalSearchResult(i,r||"")}catch(i){$t("Failed to parse localSearch results:",i);let a=$nr(e.result);o=r?`<localSearch timeRange="${r}">
${a}
</localSearch>`:`<localSearch>
${a}
</localSearch>`}return{formattedForLLM:o,sources:n}}async getSystemPrompt(){return If()}}});var OZ,Hnr=b(()=>{sa();bt();lR();Kye();OZ=class extends jO{async getSystemPrompt(){let e=If(),r=bu();if(!r)return e;let n=await Hd.instance.getProjectContext(r.id);return e=`${e}
<project_system_prompt>
${r.systemPrompt}
</project_system_prompt>`,n&&(e=`${e}
<project_context>
${n}
</project_context>`),e}}});var DO,Gye=b(()=>{DO=class t{constructor(){this.tools=new Map}static getInstance(){return t.instance||(t.instance=new t),t.instance}register(e){this.tools.set(e.metadata.id,e)}registerAll(e){e.forEach(r=>this.register(r))}getAllTools(){return Array.from(this.tools.values())}getEnabledTools(e,r){let n=[];for(let[o,i]of this.tools){let{metadata:a,tool:s}=i;if(a.isAlwaysEnabled){(!a.requiresVault||r)&&n.push(s);continue}e.has(o)&&(!a.requiresVault||r)&&n.push(s)}return n}getToolsByCategory(){let e=new Map;for(let r of this.tools.values()){let n=r.metadata.category;e.has(n)||e.set(n,[]),e.get(n).push(r)}return e}getConfigurableTools(){return Array.from(this.tools.values()).filter(e=>!e.metadata.isAlwaysEnabled)}getToolMetadata(e){return this.tools.get(e)?.metadata}clear(){this.tools.clear()}}});function QUn(t){DO.getInstance().register({tool:sye(t.getRoot()),metadata:{id:"getFileTree",displayName:"File Tree",description:"Browse vault file structure",category:"file",isAlwaysEnabled:!0,requiresVault:!0,customPromptInstructions:`For getFileTree:
- Use to browse the vault's file structure
- No parameters needed
Example usage:
<use_tool>
<name>getFileTree</name>
</use_tool>`}})}function Jye(t){let e=DO.getInstance(),r=e.getToolMetadata("getFileTree")!==void 0,n=t!==void 0;(e.getAllTools().length===0||r!==n)&&(e.clear(),e.registerAll(XUn),t&&QUn(t))}var XUn,N6e=b(()=>{Gye();dVe();C6e();O6e();sVe();lVe();XUn=[{tool:u7,metadata:{id:"localSearch",displayName:"Vault Search",description:"Search through your vault notes",category:"search",customPromptInstructions:`For localSearch (searching notes in the vault):
- You MUST always provide both "query" (string) and "salientTerms" (array of strings)
- salientTerms MUST be extracted from the user's original query - never invent new terms
- They are keywords used for BM25 full-text search to find notes containing those exact words
- Extract meaningful content words from the query (nouns, verbs, names, etc.)
- Exclude common words like "what", "I", "do", "the", "a", etc.
- Exclude time expressions like "last month", "yesterday", "last week"
- Preserve the original language - do NOT translate terms to English
Example usage:
<use_tool>
<name>localSearch</name>
<query>piano learning practice</query>
<salientTerms>["piano", "learning", "practice"]</salientTerms>
</use_tool>
For localSearch with time range (e.g., "what did I do last week"):
Step 1 - Get time range:
<use_tool>
<name>getTimeRangeMs</name>
<timeExpression>last week</timeExpression>
</use_tool>
Step 2 - Search with time range (after receiving time range result):
<use_tool>
<name>localSearch</name>
<query>what did I do</query>
<salientTerms>[]</salientTerms>
<timeRange>{"startTime": {...}, "endTime": {...}}</timeRange>
</use_tool>
For localSearch with meaningful terms (e.g., "python debugging notes from yesterday"):
Step 1 - Get time range:
<use_tool>
<name>getTimeRangeMs</name>
<timeExpression>yesterday</timeExpression>
</use_tool>
Step 2 - Search with time range:
<use_tool>
<name>localSearch</name>
<query>python debugging notes</query>
<salientTerms>["python", "debugging", "notes"]</salientTerms>
<timeRange>{"startTime": {...}, "endTime": {...}}</timeRange>
</use_tool>
For localSearch with non-English query (PRESERVE ORIGINAL LANGUAGE):
<use_tool>
<name>localSearch</name>
<query>\u94A2\u7434\u5B66\u4E60</query>
<salientTerms>["\u94A2\u7434", "\u5B66\u4E60"]</salientTerms>
</use_tool>`}},{tool:l7,metadata:{id:"webSearch",displayName:"Web Search",description:"Search the internet for information",category:"search",customPromptInstructions:`For webSearch:
- Only use when the user explicitly requests web/internet search
- Always provide an empty chatHistory array
Example usage:
<use_tool>
<name>webSearch</name>
<query>piano learning techniques</query>
<chatHistory>[]</chatHistory>
</use_tool>`}},{tool:kye,metadata:{id:"getCurrentTime",displayName:"Get Current Time",description:"Get the current time in any timezone",category:"time",isAlwaysEnabled:!0,customPromptInstructions:`For time queries (IMPORTANT: Always use UTC offsets, not timezone names):
Example 1 - "what time is it" (local time):
<use_tool>
<name>getCurrentTime</name>
</use_tool>
Example 2 - "what time is it in Tokyo" (UTC+9):
<use_tool>
<name>getCurrentTime</name>
<timezoneOffset>+9</timezoneOffset>
</use_tool>
Example 3 - "what time is it in New York" (UTC-5 or UTC-4 depending on DST):
<use_tool>
<name>getCurrentTime</name>
<timezoneOffset>-5</timezoneOffset>
</use_tool>`}},{tool:Bye,metadata:{id:"getTimeInfoByEpoch",displayName:"Get Time Info",description:"Convert epoch timestamp to human-readable format",category:"time",isAlwaysEnabled:!0}},{tool:$ye,metadata:{id:"getTimeRangeMs",displayName:"Get Time Range",description:"Convert time expressions to date ranges",category:"time",isAlwaysEnabled:!0,customPromptInstructions:`For time-based queries:
- Use this tool to convert time expressions like "last week", "yesterday", "last month" to proper time ranges
- This is typically the first step before using localSearch with a time range
Example:
<use_tool>
<name>getTimeRangeMs</name>
<timeExpression>last week</timeExpression>
</use_tool>`}},{tool:zye,metadata:{id:"convertTimeBetweenTimezones",displayName:"Convert Timezones",description:"Convert time between different timezones",category:"time",isAlwaysEnabled:!0,customPromptInstructions:`For timezone conversions:
Example - "what time is 6pm PT in Tokyo" (PT is UTC-8 or UTC-7, Tokyo is UTC+9):
<use_tool>
<name>convertTimeBetweenTimezones</name>
<time>6pm</time>
<fromOffset>-8</fromOffset>
<toOffset>+9</toOffset>
</use_tool>`}},{tool:xZ,metadata:{id:"pomodoro",displayName:"Pomodoro Timer",description:"Manage time with Pomodoro technique",category:"time"}},{tool:aye,metadata:{id:"writeToFile",displayName:"Write to File",description:"Create or modify files in your vault",category:"file",requiresVault:!0,customPromptInstructions:`For writeToFile:
- NEVER display the file content directly in your response
- Always pass the complete file content to the tool
- Include the full path to the file
- You MUST explicitly call writeToFile for any intent of updating or creating files
- Do not call writeToFile tool again if the result is not accepted
- Do not call writeToFile tool if no change needs to be made
Example usage:
<use_tool>
<name>writeToFile</name>
<path>path/to/note.md</path>
<content>FULL CONTENT OF THE NOTE</content>
</use_tool>`}},{tool:Uer,metadata:{id:"replaceInFile",displayName:"Replace in File",description:"Make targeted changes to existing files using SEARCH/REPLACE blocks",category:"file",requiresVault:!0,customPromptInstructions:`For replaceInFile:
- Remember: Small edits \u2192 replaceInFile, Major rewrites \u2192 writeToFile
- SEARCH text must match EXACTLY including all whitespace
Example usage:
<use_tool>
<name>replaceInFile</name>
<path>notes/meeting.md</path>
<diff>
------- SEARCH
## Attendees
- John Smith
- Jane Doe
=======
## Attendees
- John Smith
- Jane Doe
- Bob Johnson
+++++++ REPLACE
</diff>
</use_tool>`}},{tool:Lnr,metadata:{id:"youtubeTranscription",displayName:"YouTube Transcription",description:"Get transcripts from YouTube videos",category:"media",customPromptInstructions:`For youtubeTranscription:
- Use when user provides YouTube URLs
- No parameters needed - the tool will process URLs from the conversation
Example usage:
<use_tool>
<name>youtubeTranscription</name>
</use_tool>`}}]});function eqn(){return 1e4}function tqn(t,e){let r=e??eqn();if(!t||t.length<=r)return t;let n=t.substring(0,r),o=t.length-r;return`${n}
... (truncated ${o.toLocaleString()} characters)`}function rqn(t,e,r){let n=tqn(e,r);return`Tool '${t}' result: ${n}`}function j6e(t,e=!1){return t.map(r=>e?rqn(r.toolName,r.result):`Tool '${r.toolName}' result: ${r.result}`).join(`
`)}var Vnr=b(()=>{});function Wnr(t){let e=["find","search","look for","look up","my notes","in my vault","from my vault","check the web","search online","from the internet","current time","what time","timer","youtube","video","transcript"],r=t.toLowerCase();return e.some(n=>r.includes(n))}var k6e,Gk,D6e,L6e,F6e,EZ,Knr=b(()=>{Kt();k6e=50,Gk=class{constructor(e){this.modelName=e}buildToolSpecificInstructions(e){let r=[];for(let n of e)n.customPromptInstructions&&r.push(n.customPromptInstructions);return r.length>0?r.join(`
`):""}enhanceSystemPrompt(e,r,n,o){let i=o||[],a=this.buildToolSpecificInstructions(i);return`${e}
# Autonomous Agent Mode
You are now in autonomous agent mode. You can use tools to gather information and complete tasks step by step.
When you need to use a tool, format it EXACTLY like this:
<use_tool>
<name>tool_name_here</name>
<parameter_name>value</parameter_name>
<another_parameter>["array", "values"]</another_parameter>
</use_tool>
IMPORTANT: Use the EXACT parameter names as shown in the tool descriptions below. Do NOT use generic names like "param1" or "param".
Available tools:
${r}
# Tool Usage Guidelines
## Time-based Queries
When users ask about temporal periods (e.g., "what did I do last month", "show me notes from last week"), you MUST:
1. First call getTimeRangeMs to convert the time expression to a proper time range
2. Then use localSearch with the timeRange parameter from step 1
3. For salientTerms, ONLY use words that exist in the user's original query (excluding time expressions)
Example for "what did I do last month":
1. Call getTimeRangeMs with timeExpression: "last month"
2. Use localSearch with query matching the user's question
3. salientTerms: [] - empty because "what", "I", "do" are not meaningful search terms
Example for "meetings about project X last week":
1. Call getTimeRangeMs with timeExpression: "last week"
2. Use localSearch with query "meetings about project X"
3. salientTerms: ["meetings", "project", "X"] - these words exist in the original query
${a?a+`
`:""}## General Guidelines
- Think hard about whether a query could potentially be answered from personal knowledge or notes, if yes, call a vault search (localSearch) first
- Only use web search if: the query explicitly asks for web search, OR the query explicitly requires current/web information
- NEVER mention tool names like "localSearch", "webSearch", etc. in your responses. Use natural language like "searching your vault", "searching the web", etc.
You can use multiple tools in sequence. After each tool execution, you'll receive the results and can decide whether to use more tools or provide your final response.
Always explain your reasoning before using tools. Be conversational and clear about what you're doing.
When you've gathered enough information, provide your final response without any tool calls.
IMPORTANT: Do not include any code blocks (\`\`\`) or tool_code blocks in your responses. Only use the <use_tool> format for tool calls.
NOTE: Use individual XML parameter tags. For arrays, use JSON format like ["item1", "item2"].`}enhanceUserMessage(e,r){return e}needsSpecialHandling(){return!1}},D6e=class extends Gk{isGPT5Model(){return this.modelName.includes("gpt-5")||this.modelName.includes("gpt5")}enhanceSystemPrompt(e,r,n,o){let i=super.enhanceSystemPrompt(e,r,n,o),a=n||[],s=a.includes("writeToFile")||a.includes("replaceInFile"),u="";return this.isGPT5Model()?u=`
GPT-5 SPECIFIC RULES:
- Use maximum 2 tool calls initially, then provide an answer
- Call each tool ONCE per unique query
- For optional parameters: OMIT them entirely if not needed (don't pass empty strings/null)
- For localSearch: OMIT timeRange if not doing time-based search
Example localSearch without time:
<use_tool>
<name>localSearch</name>
<query>piano notes</query>
<salientTerms>["piano", "notes"]</salientTerms>
</use_tool>`:u=`
CRITICAL FOR GPT MODELS: You MUST ALWAYS include XML tool calls in your response. Do not just describe what you plan to do - you MUST include the actual XML tool call blocks.`,s&&(u+=`
\u{1F6A8} FILE EDITING WITH COMPOSER TOOLS - GPT SPECIFIC EXAMPLES \u{1F6A8}
When user asks you to edit or modify a file, you MUST:
1. Determine if it's a small edit (use replaceInFile) or major rewrite (use writeToFile)
2. Include the tool call immediately in your response
EXAMPLE 1 - User says "fix the typo 'teh' to 'the' in my note":
\u2705 CORRECT RESPONSE:
"I'll fix the typo in your note.
<use_tool>
<name>replaceInFile</name>
<path>path/to/note.md</path>
<diff>
------- SEARCH
teh
=======
the
+++++++ REPLACE
</diff>
</use_tool>"
EXAMPLE 2 - User says "add item 4 to the list":
\u2705 CORRECT RESPONSE:
"I'll add item 4 to your list.
<use_tool>
<name>replaceInFile</name>
<path>path/to/file.md</path>
<diff>
------- SEARCH
- Item 1
- Item 2
- Item 3
=======
- Item 1
- Item 2
- Item 3
- Item 4
+++++++ REPLACE
</diff>
</use_tool>"
\u274C WRONG (DO NOT DO THIS):
"I'll help you add item 4 to the list. Let me update that for you."
[No tool call = FAILURE]
CRITICAL: The diff parameter MUST contain the SEARCH/REPLACE blocks wrapped in triple backticks EXACTLY as shown above.`),u+=`
FINAL REMINDER FOR GPT MODELS: If the user asks you to search, find, edit, or modify anything, you MUST include the appropriate <use_tool> XML block in your very next response. Do not wait for another turn.`,i+u}enhanceUserMessage(e,r){return r?this.getBaseEnhancement(e,r):e}getBaseEnhancement(e,r){if(!r)return e;let n=e.toLowerCase(),o=n.includes("find")||n.includes("search")||n.includes("my notes"),i=n.includes("edit")||n.includes("modify")||n.includes("update")||n.includes("change")||n.includes("fix")||n.includes("add")||n.includes("typo");return o?`${e}
REMINDER: Use the <use_tool> XML format to call the localSearch tool.`:i?`${e}
\u{1F6A8} GPT REMINDER: Use replaceInFile for small edits (with SEARCH/REPLACE blocks in diff parameter). The diff parameter MUST contain triple backticks around the SEARCH/REPLACE blocks. Check the examples in your system prompt.`:e}needsSpecialHandling(){return!0}},L6e=class extends Gk{isThinkingModel(){return this.modelName.includes("claude-3-7-sonnet")||this.modelName.includes("claude-sonnet-4")||this.modelName.includes("claude-3.7-sonnet")||this.modelName.includes("claude-4-sonnet")}isClaudeSonnet4(){return this.modelName.includes("claude-sonnet-4")||this.modelName.includes("claude-4-sonnet")||this.modelName.includes("claude-sonnet-4-20250514")}enhanceSystemPrompt(e,r,n,o){let i=super.enhanceSystemPrompt(e,r,n,o);if(this.isThinkingModel()){let a=`
IMPORTANT FOR CLAUDE THINKING MODELS:
- You are a thinking model with internal reasoning capability
- Your thinking process will be automatically wrapped in <think> tags - do not manually add thinking tags
- Place ALL tool calls AFTER your thinking is complete, in the main response body
- Tool calls must be in the main response body, NOT inside thinking sections
- Format tool calls exactly as shown in the examples above
- Do not provide final answers before using tools - use tools first, then provide your response based on the results
- If you need to use tools, include them immediately after your thinking, before any final response
CORRECT FLOW FOR THINKING MODELS:
1. Think through the problem (this happens automatically)
2. Use tools to gather information (place tool calls in main response)
3. Wait for tool results
4. Provide final response based on gathered information
INCORRECT: Providing a final answer before using tools
CORRECT: Using tools first, then providing answer based on results`;return this.isClaudeSonnet4()&&(a+=`
\u{1F6A8} CRITICAL INSTRUCTIONS FOR CLAUDE SONNET 4 - AUTONOMOUS AGENT MODE \u{1F6A8}
\u26A0\uFE0F WARNING: You have a specific tendency to write complete responses immediately after tool calls. This BREAKS the autonomous agent pattern!
\u{1F504} CORRECT AUTONOMOUS AGENT ITERATION PATTERN:
1. User asks question
2. Brief sentence about what you'll do (1 sentence max)
3. Use tools to gather information: <use_tool>...</use_tool>
4. \u270B STOP after tool calls - Do not write anything else
5. Wait for tool results (system provides them)
6. Evaluate results and either: Use more tools OR provide final answer
\u2705 IDEAL RESPONSE FLOW:
- Brief action statement (1 sentence)
- Tool calls
- STOP (wait for results)
- Brief transition statement (1 sentence)
- More tool calls OR final answer
\u{1F3AF} CORRECT FIRST RESPONSE PATTERN (when tools needed):
I'll search your vault for piano practice information.
<use_tool>
<name>localSearch</name>
<query>piano practice</query>
<salientTerms>["piano", "practice"]</salientTerms>
</use_tool>
\u{1F310} MULTILINGUAL EXAMPLE (PRESERVE ORIGINAL LANGUAGE):
<use_tool>
<name>localSearch</name>
<query>\u30D4\u30A2\u30CE\u306E\u7DF4\u7FD2\u65B9\u6CD5</query>
<salientTerms>["\u30D4\u30A2\u30CE", "\u7DF4\u7FD2", "\u65B9\u6CD5"]</salientTerms>
</use_tool>
<use_tool>
<name>webSearch</name>
<query>piano techniques</query>
<chatHistory>[]</chatHistory>
</use_tool>
[RESPONSE ENDS HERE - NO MORE TEXT]
\u{1F3AF} CORRECT FOLLOW-UP RESPONSE PATTERN:
Let me gather more specific information about practice schedules.
<use_tool>
<name>localSearch</name>
<query>practice schedule</query>
<salientTerms>["practice", "schedule"]</salientTerms>
</use_tool>
[RESPONSE ENDS HERE - NO MORE TEXT]
\u274C WRONG PATTERN (DO NOT DO THIS):
<use_tool>...</use_tool>
Based on the search results, here's a complete practice plan...
[This is FORBIDDEN - you haven't received results yet!]
\u{1F511} KEY UNDERSTANDING FOR CLAUDE 4:
- Brief 1-sentence explanations BEFORE tool calls are good
- Each response is ONE STEP in a multi-step process
- After tool calls, STOP and wait for the system to provide results
- Your thinking is automatically handled in <think> blocks
\u26A1 AUTONOMOUS AGENT RULES FOR CLAUDE 4:
1. If you need tools: Brief sentence + tool calls, then STOP
2. If you receive tool results: Evaluate if you need more tools
3. If you need more tools: Brief sentence + more tool calls, then STOP
4. If you have enough info: THEN provide your final response
REMEMBER: One brief sentence before tools is perfect. Nothing after tool calls.`),i+a}return i}needsSpecialHandling(){return this.isThinkingModel()}detectPrematureResponse(e){let r=e.indexOf("<use_tool>");if(r===-1)return{hasPremature:!1,type:null};let o=e.substring(0,r).trim().replace(/<think>[\s\S]*?<\/think>/g,"").trim();if(o.split(/[.!?]+/).filter(u=>u.trim().length>0).length>2||o.length>200)return{hasPremature:!0,type:"before"};let s=e.lastIndexOf("</use_tool>");return s!==-1&&e.substring(s+11).trim().replace(/<think>[\s\S]*?<\/think>/g,"").trim().length>100?{hasPremature:!0,type:"after"}:{hasPremature:!1,type:null}}sanitizeResponse(e,r){if(!this.isClaudeSonnet4()||r!==1)return e;let n=this.detectPrematureResponse(e);if(!n.hasPremature)return e;if(n.type==="after"){let o=e.lastIndexOf("</use_tool>");if(o!==-1){let i=e.substring(0,o+11),a=e.substring(o+11),s=/<think>[\s\S]*?<\/think>/g,u=a.match(s)||[];return i+(u.length>0?`
`+u.join(`
`):"")}}return e}shouldTruncateStreaming(e){if(!this.isClaudeSonnet4())return!1;let r=e.lastIndexOf("</use_tool>");return r===-1?!1:e.substring(r+11).trim().replace(/<think>[\s\S]*?<\/think>/g,"").trim().length>k6e}},F6e=class extends Gk{enhanceSystemPrompt(e,r,n,o){let i=super.enhanceSystemPrompt(e,r,n,o),u=`
\u{1F6A8} CRITICAL INSTRUCTIONS FOR GEMINI - AUTONOMOUS AGENT MODE \u{1F6A8}
You MUST use tools to complete tasks. DO NOT ask the user questions about how to proceed.
${(n||[]).includes("localSearch")?`
When the user mentions "my notes" or "my vault", use the localSearch tool.
\u274C WRONG:
"Let's start by searching your notes. What kind of information should I look for?"
\u2705 CORRECT:
<use_tool>
<name>localSearch</name>
<query>piano</query>
<salientTerms>["piano"]</salientTerms>
</use_tool>
`:""}
GEMINI SPECIFIC RULES:
1. When user mentions "my notes" about X \u2192 use localSearch with query "X"
2. DO NOT ask clarifying questions about search terms
3. DO NOT wait for permission to use tools
4. Use tools based on the user's request
PATTERN FOR MULTI-STEP REQUESTS:
User: "based on my project roadmap notes and create summary"
Your response:
<use_tool>
<name>localSearch</name>
<query>project roadmap</query>
<salientTerms>["project", "roadmap"]</salientTerms>
</use_tool>
Remember: The user has already told you what to do. Execute it NOW with the available tools.`;return i+u}enhanceUserMessage(e,r){return r?`${e}
REMINDER: Use the tools immediately. Do not ask questions. For "my notes", use localSearch.`:e}needsSpecialHandling(){return!0}},EZ=class{static createAdapter(e){let r=(e.modelName||e.model||"").toLowerCase();if(B(`Creating model adapter for: ${r}`),r.includes("gpt")){let n=new D6e(r);return n.isGPT5Model()?B("Using GPTModelAdapter with GPT-5 specific enhancements"):B("Using GPTModelAdapter"),n}return r.includes("claude")?(B("Using ClaudeModelAdapter"),new L6e(r)):r.includes("gemini")||r.includes("google/gemini")?(B("Using GeminiModelAdapter"),new F6e(r)):r.includes("copilot-plus")?(B("Using BaseModelAdapter for Copilot Plus"),new Gk(r)):(B("Using BaseModelAdapter (default)"),new Gk(r))}}});function Zye(t){let e=[];try{let r=/<use_tool>([\s\S]*?)<\/use_tool>/g,n;for(;(n=r.exec(t))!==null;){let o=n[1],i=o.match(/<name>([\s\S]*?)<\/name>/);if(i){let a=i[1].trim();if(!a||a.length===0){$t("Skipping tool call with empty name");continue}let s={},u=o.replace(/<name>[\s\S]*?<\/name>/,""),l=/<([^>]+)>([\s\S]*?)<\/\1>/g,c;for(;(c=l.exec(u))!==null;){let d=c[1].trim(),f=c[2].trim();d&&(s[d]=$6e(f,d))}e.push({name:a,args:s})}}}catch(r){return ie("Error parsing XML tool calls:",r),[]}return e}function $6e(t,e){if(!t)return e==="chatHistory"||e==="salientTerms"?[]:"";if(!/<[^>]+>/.test(t)){if(t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}"))try{return JSON.parse(t)}catch{return t}return t}let n=t.match(/<item>([\s\S]*?)<\/item>/g);if(n)return n.map(s=>{let u=s.replace(/<\/?item>/g,"").trim();return $6e(u)});let o=/<([^>]+)>([\s\S]*?)<\/\1>/g,i=[],a;for(;(a=o.exec(t))!==null;){let s=a[1].trim(),u=a[2].trim();i.push([s,$6e(u)])}return i.length>0?Object.fromEntries(i):t}function Gnr(t){t=t.replace(/<use_tool>[\s\S]*?<\/use_tool>/g,"");let e=t.match(/<use_tool>([\s\S]*)/),n=(e?e[1]:t).match(/<name>([\s\S]*?)<\/name>/);return n&&n[1].trim()||null}function PZ(t){let e=t;return e=e.replace(/<use_tool>[\s\S]*?<\/use_tool>/g,""),e=e.replace(/<use_tool>([\s\S]*)$/g,""),e=e.replace(/```\w*\s*```/g,""),e=e.replace(/```tool_code[\s\S]*?```/g,""),e=e.replace(/```[\w]*[\s\n]*```/g,""),e=e.replace(/\n\s*\n\s*\n/g,`
`).trim(),e}var B6e=b(()=>{Kt()});var TZ,Jnr=b(()=>{Kt();oy();bt();N6e();Lk();Gye();fr();Vnr();Kye();T6e();Knr();p4();f4();Wye();B6e();TZ=class t extends jO{constructor(){super(...arguments);this.llmFormattedMessages=[]}getAvailableTools(){let r=oe(),n=DO.getInstance();n.getAllTools().length===0&&Jye(this.chainManager.app?.vault);let o=new Set(r.autonomousAgentEnabledToolIds||[]);return n.getEnabledTools(o,!!this.chainManager.app?.vault)}static generateToolDescriptions(r){return r.map(o=>{let i="",a=$er(o.schema);return Object.keys(a).length>0&&(i=Object.entries(a).map(([s,u])=>`<${s}>${u}</${s}>`).join(`
`)),`<${o.name}>
<description>${o.description}</description>
<parameters>
${i}
</parameters>
</${o.name}>`}).join(`
`)}static generateSystemPrompt(r,n){let o=If(),i=t.generateToolDescriptions(r),a=r.map(l=>l.name),s=DO.getInstance(),u=r.map(l=>s.getToolMetadata(l.name)).filter(l=>l!==void 0);return n.enhanceSystemPrompt(o,i,a,u)}generateSystemPrompt(){let r=this.getAvailableTools(),n=this.chainManager.chatModelManager.getChatModel(),o=EZ.createAdapter(n);return t.generateSystemPrompt(r,o)}getTemporaryToolCallId(r,n){return`temporary-tool-call-id-${r}-${n}`}async run(r,n,o,i,a){let s="",u=[],l=[],c=[];if(this.llmFormattedMessages=[],!await sO({isAutonomousAgent:!0}))return await this.handleError(new Error("Invalid license key"),i,o),"";try{let g=(await this.chainManager.memoryManager.getMemory().loadMemoryVariables({})).history||[],y=this.generateSystemPrompt(),_=this.chainManager.chatModelManager.getChatModel(),w=EZ.createAdapter(_);y&&u.push({role:JA(_),content:y}),Vye(g,u);let S=this.isMultimodalModel(_),C=Wnr(r.message),E=w.enhanceUserMessage(r.message,C),P=S?await this.buildMessageContent(E,r):E;u.push({role:"user",content:P});let T=r.originalMessage||r.message,I=oe().autonomousAgentMaxIterations,N=0;for(;N<I&&!n.signal.aborted;){N++,B(`=== Autonomous Agent Iteration ${N} ===`);let M=[],D=await this.streamResponse(u,n,V=>{let q=PZ(V),H=[];H.push(...l),q.trim()&&H.push(q);let G=Zye(V),Z=[];G.length>0&&(Z=G.map(Ae=>Ae.name));let de=this.getAvailableTools(),pe=new Set(de.filter(Ae=>Ae.isBackground).map(Ae=>Ae.name)),ae=Gnr(V);if(ae){let Ae=V.lastIndexOf(ae);V.length-Ae>k6e&&Z.push(ae)}Z=Z.filter(Ae=>!pe.has(Ae));for(let Ae=0;Ae<Z.length;Ae++){let ke=Z[Ae],St=this.getTemporaryToolCallId(ke,Ae);if(M.findIndex(Hn=>Hn.includes(St))!==-1)continue;let Ir=Dde(St,ke,Kk(ke),RH(ke),"",!0,"","");M.push(Ir)}M.length>0&&H.push(M.join(`
`));let Te=H.join(`
`);o(Te)},w);if(!D)break;let k=Zye(D),F=w.detectPrematureResponse?.(D);if(F?.hasPremature&&N===1&&(F.type==="before"?($t("\u26A0\uFE0F Model provided premature response BEFORE tool calls!"),$t("Sanitizing response to keep only tool calls for first iteration")):F.type==="after"&&($t("\u26A0\uFE0F Model provided hallucinated response AFTER tool calls!"),$t("Truncating response at last tool call for first iteration"))),k.length===0){let V=PZ(D),q=[...l];V.trim()&&q.push(V),s=q.join(`
`),this.llmFormattedMessages.push(D);break}let K=D;w.sanitizeResponse&&F?.hasPremature&&(K=w.sanitizeResponse(D,N));let U=PZ(K);U.trim()&&l.push(U);let Y=[],ee=new Map;M.splice(k.length);for(let V=0;V<k.length;V++){let q=k[V];if(n.signal.aborted)break;M6e(q,N);let H=this.getAvailableTools(),Z=H.find(ae=>ae.name===q.name)?.isBackground||!1,de;if(!Z){let ae=RH(q.name),Te=Kk(q.name),Ae=Unr(q.name);de=`${q.name}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,ee.set(V,de);let ke=Dde(de,q.name,Te,ae,Ae||"",!0,"",""),St=M.findIndex(Ir=>Ir.includes(this.getTemporaryToolCallId(q.name,V)));St!==-1?M[St]=ke:(M.push(ke),$t("Created tool call marker for tool call that was not created during streaming",q.name));let Nr=[...l,...M].join(`
`);o(Nr)}let pe=await I6e(q,H,T);if(q.name==="localSearch"){let ae=this.processLocalSearchResult(pe);c.push(...ae.sources),pe.result=ae.formattedForLLM}if(Y.push(pe),de&&!Z){let ae=M.findIndex(Ae=>Ae.includes(de));ae!==-1&&(M[ae]=_ze(M[ae],de,pe.result));let Te=[...l,...M].join(`
`);o(Te)}R6e(q.name,pe)}if(M.length>0){let V=M.join(`
`);l.push(V)}if(this.llmFormattedMessages.push(D),Y.length>0){let V=j6e(Y,!0);V&&this.llmFormattedMessages.push(V)}let{ensureEncodedToolCallMarkerResults:L}=await Promise.resolve().then(()=>(f4(),Lde)),Q=L(D);u.push({role:"assistant",content:Q});let z=j6e(Y,!1);u.push({role:"user",content:z});let W=z.length>500?z.substring(0,500)+"... (truncated)":z;B("Tool results added to conversation:",W)}if(N>=I&&!s){$t(`Autonomous agent reached maximum iterations (${I}) without completing the task`);let M=`
I've reached the maximum number of iterations (${I}) for this task. I attempted to gather information using various tools but couldn't complete the analysis within the iteration limit. You may want to try a more specific question or break down your request into smaller parts.`;s=l.join(`
`)+M}}catch(h){if(h.name==="AbortError"||n.signal.aborted)B("Autonomous agent stream aborted by user",{reason:n.signal.reason});else{ie("Autonomous agent failed, falling back to regular Plus mode:",h);try{return await new jO(this.chainManager).run(r,n,o,i,a)}catch(m){return ie("Fallback to regular Plus mode also failed:",m),await this.handleError(m,i,o),""}}}let f=CZ(c),p=this.llmFormattedMessages.join(`
`);return!s&&l.length>0&&($t("fullAIResponse was empty, using iteration history"),s=l.join(`
`)),await Promise.resolve().then(()=>(f4(),Lde)),this.handleResponse(s,r,n,i,o,f.length>0?f:void 0,p)}async streamResponse(r,n,o,i){let a=new g_(o,i),s=2,u=0;for(;u<=s;)try{let l=await Sd(()=>this.chainManager.chatModelManager.getChatModel().stream(r,{signal:n.signal}));for await(let c of l){if(n.signal.aborted)break;a.processChunk(c)}return a.close()}catch(l){if(l.name==="AbortError"||n.signal.aborted)return a.close();if((l?.message?.includes("overloaded")||l?.message?.includes("Overloaded")||l?.error?.type==="overloaded_error")&&u<s){u++,B(`Retrying autonomous agent request (attempt ${u}/${s+1}) due to overloaded error`),await new Promise(d=>setTimeout(d,1e3*u));continue}throw l}return a.close()}}});var Znr=b(()=>{iG();iHt();Cer();Kye();Hnr();Jnr();p4();B6e();Wye()});var NH,Ynr,Yye,z6e,Xnr=b(()=>{NH=class{},Ynr=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},Yye=(t,e)=>{let r=Ynr(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},z6e=(t,e)=>{let r=Ynr(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}});var AZ=b(()=>{Xnr()});var U6e,jH,Qnr=b(()=>{ij();hj();U6e=class extends hm{addUserMessage(e){return this.addMessage(new Zs(e))}addAIChatMessage(e){return this.addMessage(new Fn(e))}addAIMessage(e){return this.addMessage(new Fn(e))}async addMessages(e){for(let r of e)await this.addMessage(r)}clear(){throw new Error("Not implemented.")}},jH=class extends U6e{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 eor=b(()=>{Qnr()});var q6e=b(()=>{eor()});var H_,N1=b(()=>{AZ();q6e();H_=class extends NH{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 jH,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(Yye(e,this.inputKey)),await this.chatHistory.addAIChatMessage(z6e(r,this.outputKey))}async clear(){await this.chatHistory.clear()}}});var IZ,tor=b(()=>{Fs();N1();IZ=class extends H_{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]:Sp(r,this.humanPrefix,this.aiPrefix)}}}});var ror=b(()=>{AZ();Fs()});var nor=b(()=>{FA()});var oor=b(()=>{Gf();nor();Om();tg()});var ior=b(()=>{Mb()});var H6e=b(()=>{tg();VA();Om();oor();ior()});var Xye=b(()=>{VA()});var V6e=b(()=>{Fs();H6e();Xye();N1()});var MZ,aor=b(()=>{Fs();N1();MZ=class extends H_{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]:Sp(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}}});var sor=b(()=>{QK();AZ();ESe()});var uor=b(()=>{ij()});var lor=b(()=>{uor()});var cor=b(()=>{lor()});var dor=b(()=>{AZ();Fs();cor();H6e();Xye();N1()});var por=b(()=>{N1()});var mor=b(()=>{Fs();V6e()});var hor=b(()=>{Fs();N1()});var gor=b(()=>{tor();ror();V6e();aor();N1();q6e();sor();dor();Xye();por();mor();hor()});var W6e=b(()=>{gor()});var RZ,yor=b(()=>{bt();W6e();RZ=class t{constructor(){this.initMemory(),va(()=>{let e=this.memory?.chatHistory;this.initMemory(e)})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initMemory(e){let r=oe().contextTurns;this.memory=new MZ({k:r*2,memoryKey:"history",inputKey:"input",returnMessages:!0,chatHistory:e}),this.debug&&console.log("Memory initialized with context turns:",r)}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 NZ,bor=b(()=>{bt();VA();sa();NZ=class t{constructor(){this.initChatPrompt(),this.initQAPrompt(),va(()=>{this.initChatPrompt(),this.initQAPrompt()}),uz(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initChatPrompt(){let e=If(),r=bu();r&&Rj()&&(e=r.systemPrompt);let n=this.escapeTemplateString(e);this.chatPrompt=Cm.fromMessages([HA.fromTemplate(n),new Ov("history"),Ev.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=Cm.fromMessages([HA.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 Qye,jZ,_or=b(()=>{sa();oc();nr();Znr();Kt();bt();fr();VA();Qye=require("obsidian");Xge();yor();bor();jZ=class{constructor(e){this.retrievedDocuments=[];this.app=e,this.memoryManager=RZ.getInstance(),this.chatModelManager=c1.getInstance(),this.promptManager=NZ.getInstance(),this.initialize(),va(async()=>{await this.createChainWithNewModel()})}getRetrievedDocuments(){return this.retrievedDocuments}async initialize(){await this.createChainWithNewModel()}getChain(){return this.chain}getRetrievalChain(){return this.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 Qye.Notice(e),new Error(e)}}validateChainInitialization(){(!this.chain||!Aet(this.chain))&&(console.error("Chain is not initialized properly, re-initializing chain: ",Jg()),this.createChainWithNewModel({},!1))}storeRetrieverDocuments(e){this.retrievedDocuments=e}async createChainWithNewModel(e={},r=!0){let n=Jg(),o=bu();if(n==="project"&&!o)return;let i=n==="project"?o?.projectModelKey:Nee();if(!i)throw new Qye.Notice("No model key found"),new Error("No model key found");try{if(r){let a=bee(i,oe().activeModels);if(a||(console.error("Resetting default model. No model configuration found for: ",i),a=Pv[0],i=a.name+"|"+a.provider),n==="project"&&!a.projectEnabled){let u=oe().activeModels.find(l=>l.enabled&&l.projectEnabled);if(u)a=u,i=u.name+"|"+u.provider,new Qye.Notice(`Model ${a.name} is not available in project mode. Switching to ${u.name}.`);else throw new Error("No project-enabled models available. Please enable a model for project mode in settings.")}let s={...a,...o?.modelConfigs};await this.chatModelManager.setChatModel(s)}this.setChain(n,e),B(`Setting model to ${i}`)}catch(a){ie(`createChainWithNewModel failed: ${a}`),B(`modelKey: ${i}`)}}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":{this.chain=s8.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Ij("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=oe(),s=a.enableSemanticSearchV3?new(await Promise.resolve().then(()=>(uG(),Fde))).HybridRetriever({minSimilarityScore:.01,maxK:a.maxSourceChunks,salientTerms:[]}):new(await Promise.resolve().then(()=>(e7(),Qge))).TieredLexicalRetriever(app,{minSimilarityScore:.01,maxK:a.maxSourceChunks,salientTerms:[],timeRange:void 0,textWeight:void 0,returnAll:!1,useRerankerThreshold:void 0});this.retrievalChain=s8.createConversationalRetrievalChain({llm:n,retriever:s,systemMessage:If()},this.storeRetrieverDocuments.bind(this),oe().debug),Ij("vault_qa"),oe().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),this.chain=s8.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Ij("copilot_plus");break}case"project":{await this.initializeQAChain(r),this.chain=s8.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Ij("project");break}default:this.validateChainType(e);break}}getChainRunner(){let e=Jg(),r=oe();switch(e){case"llm_chain":return new aG(this);case"vault_qa":return new t7(this);case"copilot_plus":return r.enableAutonomousAgent?new TZ(this):new jO(this);case"project":return new OZ(this);default:throw new Error(`Unsupported chain type: ${e}`)}}async initializeQAChain(e){e.refreshIndex&&oe().enableSemanticSearchV3&&await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().indexVaultToVectorStore(!1)}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||a8(u)){let c=Cm.fromMessages([new Ov("history"),Ev.fromTemplate("{input}")]);a8(u)&&(c=Cm.fromMessages([[Do,If()||""],c])),this.createChainWithNewModel({prompt:c},!1)}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===Do&&await this.memoryManager.getMemory().saveContext({input:n.message},{output:o.message})}}}});var ebe,vor=b(()=>{sa();Kt();bt();fr();rG();ebe=class t{constructor(e){this.app=e}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}clearAllLoadStates(){vtt({success:[],failed:[],processingFiles:[],total:[]})}async executeWithProcessTracking(e,r,n){this.setFileOrUrlStartProcess(e);try{let o=await n();return this.setFileOrUrlProcessSuccessful(e),o}catch(o){let i=$P(o)?"Rate limit exceeded. (Rate limit: 50 files or 100MB per 3 hours, whichever is reached first)":Xn(o);throw this.setFileOrUrlProcessFailed(e,r,i),o}}setFileOrUrlStartProcess(e){Wi.set(m8,r=>{let n={...r};return n.failed.find(o=>o.path===e)&&(n.failed=n.failed.filter(o=>o.path!==e)),n.success.includes(e)&&(n.success=n.success.filter(o=>o!==e)),n.processingFiles.includes(e)||(n.processingFiles=[...n.processingFiles,e]),n.total.includes(e)||(n.total=[...n.total,e]),n})}setFileOrUrlProcessSuccessful(e){Mv("processingFiles",r=>r.filter(n=>n!==e)),Mv("success",r=>r.includes(e)?r:[...r,e])}setFileOrUrlProcessFailed(e,r,n){Mv("processingFiles",o=>o.filter(i=>i!==e)),Mv("failed",o=>{if(!o.find(a=>a.path===e)){let a={path:e,type:r,error:n,timestamp:Date.now()};return[...o,a]}return o})}preComputeAllItems(e,r){B(`[preComputeAllItems] Starting pre-computation for project: ${e.name}`);let n=[];n.push(...r.map(a=>a.path));let o=e.contextSource?.webUrls?.trim()||"";if(o){let a=o.split(`
`).filter(s=>s.trim());n.push(...a)}let i=e.contextSource?.youtubeUrls?.trim()||"";if(i){let a=i.split(`
`).filter(s=>s.trim());n.push(...a)}if(n.length>0){let a=[...new Set([...n])];Mv("total",s=>a),B(`[preComputeAllItems] Project ${e.name}: Added ${n.length} items to tracking (${a.length} total unique items)`)}}markAllCachedItemsAsSuccess(e,r,n){B(`[markAllCachedItemsAsSuccess] Starting for project: ${e.name||"default"}`);let o=e.contextSource?.webUrls?.trim()||"";if(o){let s=o.split(`
`).filter(u=>u.trim()).filter(u=>r.webContexts[u]);s.forEach(u=>{this.markCachedItemAsSuccess(u)}),s.length>0&&B(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached Web URLs as successful`)}let i=e.contextSource?.youtubeUrls?.trim()||"";if(i){let s=i.split(`
`).filter(u=>u.trim()).filter(u=>r.youtubeContexts[u]);s.forEach(u=>{this.markCachedItemAsSuccess(u)}),s.length>0&&B(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached YouTube URLs as successful`)}if(r.fileContexts){let a=new Set(n.filter(u=>u.extension==="md").map(u=>u.path)),s=Object.keys(r.fileContexts).filter(u=>a.has(u));s.forEach(u=>{this.markCachedItemAsSuccess(u)}),s.length>0&&B(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached files that match current project patterns as successful.`)}}markCachedItemAsSuccess(e){Mv("total",r=>r.includes(e)?r:[...r,e]),Mv("success",r=>r.includes(e)?r:[...r,e])}makeItemFailed(e,r,n){Mv("total",o=>o.includes(e)?o:[...o,e]),Mv("failed",o=>{if(!o.find(a=>a.path===e)){let a={path:e,type:r,error:n,timestamp:Date.now()};return[...o,a]}return o})}}});var Jk,Hd,lR=b(()=>{sa();tG();oc();nr();Kt();Ade();th();bt();jde();fr();rG();Jk=require("obsidian");Ey();_or();vor();Hd=class t{constructor(e,r){this.app=e,this.plugin=r,this.currentProjectId=null,this.chainMangerInstance=new jZ(e),this.projectContextCache=h_.getInstance(),this.fileParserManager=new uR(Gi.getInstance(),this.app.vault,!0,null),this.loadTracker=ebe.getInstance(this.app),mtt(async()=>{await this.getCurrentChainManager().createChainWithNewModel()}),htt(async()=>{if(Rj())return;let n=oe(),o=n.enableSemanticSearchV3&&n.indexVaultToVectorStore==="ON MODE SWITCH"&&(Jg()==="vault_qa"||Jg()==="copilot_plus");await this.getCurrentChainManager().createChainWithNewModel({refreshIndex:o})}),uz(async n=>{await this.switchProject(n)}),this.setupProjectListChangeMonitor()}setupProjectListChangeMonitor(){va(async(e,r)=>{if(!e||!r)return;let n=e.projectList||[],o=r.projectList||[];for(let i of o){let a=n.find(s=>s.id===i.id);a&&JSON.stringify(a)!==JSON.stringify(i)&&(await this.compareAndUpdateCache(a,i),this.currentProjectId===i.id&&await Promise.all([this.loadProjectContext(i),this.getCurrentChainManager().createChainWithNewModel()]))}})}static getInstance(e,r){return t.instance||(t.instance=new t(e,r)),t.instance}getCurrentChainManager(){return this.chainMangerInstance}getCurrentProjectId(){return this.currentProjectId}async switchProject(e){try{if(this.loadTracker.clearAllLoadStates(),EE(!0),B("Project loading started..."),!e){await this.saveCurrentProjectMessage(),this.currentProjectId=null,await this.loadNextProjectMessage(),this.refreshChatView();return}let r=e.id;if(this.currentProjectId===r)return;await this.saveCurrentProjectMessage(),this.currentProjectId=r,await this.loadNextProjectMessage(),await this.getCurrentChainManager().createChainWithNewModel(),this.fileParserManager=new uR(Gi.getInstance(),this.app.vault,!0,e),await this.loadProjectContext(e),this.refreshChatView(),B(`Switched to project: ${e.name}`)}catch(r){throw ie(`Failed to switch project: ${r}`),r}finally{EE(!1)}}async saveCurrentProjectMessage(){await this.plugin.autosaveCurrentChat()}async loadNextProjectMessage(){await this.plugin.chatUIState.handleProjectSwitch()}async loadProjectContext(e){this.loadTracker.clearAllLoadStates(),EE(!0);try{if(!e.contextSource)return $t(`[loadProjectContext] Project ${e.name}: No contextSource. Aborting.`),null;B(`[loadProjectContext] Starting for project: ${e.name}`),B(`[loadProjectContext] Project ${e.name}: Cleared all project context load states`);let r=await this.projectContextCache.getOrInitializeCache(e),n=this.getProjectAllFiles(e);this.loadTracker.preComputeAllItems(e,n),this.loadTracker.markAllCachedItemsAsSuccess(e,r,n);let[o]=await Promise.all([this.processMarkdownFiles(e,r,n),this.processWebUrls(e,r),this.processYoutubeUrls(e,r)]);return o.timestamp=Date.now(),await this.projectContextCache.setCacheSafely(e,o),await this.processNonMarkdownFiles(e,n),B(`[loadProjectContext] Completed for project: ${e.name}.`),o}catch(r){throw ie(`[loadProjectContext] Failed for project ${e.name}:`,r),r}}async compareAndUpdateCache(e,r){try{if(!await this.projectContextCache.get(e))return!0;let o=e.contextSource?.inclusions||"",i=r.contextSource?.inclusions||"",a=e.contextSource?.exclusions||"",s=r.contextSource?.exclusions||"";(o!==i||a!==s)&&(await this.projectContextCache.invalidateMarkdownContext(r),B(`Markdown configuration changed for project ${r.name}, marking for reload`));let u=e.contextSource?.webUrls||"",l=r.contextSource?.webUrls||"";if(u!==l){let f=u.split(`
`).filter(h=>h.trim()),p=l.split(`
`).filter(h=>h.trim());await this.projectContextCache.removeWebUrls(r,f.filter(h=>!p.includes(h)))}let c=e.contextSource?.youtubeUrls||"",d=r.contextSource?.youtubeUrls||"";if(c!==d){let f=c.split(`
`).filter(h=>h.trim()),p=d.split(`
`).filter(h=>h.trim());await this.projectContextCache.removeYoutubeUrls(r,f.filter(h=>!p.includes(h)))}}catch(n){ie(`Error comparing project configurations: ${n}`)}}refreshChatView(){let e=this.app.workspace.getLeavesOfType(Ms)[0]?.view;e&&e.updateView()}async getProjectContext(e){let r=oe().projectList.find(o=>o.id===e);if(!r)return $t(`[getProjectContext] Project not found for ID: ${e}`),null;B(`[getProjectContext] Getting context for project: ${r.name} (ID: ${e})`);let n=this.projectContextCache.getSync(r);if(!n||n.markdownNeedsReload){n?B(`[getProjectContext] Project ${r.name}: Markdown needs reload. Triggering full load.`):B(`[getProjectContext] Project ${r.name}: Memory cache miss. Triggering full load.`);let o=await this.loadProjectContext(r);if(!o)return ie(`[getProjectContext] Project ${r.name}: loadProjectContext returned null.`),null;n=o}else B(`[getProjectContext] Project ${r.name}: Memory cache hit and markdown OK. Using existing context.`);return this.formatProjectContextWithFiles(n,r)}async formatProjectContextWithFiles(e,r){let n=[];if(e.markdownContext&&n.push(`## Markdown Files
${e.markdownContext}`),Object.keys(e.webContexts).length>0&&n.push(`## Web Content
${Object.values(e.webContexts).join(`
`)}`),Object.keys(e.youtubeContexts).length>0&&n.push(`## YouTube Content
${Object.values(e.youtubeContexts).join(`
`)}`),Object.keys(e.fileContexts).length>0){let o=Object.entries(e.fileContexts).filter(([i])=>i.split(".").pop()?.toLowerCase()!=="md");if(o.length>0){let i=o.map(async([s,u])=>{let l=s.split("/"),c=l[l.length-1],d=c.split(".").pop()||"",f=await this.projectContextCache.getOrReuseFileContext(r,s)||"[Content not available]";return`[[${c}]]
path: ${s}
type: ${d}
modified: ${new Date(u.timestamp).toISOString()}
${f}`}),a=await Promise.all(i);a.length>0&&n.push(`## Other Files
${a.join(`
`)}`)}}return`
# Project Context
The following information is the relevant context for this project. Use this information to inform your responses when appropriate:
<ProjectContext>
${n.join(`
`)}
</ProjectContext>
`}formatProjectContext(e){let r=[];if(e.markdownContext&&r.push(`## Markdown Files
${e.markdownContext}`),Object.keys(e.webContexts).length>0&&r.push(`## Web Content
${Object.values(e.webContexts).join(`
`)}`),Object.keys(e.youtubeContexts).length>0&&r.push(`## YouTube Content
${Object.values(e.youtubeContexts).join(`
`)}`),Object.keys(e.fileContexts).length>0){let n="";for(let[o,i]of Object.entries(e.fileContexts)){let a=o.split("/"),s=a[a.length-1],u=s.split(".").pop()||"";n+=`[[${s}]]
path: ${o}
type: ${u}
modified: ${new Date(i.timestamp).toISOString()}
`}n&&r.push(`## Other Files
${n}`)}return`
# Project Context
The following information is the relevant context for this project. Use this information to inform your responses when appropriate:
<ProjectContext>
${r.join(`
`)}
</ProjectContext>
`}async processMarkdownFiles(e,r,n){if(B(`[processMarkdownFiles] Starting for project: ${e.name}`),r.markdownNeedsReload||!r.markdownContext||!r.markdownContext.trim()){B(`[processMarkdownFiles] Project ${e.name}: Processing markdown content.`);let o=await this.processMarkdownFileContext(n);this.projectContextCache.updateProjectMarkdownFilesFromPatterns(e,r,n),r.markdownContext=o,r.markdownNeedsReload=!1,B(`[processMarkdownFiles] Project ${e.name}: Markdown content updated.`)}else B(`[processMarkdownFiles] Project ${e.name}: Markdown content already up-to-date.`);return B(`[processMarkdownFiles] Completed for project: ${e.name}. Total fileContexts: ${Object.keys(r.fileContexts||{}).length}`),r}async processMarkdownFileContext(e){let r=e.filter(o=>o.extension==="md");B(`Found ${r.length} markdown files to process for project context`);let n=await Promise.all(r.map(async o=>{let i="",a="";try{let[s,u]=await this.loadTracker.executeWithProcessTracking(o.path,"md",async()=>Promise.all([this.app.vault.adapter.stat(o.path),this.app.vault.read(o)]));a=`[[${o.basename}]]
path: ${o.path}
type: ${o.extension}
created: ${s?new Date(s.ctime).toISOString():"unknown"}
modified: ${s?new Date(s.mtime).toISOString():"unknown"}`,i=u,B(`Completed processing markdown file: ${o.path}`)}catch(s){ie(`Error processing file ${o.path}: ${s}`),i=`[Error: ${Xn(s)}]`}return`${a}
${i}`}));return B("All markdown files processed for project context"),n.join(`
`)}async processWebUrls(e,r){B(`[processWebUrls] Starting for project: ${e.name}`);let n=e.contextSource?.webUrls?.trim()||"";if(!n)return Object.keys(r.webContexts).length>0&&(B(`[processWebUrls] Project ${e.name}: Clearing all Web contexts as none are configured.`),r.webContexts={}),r;let o=n.split(`
`).filter(c=>c.trim());B(`[processWebUrls] Project ${e.name}: Found ${o.length} URLs in config.`);let i=Object.keys(r.webContexts),a=o.filter(c=>!r.webContexts[c]);a.length>0&&B(`[processWebUrls] Project ${e.name}: Fetching content for ${a.length} new/updated Web URLs.`);let s=i.filter(c=>!o.includes(c));if(s.length>0){B(`[processWebUrls] Project ${e.name}: Removing ${s.length} obsolete Web URL contexts.`);for(let c of s)delete r.webContexts[c]}let u=a.map(async c=>{let d=await this.processWebUrlContext(c);return d&&B(`[processWebUrls] Project ${e.name}: Successfully fetched content for URL: ${c.substring(0,50)}...`),{url:c,context:d}});return(await Promise.all(u)).forEach(c=>{c&&c.context?r.webContexts[c.url]=c.context:c&&!c.context&&$t(`[processWebUrls] Project ${e.name}: Fetched empty content for Web URL: ${c.url}`)}),B(`[processWebUrls] Completed for project: ${e.name}. Total Web contexts: ${Object.keys(r.webContexts).length}`),r}async processYoutubeUrls(e,r){B(`[processYoutubeUrls] Starting for project: ${e.name}`);let n=e.contextSource?.youtubeUrls?.trim()||"";if(!n)return Object.keys(r.youtubeContexts).length>0&&(B(`[processYoutubeUrls] Project ${e.name}: Clearing all YouTube contexts as none are configured.`),r.youtubeContexts={}),r;let o=n.split(`
`).filter(c=>c.trim());B(`[processYoutubeUrls] Project ${e.name}: Found ${o.length} YouTube URLs in config.`);let i=Object.keys(r.youtubeContexts),a=o.filter(c=>!r.youtubeContexts[c]);a.length>0&&B(`[processYoutubeUrls] Project ${e.name}: Fetching transcripts for ${a.length} new/updated YouTube URLs.`);let s=i.filter(c=>!o.includes(c));if(s.length>0){B(`[processYoutubeUrls] Project ${e.name}: Removing ${s.length} obsolete YouTube URL contexts.`);for(let c of s)delete r.youtubeContexts[c]}let u=a.map(async c=>{let d=await this.processYoutubeUrlContext(c);return d&&B(`[processYoutubeUrls] Project ${e.name}: Successfully fetched transcript for YouTube URL: ${c.substring(0,50)}...`),{url:c,context:d}});return(await Promise.all(u)).forEach(c=>{c&&c.context?r.youtubeContexts[c.url]=c.context:c&&!c.context&&$t(`[processYoutubeUrls] Project ${e.name}: Fetched empty transcript for YouTube URL: ${c.url}`)}),B(`[processYoutubeUrls] Completed for project: ${e.name}. Total YouTube contexts: ${Object.keys(r.youtubeContexts).length}`),r}async processWebUrlContext(e){if(!e?.trim())return"";try{let r=sR.getInstance(),{urlContext:n}=await this.loadTracker.executeWithProcessTracking(e,"web",async()=>{let o=await r.processUrls(e);if(o.processedErrorUrls[e])throw new Error(o.processedErrorUrls[e]);return o});return n||""}catch(r){return ie(`Failed to process web URL: ${r}`),""}}async processYoutubeUrlContext(e){if(!e?.trim())return"";try{let r=await this.loadTracker.executeWithProcessTracking(e,"youtube",async()=>Gi.getInstance().youtube4llm(e));return r.response.transcript?`
YouTube transcript from ${e}:
${r.response.transcript}`:""}catch(r){return ie(`Failed to process YouTube URL ${e}: ${r}`),new Jk.Notice(`Failed to process YouTube URL ${e}: ${Xn(r)}`),""}}async processNonMarkdownFiles(e,r){let n=r.filter(i=>i.extension!=="md");if(B(`[loadProjectContext] Project ${e.name}: Checking for non-markdown processing: ${n.length} files .`),n.length<=0)return;this.fileParserManager=new uR(Gi.getInstance(),this.app.vault,!0,e);let o=0;for(let i of n){let a=i.path;if(this.fileParserManager.supportsExtension(i.extension))try{await this.loadTracker.executeWithProcessTracking(a,"nonMd",async()=>{await this.projectContextCache.getOrReuseFileContext(e,a)||(B(`[loadProjectContext] Project ${e.name}: Parsing/caching new/updated file: ${a}`),await this.fileParserManager.parseFile(i,this.app.vault)),o++})}catch(s){if(ie(`[loadProjectContext] Project ${e.name}: Error parsing file ${a}:`,s),$P(s))throw s}}o>0&&B(`[loadProjectContext] Project ${e.name}: Processed and cached ${o} non-markdown files.`)}async retryFailedItem(e){try{if(!this.currentProjectId){$t("[retryFailedItem] No current project, aborting retry");return}let r=oe().projectList.find(n=>n.id===this.currentProjectId);if(!r){ie(`[retryFailedItem] Current project not found: ${this.currentProjectId}`);return}switch(B(`[retryFailedItem] Starting retry for ${e.type} item: ${e.path}`),e.type){case"web":await this.retryWebUrl(r,e.path);break;case"youtube":await this.retryYoutubeUrl(r,e.path);break;case"md":await this.retryMarkdownFile(r,e.path);break;case"nonMd":await this.retryNonMarkdownFile(r,e.path);break;default:$t(`[retryFailedItem] Unknown item type: ${e.type}`);return}B(`[retryFailedItem] Successfully retried ${e.type} item: ${e.path}`),new Jk.Notice(`Retry successful: ${e.path}`)}catch(r){ie(`[retryFailedItem] Failed to retry ${e.type} item ${e.path}:`,r),new Jk.Notice(`Retry failed: ${Xn(r)}`)}}async retryWebUrl(e,r){let n=await this.processWebUrlContext(r);if(!n){$t(`[retryWebUrl] Project ${e.name}: Fetched empty content for Web URL: ${r}`);return}B(`[retryWebUrl] Project ${e.name}: Successfully fetched content for URL: ${r.substring(0,50)}...`),await this.projectContextCache.updateWebUrl(e,r,n)}async retryYoutubeUrl(e,r){let n=await this.processYoutubeUrlContext(r);if(!n){$t(`[retryYoutubeUrl] Project ${e.name}: Fetched empty transcript for YouTube URL: ${r}`);return}B(`[retryYoutubeUrl] Project ${e.name}: Successfully fetched transcript for YouTube URL: ${r.substring(0,50)}...`),await this.projectContextCache.updateYoutubeUrl(e,r,n)}async retryMarkdownFile(e,r){let n=this.app.vault.getAbstractFileByPath(r);if(!(n instanceof Jk.TFile)||n.extension!=="md")throw new Error(`File not found or not a markdown file: ${r}`);try{await this.loadTracker.executeWithProcessTracking(n.path,"md",async()=>{}),B(`[retryMarkdownFile] Successfully reprocessed markdown file: ${r}`),await this.projectContextCache.invalidateMarkdownContext(e)}catch(o){throw ie(`[retryMarkdownFile] Error processing file ${r}: ${o}`),o}}async retryNonMarkdownFile(e,r){let n=this.app.vault.getAbstractFileByPath(r);if(!(n instanceof Jk.TFile)||n.extension==="md")throw new Error(`File not found or is a markdown file: ${r}`);if(!this.fileParserManager.supportsExtension(n.extension))throw new Error(`Unsupported file extension: ${n.extension}`);try{await this.loadTracker.executeWithProcessTracking(r,"nonMd",async()=>this.fileParserManager.parseFile(n,this.app.vault)),B(`[retryNonMarkdownFile] Successfully reprocessed non-markdown file: ${r}`)}catch(o){throw ie(`[retryNonMarkdownFile] Error processing file ${r}: ${o}`),o}}getProjectAllFiles(e){let{inclusions:r,exclusions:n}=bc({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0});return this.app.vault.getFiles().filter(o=>ys(o,r,n,!0))}onunload(){this.projectContextCache.cleanup()}}});var wor={};ns(wor,{AutocompleteCache:()=>DZ});var DZ,K6e=b(()=>{Kt();DZ=class t{constructor(){this.cache=new Map,this.maxSize=200,this.ttlMs=10*60*1e3}static getInstance(){return t.instance||(t.instance=new t),t.instance}get(e){let r=this.cache.get(e);if(r){if(Date.now()-r.timestamp>this.ttlMs){this.cache.delete(e);return}return r.response}}set(e,r){if(this.cache.size>=this.maxSize){let n=this.cache.keys().next().value;this.cache.delete(n)}this.cache.set(e,{response:r,timestamp:Date.now()}),B(`[AutocompleteCache] Cached response for key: ${e.slice(0,50)}...`)}clear(){this.cache.clear(),B("[AutocompleteCache] Cleared autocomplete cache")}generateSentenceKey(e,r,n){let o={prefix:e.slice(-100),noteContext:r.slice(-200),relevantNotes:n.slice(0,100)};return`sentence:${JSON.stringify(o)}`}generateWordKey(e,r,n){let o={contextPrefix:e.slice(-50),contextSuffix:r.slice(0,50),words:n.slice(0,5)};return`word:${JSON.stringify(o)}`}getStats(){return{size:this.cache.size,maxSize:this.maxSize,ttlMs:this.ttlMs}}}});var Clr=x((a6i,Slr)=>{"use strict";var GHn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Slr.exports=GHn});var Tlr=x((s6i,Plr)=>{"use strict";var JHn=Clr();function Olr(){}function Elr(){}Elr.resetWarningCache=Olr;Plr.exports=function(){function t(n,o,i,a,s,u){if(u!==JHn){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:Elr,resetWarningCache:Olr};return r.PropTypes=r,r}});var Ilr=x((c6i,Alr)=>{Alr.exports=Tlr()();var u6i,l6i});var Llr=x(W5e=>{"use strict";W5e.__esModule=!0;W5e.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 LGn={};ns(LGn,{default:()=>Qve});module.exports=Mc(LGn);Ey();lR();sa();nr();Kt();bt();K6e();nr();Ey();Kt();bt();var rb=require("@codemirror/view"),YT=require("@codemirror/state");function xor(t,e,r=void 0){let n={force:()=>{}},o=null;async function*i(...a){o&&clearTimeout(o);let s=null;try{await new Promise(u=>{s=o=setTimeout(()=>u(),e),n.force=()=>{o&&clearTimeout(o),u()}})}catch{if(r!==void 0)throw r}for await(let u of t(...a)){if(s!==o)break;yield u}}return{debounced:i,force:()=>n.force()}}var aqn=Object.defineProperty,sqn=(t,e,r)=>e in t?aqn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,DH=(t,e,r)=>(sqn(t,typeof e!="symbol"?e+"":e,r),r),tbe=YT.StateField.define({create(){return{suggestion:null}},update(t,e){let r=e.effects.find(n=>n.is(X6e));return e.state.doc&&r&&(r.value.doc==null||e.state.doc==r.value.doc)?{suggestion:r.value.suggestion}:{suggestion:null}}}),X6e=YT.StateEffect.define();function uqn(t,e){let r=t.state.selection.main.head,n=[],o=rb.Decoration.widget({widget:new G6e(e),side:1});return n.push(o.range(r)),rb.Decoration.set(n)}var G6e=class extends rb.WidgetType{constructor(e){super(),DH(this,"suggestion"),this.suggestion=e}toDOM(){let e=document.createElement("span");return e.style.opacity="0.4",e.className="cm-inline-suggestion",e.textContent=this.suggestion,e}},J6e=t=>{let e=0;return rb.ViewPlugin.fromClass(class{async update(r){let n=r.state.doc;if(!r.docChanged)return;let o=++e;for await(let i of t(r.state)){if(o!=e)return;r.view.dispatch({effects:X6e.of({suggestion:i,doc:n})})}}})},Z6e=class{constructor(){DH(this,"decorations"),this.decorations=rb.Decoration.none}update(e){var r;let n=(r=e.state.field(tbe))==null?void 0:r.suggestion;if(!n){this.decorations=rb.Decoration.none;return}this.decorations=uqn(e.view,n.display_suggestion)}},Sor=rb.ViewPlugin.fromClass(Z6e,{decorations:t=>t.decorations}),Y6e=class{constructor(e,r){DH(this,"suggestFn"),DH(this,"keymap"),DH(this,"completionId"),DH(this,"run",n=>{var o,i;let a=(o=n.state.field(tbe))==null?void 0:o.suggestion;return a?(n.dispatch({...lqn(n.state,a.complete_suggestion,n.state.selection.main.head,n.state.selection.main.head)}),(i=a.accept_hook)==null||i.call(a),(async()=>{if(this.suggestFn==null)return;let s=++this.completionId;for await(let u of this.suggestFn(n.state)){if(s!=this.completionId)return;n.dispatch({effects:X6e.of({suggestion:{complete_suggestion:u.complete_suggestion,display_suggestion:u.display_suggestion,accept_hook:u.accept_hook},doc:null})})}})(),!0):!1}),this.suggestFn=e,this.keymap=YT.Prec.highest(rb.keymap.of([{key:r,run:n=>this.run(n)}])),this.completionId=0}};function lqn(t,e,r,n){return{...t.changeByRange(o=>{if(o==t.selection.main)return{changes:{from:r,to:n,insert:e},range:YT.EditorSelection.cursor(r+e.length)};let i=n-r;return!o.empty||i&&t.sliceDoc(o.from-i,o.from)!=t.sliceDoc(r,n)?{range:o}:{changes:{from:o.from-i,to:o.from,insert:e},range:YT.EditorSelection.cursor(o.from-i+e.length)}}),userEvent:"input.complete"}}function Cor(t){return typeof t=="string"?{complete_suggestion:t,display_suggestion:t}:t}function cqn(t){return async function*(e){let r=await t(e);if(typeof r=="string"||"complete_suggestion"in r){yield Cor(r);return}for await(let n of r)yield Cor(n)}}function rbe(t){let{delay:e=500,accept_shortcut:r="Tab"}=t,n=cqn(t.fetchFn),{debounced:o,force:i}=xor(n,e);return{extension:r?[tbe,J6e(o),Sor,new Y6e(t.continue_suggesting?n:null,r).keymap]:[tbe,J6e(o),Sor],force_fetch:i}}var n8e=require("obsidian");var Q6e=class{process(e){let{prefix:r,suffix:n}=e,{completion:o}=e;return o=this.removeWordOverlapPrefix(r,o),o=this.removeWordOverlapSuffix(o,n),o=this.removeCharacterOverlapPrefix(r,o),o=this.removeCharacterOverlapSuffix(o,n),o.startsWith(" ")&&this.endsWithMarker(r)&&(o=o.trimStart()),o}removeWordOverlapPrefix(e,r){let n=r.trimStart(),o=this.getPotentialPrefixSegments(e);for(let i of o)if(n.startsWith(i))return n.substring(i.length);return r}removeWordOverlapSuffix(e,r){let n=r.trimStart(),o=this.getPotentialCompletionSegments(e);for(let i of o)if(n.startsWith(i)&&e.endsWith(i))return e.substring(0,e.length-i.length);return e}removeCharacterOverlapPrefix(e,r){let n=e.length-1,o=0,i=0;for(;o<r.length&&n>=0&&r[o]===e[n]&&this.isWhiteSpaceOrCommonMarker(r[o]);)i++,n--,o++;return i>0?r.substring(i):r}removeCharacterOverlapSuffix(e,r){let n=0,o=e.length-1,i=0;for(;n<r.length&&o>=0&&e[o]===r[n]&&this.isWhiteSpaceOrCommonMarker(e[o]);)i++,n++,o--;return i>0?e.substring(0,e.length-i):e}getPotentialPrefixSegments(e){let r=[],n=this.startLocationOfEachWordOrMarker(e);for(let o=n.length-1;o>=0;o--)r.push(e.substring(n[o]));return e.length>0&&(r.length===0||r[r.length-1]!==e)&&r.push(e),e.length>1&&(r.length===0||r[r.length-1]!==e.slice(-1))&&r.push(e.slice(-1)),e.length>2&&(r.length===0||r[r.length-1]!==e.slice(-2))&&r.push(e.slice(-2)),[...new Set(r)].sort((o,i)=>i.length-o.length)}getPotentialCompletionSegments(e){let r=[],n=this.startLocationOfEachWordOrMarker(e);for(let o=0;o<n.length;o++)for(let i=o;i<n.length;i++){let a=i+1<n.length?n[i+1]:e.length;r.push(e.substring(n[o],a))}return e.length>0&&(r.length===0||r[r.length-1]!==e)&&r.push(e),[...new Set(r)].sort((o,i)=>i.length-o.length)}startLocationOfEachWordOrMarker(e){let r=[];if(e.length===0)return r;this.isWhiteSpaceChar(e[0])||r.push(0);for(let n=1;n<e.length;n++){let o=this.isWhiteSpaceChar(e[n-1]),i=this.isWhiteSpaceChar(e[n]),a=this.isCommonMarker(e[n-1]),s=this.isCommonMarker(e[n]);o&&!i||a&&!s&&!i?r.push(n):(!a&&s||o&&s)&&(r.includes(n)||r.push(n))}return r}isWhiteSpaceChar(e){return e!==void 0&&/\s/.test(e)}isCommonMarker(e){return e!==void 0&&/[-*>#$]/.test(e)}isWhiteSpaceOrCommonMarker(e){return this.isWhiteSpaceChar(e)||this.isCommonMarker(e)}endsWithMarker(e){if(e.length===0)return!1;if(this.isCommonMarker(e[e.length-1]))return!0;let r=e.length>=2?e.slice(-2):"",n=e.length>=3?e.slice(-3):"";return!!(r==="##"||r.match(/^#{1,6} $/)||r==="--"||n==="-->"||e.includes("## Heading"))}},e8e=class{process(e){let{prefix:r,suffix:n,completion:o,context:i}=e,a=o;return r.endsWith(" ")&&a.startsWith(" ")&&(a=a.trimStart()),n.startsWith(" ")&&a.endsWith(" ")&&(a=a.trimEnd()),(i==="UnorderedList"||i==="NumberedList"||i==="TaskList")&&r.endsWith(`
`)&&a.startsWith(`
`)&&(a=a.substring(1)),a}},t8e=class{process(e){let{completion:r,context:n}=e;if(n==="CodeBlock"){let o=r;return o=o.replace(/```[a-zA-Z]*[ \t]*\n?/g,""),o=o.replace(/\n?```[ \t]*\n?/g,""),o.endsWith(`
`)&&(o=o.slice(0,-1)),o}return r}},nbe=class{constructor(){this.processors=[];this.processors.push(new t8e),this.processors.push(new Q6e),this.processors.push(new e8e)}process(e,r,n,o){let a={prefix:e,suffix:r,completion:n,context:o};for(let s of this.processors)a.completion=s.process(a);return a.completion}};u8();var Oor=require("obsidian");function Eor(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 Por(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 Oor.TFile&&(r.push(i),r.length>=e))break}return r}Cde();bt();var r8e=require("obsidian"),dqn=.4,fqn=20,Tor=.7,obe=.3;async function pqn(t,e){let r=oe().debug,n=await FP.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 mqn(t){if(t.length===0)return[];let e=t[0].length,r=Array(e).fill(0);for(let n of t)for(let o=0;o<e;o++)r[o]+=n[o];for(let n=0;n<e;n++)r[n]/=t.length;return r}function hqn(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 gqn({db:t,filePath:e}){let r=oe().debug,n=await pqn(e,t),o=mqn(n);if(o.length===0)return r&&console.log("No embeddings found for note:",e),new Map;let i=await FP.getDocsByEmbedding(t,o,{limit:fqn,similarity:dqn});return hqn(i,e)}function yqn(t){let e=new Map,n=Eor(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=Por(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 bqn(t,e){let r=new Map,n=Tor+obe;for(let[o,i]of t)r.set(o,i*Tor/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=obe:(i.links||i.backlinks)&&(a=obe*.8),r.set(o,(r.get(o)??0)+a)}return r}async function abe({db:t,filePath:e}){let r=app.vault.getAbstractFileByPath(e);if(!(r instanceof r8e.TFile))return[];let n=await gqn({db:t,filePath:e}),o=yqn(r),i=bqn(n,o);return Array.from(i.entries()).sort((s,u)=>{let l=s[0],c=u[0],d=ibe(n.get(l)??0),f=ibe(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 r8e.TFile)||l.extension!=="md"?null:{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}}}).filter(s=>s!==null)}function ibe(t){return t>.7?3:t>.55?2:1}var Aor=require("obsidian"),_qn={cjk:[[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983]],japanese:[[12352,12447],[12448,12543]],korean:[[44032,55215],[4352,4607]],other:[[3584,3711],[1536,1791],[2304,2431],[2432,2559],[2688,2815],[2944,3071]]};function vqn(t,e){let r=t.codePointAt(0);return r?e.some(([n,o])=>r>=n&&r<=o):!1}function Ior(t){let e=t.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"");if(!e)return!1;for(let r of e)if(Object.values(_qn).some(n=>vqn(r,n)))return!0;return!1}function Mor(t,e){let r="",n="",o=Math.max(0,e.line-5);for(let u=o;u<e.line;u++)r+=t.getLine(u)+`
`;let i=t.getLine(e.line);r+=i.slice(0,e.ch),(e.ch===0||e.ch===i.length&&i.trim()==="")&&(r+=`
`);let a=Math.max(0,e.line-50);for(let u=a;u<e.line;u++)n+=t.getLine(u)+`
`;n+=i.slice(0,e.ch)+"{{CURSOR}}"+i.slice(e.ch)+`
`;let s=Math.min(t.lineCount()-1,e.line+50);for(let u=e.line+1;u<=s;u++)n+=t.getLine(u)+`
`;return{prefix:r,noteContext:n}}var j1=class j1{constructor(){this.currentNotePath=null;this.cachedNotes=null;this.cachedNoteTitles=[]}static getInstance(){return j1.instance||(j1.instance=new j1),j1.instance}getRelevantNoteTitles(){return this.cachedNoteTitles}async getRelevantNotes(e){if(!e)return this.currentNotePath=null,this.cachedNotes=null,this.cachedNoteTitles=[],"";if(this.currentNotePath===e.path&&this.cachedNotes!==null)return this.cachedNotes;let r=[];try{let a=await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().getDb();a&&(r=await abe({db:a,filePath:e.path}))}catch(i){console.warn("Failed to fetch relevant notes for autocomplete:",i)}let n=r.slice(0,j1.MAX_RELEVANT_NOTES);this.cachedNoteTitles=n.map(i=>i.document.title);let o=await Promise.all(n.map(async i=>{let a=app.vault.getAbstractFileByPath(i.document.path);if(!(a instanceof Aor.TFile))return"";let s=await app.vault.cachedRead(a);if(!s)return"";let u=s.length>3e3?s.slice(0,3e3)+"...":s;return`[[${i.document.title}]]:
${u}`}));return this.currentNotePath=e.path,this.cachedNotes=o.join(`
`),this.cachedNotes}clearCache(){this.currentNotePath=null,this.cachedNotes=null,this.cachedNoteTitles=[]}};j1.MAX_RELEVANT_NOTES=3;var sbe=j1;var Zk=class{constructor(){this.MIN_WORD_LENGTH=4;this.STOP_WORDS=new Set(["a","ain","all","am","an","and","any","are","as","at","be","but","by","can","d","did","do","don","few","for","had","has","he","her","him","his","how","i","if","in","is","isn","it","its","ll","m","ma","me","my","no","nor","not","now","o","of","off","on","or","our","out","own","re","s","she","so","t","the","to","too","up","ve","was","we","who","why","won","y","you"])}extractWords(e){return(this.preprocessText(e).match(/\b[a-zA-Z]+(?:'[a-zA-Z]+)?\b/g)||[]).filter(o=>this.isValidWord(o))}isWordCharacter(e){return/[a-zA-Z']/.test(e)}isValidWord(e){return!(e.length<this.MIN_WORD_LENGTH||!/^[a-zA-Z]+(?:'[a-zA-Z]+)?$/.test(e)||this.STOP_WORDS.has(e.toLowerCase())||e===e.toUpperCase()&&e.length>4)}getLanguage(){return"en"}preprocessText(e){return e.replace(/```[\s\S]*?```/g," ").replace(/`[^`]+`/g," ").replace(/\[\[([^\]]+)\]\]/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/<[^>]+>/g," ").replace(/^#+\s+/gm,"").replace(/[*_]{1,2}([^*_]+)[*_]{1,2}/g,"$1").replace(/^\s*[-*+]\s+/gm,"").replace(/^\s*\d+\.\s+/gm,"").replace(/\s+/g," ").trim()}};var LZ=class{constructor(e=5e4){this.wordCount=0;this.root=this.createNode(),this.maxSize=e}createNode(){return{children:new Map,isEndOfWord:!1,wordEntry:void 0}}addWord(e,r){if(!e||e.length<4||this.wordCount>=this.maxSize&&!this.hasWord(e))return;let n=this.root;for(let o of e)n.children.has(o)||n.children.set(o,this.createNode()),n=n.children.get(o);n.isEndOfWord?n.wordEntry&&(n.wordEntry.frequency++,n.wordEntry.lastSeen=Date.now(),r&&!n.wordEntry.contexts.includes(r)&&(n.wordEntry.contexts.push(r),n.wordEntry.contexts.length>10&&(n.wordEntry.contexts=n.wordEntry.contexts.slice(-10)))):(n.isEndOfWord=!0,n.wordEntry={word:e,frequency:1,contexts:r?[r]:[],lastSeen:Date.now()},this.wordCount++)}hasWord(e){let r=this.findNode(e);return r!==null&&r.isEndOfWord}getWordEntry(e){let r=this.findNode(e);return r&&r.isEndOfWord&&r.wordEntry?r.wordEntry:null}findNode(e){let r=this.root;for(let n of e){if(!r.children.has(n))return null;r=r.children.get(n)}return r}getSuggestions(e,r=10){if(!e)return[];let n=[],o=this.generatePrefixVariants(e);for(let a of o){let s=this.findNode(a);if(s&&(this.collectWords(s,a,n,r,e),n.length>=r))break}let i=this.deduplicateSuggestions(n);return i.sort((a,s)=>s.score-a.score),i.slice(0,r)}generatePrefixVariants(e){let r=new Set;return r.add(e),r.add(e.toLowerCase()),e.length>0&&r.add(e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()),r.add(e.toUpperCase()),Array.from(r)}deduplicateSuggestions(e){let r=new Map;for(let n of e){let o=n.word,i=r.get(o);(!i||n.score>i.score)&&r.set(o,n)}return Array.from(r.values())}collectWords(e,r,n,o,i){if(!(n.length>=o)){if(e.isEndOfWord&&e.wordEntry){let a=this.calculateScore(e.wordEntry)+this.getCaseMatchBonus(r,i);n.push({word:r,score:a,source:"vault"})}for(let[a,s]of e.children)this.collectWords(s,r+a,n,o,i)}}getCaseMatchBonus(e,r){if(e.length<r.length)return 0;let n=e.substring(0,r.length);return n===r?2:this.hasSameCasePattern(n,r)?1.5:1}hasSameCasePattern(e,r){if(e.length<r.length)return!1;for(let n=0;n<r.length;n++){let o=e[n],i=r[n],a=o===o.toUpperCase(),s=i===i.toUpperCase();if(a!==s)return!1}return!0}calculateScore(e){let r=Math.log(e.frequency+1)*10,n=Math.max(0,(Date.now()-e.lastSeen)/(1e3*60*60*24)),o=Math.max(0,10-n);return r+o}getStats(){let e=0,r=0,n=(o,i=0)=>{e++,r=Math.max(r,i);for(let a of o.children.values())n(a,i+1)};return n(this.root),{wordCount:this.wordCount,nodeCount:e,maxDepth:r}}clear(){this.root=this.createNode(),this.wordCount=0}getAllWords(){let e=[],r=n=>{n.isEndOfWord&&n.wordEntry&&e.push(n.wordEntry);for(let o of n.children.values())r(o)};return r(this.root),e}addWords(e,r){for(let n of e)this.addWord(n,r)}pruneByFrequency(e=2){let r=0,n=o=>{let i=[];for(let[a,s]of o.children)n(s)&&i.push(a);for(let a of i)o.children.delete(a);return o.isEndOfWord&&o.wordEntry&&o.wordEntry.frequency<e&&(o.isEndOfWord=!1,o.wordEntry=void 0,this.wordCount--,r++),o.children.size===0&&!o.isEndOfWord};return n(this.root),r}};Kt();var Ror=require("obsidian");var FZ=class{constructor(e,r,n,o){this.isScanning=!1;this.vault=e,this.settings=r,this.performance=n,this.tokenizer=o||new Zk}async scanVault(e){let r=Date.now(),n=[],o=new Map;try{let i=this.vault.getMarkdownFiles(),a=0;for(let l of i)try{e&&e({currentFile:l.path,processedFiles:a,totalFiles:i.length,foundWords:o.size});try{let d=await this.vault.adapter.stat(l.path);if(d&&d.size>this.performance.maxFileSize){n.push(`Skipped large file: ${l.path}`);continue}}catch{}let c=await this.vault.read(l);await this.processFile(l.path,c,o),a++,a%this.performance.batchSize===0&&await new Promise(d=>setTimeout(d,1))}catch(c){let d=`Error processing file ${l.path}: ${c}`;ie(d),n.push(d)}(this.settings.includeFileNames||this.settings.includeFolderNames)&&this.processFileAndFolderNames(o);let s=Date.now()-r;return{wordCount:o.size,fileCount:a,errors:n,scanTimeMs:s,wordMap:o}}catch(i){throw ie("[Word Completion] Vault scan failed:",i),i}}async scanFile(e){if(e.stat.size>this.performance.maxFileSize)return[];if(e.extension!=="md")return[];try{let r=await this.vault.read(e);return this.extractWordsFromText(r)}catch(r){return ie(`[Word Completion] Error reading file ${e.path}:`,r),[]}}extractWordsFromText(e){return!e||e.trim().length===0?[]:this.tokenizer.extractWords(e).filter(n=>{if(n.length<this.settings.minWordLength)return!1;for(let o of this.settings.excludePatterns)try{if(new RegExp(o,"i").test(n))return!1}catch(i){ie(`[Word Completion] Invalid exclude pattern: ${o}`,i)}return!0})}extractPathWords(){let e=new Set,r=n=>{let o=n.split("/").filter(Boolean);for(let i of o)i.replace(/\.[^.]+$/,"").split(/[^a-zA-Z]+/).filter(u=>u.length>=this.settings.minWordLength).filter(u=>this.tokenizer.isValidWord(u)).forEach(u=>e.add(u.toLowerCase()))};if(this.settings.includeFileNames&&this.vault.getMarkdownFiles().forEach(n=>{r(n.path)}),this.settings.includeFolderNames){let n=o=>{r(o.path),o.children.forEach(i=>{i instanceof Ror.TFolder&&n(i)})};n(this.vault.getRoot())}return Array.from(e)}getFilesToScan(){return this.vault.getMarkdownFiles().filter(e=>!(e.stat.size>this.performance.maxFileSize))}isScanningScanVault(){return this.isScanning}getEstimatedScanTime(){let r=this.getFilesToScan().reduce((o,i)=>o+i.stat.size,0);return Math.max(1,r/(1024*1024))*1e3}setTokenizer(e){this.tokenizer=e}updateSettings(e){this.settings=e}updatePerformance(e){this.performance=e}async processFile(e,r,n){let o=this.extractWordsFromText(r);for(let i of o){n.has(i)||n.set(i,{frequency:0,contexts:new Set});let a=n.get(i);a.frequency++,a.contexts.add(e)}}processFileAndFolderNames(e){let r=this.extractPathWords();for(let n of r)e.has(n)||e.set(n,{frequency:0,contexts:new Set}),e.get(n).frequency++,e.get(n).contexts.add("filename")}};Kt();var V_=class V_{constructor(e){this.isInitialized=!1;this.lastScanTime=0;this.vault=e,this.settings={...V_.DEFAULT_SETTINGS},this.performance={...V_.DEFAULT_PERFORMANCE},this.tokenizer=new Zk,this.trie=new LZ(this.performance.maxTrieSize),this.scanner=new FZ(this.vault,this.settings,this.performance,this.tokenizer)}static getInstance(e){return V_.instance||(V_.instance=new V_(e)),V_.instance}async initialize(e){if(this.isInitialized)return{wordCount:this.trie.getStats().wordCount,fileCount:0,errors:[],scanTimeMs:0};try{await new Promise(o=>setTimeout(o,100)),this.vault.getAllLoadedFiles().length===0&&await new Promise(o=>setTimeout(o,500));let n=await this.scanner.scanVault(e);return await this.populateTrieFromScanResult(n),this.isInitialized=!0,this.lastScanTime=Date.now(),n}catch(r){throw ie("[Word Completion] Initialization failed:",r),r}}getSuggestions(e){if(!this.isInitialized||!this.settings.enabled)return[];if(!e||e.length<this.settings.minPrefixLength)return[];if(!this.tokenizer.isWordCharacter(e[e.length-1]))return[];try{let r=this.settings.caseSensitive?e:e.toLowerCase();return this.trie.getSuggestions(r,this.settings.maxSuggestions).filter(i=>i.word.toLowerCase()!==e.toLowerCase())}catch(r){return ie("[Word Completion] Error getting suggestions:",r),[]}}shouldTriggerCompletion(e,r){if(!this.isInitialized||!this.settings.enabled)return!1;let n=e.substring(0,r),o=this.getCurrentWord(n);if(!o||o.length<this.settings.minPrefixLength)return!1;if(r>0){let s=e[r-1];if(/\s/.test(s))return!1}return this.getSuggestions(o).length>0}getCurrentWord(e){let r=e.length;for(let n=e.length-1;n>=0;n--){let o=e[n];if(!this.tokenizer.isWordCharacter(o)){r=n+1;break}n===0&&(r=0)}return e.substring(r).trim()}addWord(e,r){if(!(!this.isInitialized||!e||e.length<this.settings.minWordLength)&&this.tokenizer.isValidWord(e)){let n=this.settings.caseSensitive?e:e.toLowerCase();this.trie.addWord(n,r)}}getStats(){return{isInitialized:this.isInitialized,trieStats:this.trie.getStats(),lastScanTime:this.lastScanTime,settings:{...this.settings}}}updateSettings(e){this.settings={...this.settings,...e},this.scanner.updateSettings(this.settings)}updatePerformance(e){this.performance={...this.performance,...e},this.scanner.updatePerformance(this.performance)}reset(){this.trie.clear(),this.isInitialized=!1,this.lastScanTime=0}async rescan(e){return this.reset(),await this.initialize(e)}needsRescan(){return!1}getTokenizer(){return this.tokenizer}setTokenizer(e){this.tokenizer=e,this.scanner.setTokenizer(e)}async populateTrieFromScanResult(e){let r=e.wordMap;if(r)for(let[n,o]of r){let i=this.settings.caseSensitive?n:n.toLowerCase();for(let a=0;a<o.frequency;a++)this.trie.addWord(i,Array.from(o.contexts)[0]||"vault")}}destroy(){this.reset(),V_.instance=null}};V_.DEFAULT_SETTINGS={enabled:!0,minPrefixLength:2,maxSuggestions:20,includeVaultWords:!0,includeFileNames:!0,includeFolderNames:!0,caseSensitive:!1,minWordLength:4,excludePatterns:[]},V_.DEFAULT_PERFORMANCE={maxTrieSize:5e4,maxFileSize:1024*1024,batchSize:100};var Yk=V_;Kt();var wqn=require("obsidian");var ube=class t{constructor(e){this.options=e;this.isActive=!1;this.activeRequests=new Map;this.lastRequestTime=0;this.minRequestInterval=100;this.lastCursorPosition=null;this.cacheEnabled=!0;this.handleSettingsChange=(e,r)=>{if(e.autocompleteAcceptKey!==r.autocompleteAcceptKey){let n=this.validateAcceptKey(r.autocompleteAcceptKey);this.acceptKey=n,this.setupGlobalKeyHandler()}e.enableWordCompletion!==r.enableWordCompletion&&(r.enableWordCompletion&&this.initializeWordCompletion(),this.recreateExtension())};this.cache=DZ.getInstance(),this.client=Gi.getInstance(),this.postProcessor=new nbe,this.wordCompletionManager=Yk.getInstance(app.vault);let r=oe().autocompleteAcceptKey||Wg.KEYBIND;this.acceptKey=this.validateAcceptKey(r),this.recreateExtension(),this.setupGlobalKeyHandler(),this.unsubscribeFromSettings=va(this.handleSettingsChange),this.initializeWordCompletion()}validateAcceptKey(e){return["Tab","Space","ArrowRight"].includes(e)?e:"Tab"}async initializeWordCompletion(){if(oe().enableWordCompletion)try{await this.wordCompletionManager.initialize()}catch(r){ie("[Copilot Autocomplete] Failed to initialize word completion:",r)}}recreateExtension(){let{extension:e,force_fetch:r}=rbe({fetchFn:()=>this.handleUnifiedCompletion(),delay:this.options.delay,continue_suggesting:!1,accept_shortcut:null});this.extension=e,this.forceFetch=r,this.updateActiveEditors()}setupGlobalKeyHandler(){this.globalKeyListener&&document.removeEventListener("keydown",this.globalKeyListener,!0),this.globalKeyListener=e=>{if(!this.isActive)return;let r={Tab:["Tab"],Space:[" ","Space"],ArrowRight:["ArrowRight","Right"]},n=app.workspace.getActiveViewOfType(n8e.MarkdownView);if(!n?.editor)return;let o=n.editor.cm;if(!o)return;let i=this.hasActiveCompletion(o),a;for(let[s,u]of Object.entries(r))if(u.includes(e.key)){a=s;break}if(a===this.acceptKey&&i){let u=o.dom.querySelector(".cm-inline-suggestion")?.textContent||"";if(u){e.preventDefault(),e.stopPropagation();let l=o.state.selection.main.head,c=a==="Space"?" ":"";o.dispatch({changes:[{from:l,to:l,insert:u+c}],selection:{anchor:l+u.length+c.length}}),this.forceFetch();return}}if(e.key==="Tab"&&this.acceptKey!=="Tab"&&i){e.preventDefault(),e.stopPropagation();let s=o.state.selection.main.head;o.dispatch({changes:[{from:s,to:s,insert:" "}],selection:{anchor:s+1}})}},document.addEventListener("keydown",this.globalKeyListener,!0)}updateActiveEditors(){let e=app.workspace.getLeavesOfType("markdown");for(let r of e){let n=r.view;if(!n?.editor)continue;let o=n.editor.cm;if(o)try{o.dispatch({})}catch(i){ie(`[Copilot Autocomplete] Error updating editor: ${i}`)}}}hasActiveCompletion(e){let r=[".cm-inline-suggestion",".cm-ghost-text"];for(let n of r)if(Array.from(e.dom.querySelectorAll(n)).length>0)return!0;return!1}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}setActive(e){this.isActive=e}getExtension(){return this.extension}destroy(){this.globalKeyListener&&document.removeEventListener("keydown",this.globalKeyListener,!0),this.unsubscribeFromSettings&&this.unsubscribeFromSettings(),this.wordCompletionManager&&this.wordCompletionManager.destroy(),this.activeRequests.clear(),this.cache.clear()}shouldContinueSuggesting(e,r){if(e.endsWith("[[")||/\[\[[^\]]*$/.test(e)||r&&!r.startsWith(`
`))return!1;let o=e.split(`
`),i=o[o.length-1];if(/^#{1,6}(\s*)$/.test(i))return!1;let a=e.trim().split(/\s+/).filter(u=>u.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"").length>0),s=a[a.length-1]||"";return Ior(s)?!0:e.endsWith(" ")}async*handleUnifiedCompletion(){if(!this.isActive)return;let e=app.workspace.getActiveViewOfType(n8e.MarkdownView);if(!e)return;await new Promise(c=>setTimeout(c,10));let r=e.editor,n=r.getCursor(),{prefix:o,noteContext:i}=Mor(r,n),a=r.getLine(n.line).substring(n.ch)||"";if(this.lastCursorPosition){let c=Math.abs(n.line-this.lastCursorPosition.line),d=Math.abs(n.ch-this.lastCursorPosition.ch);(c>0||d>5)&&this.clearActiveRequests()}this.lastCursorPosition={line:n.line,ch:n.ch};let s=Date.now();if(s-this.lastRequestTime<this.minRequestInterval)return;let u=oe();if(this.shouldUseWordCompletion(o,u)){let c=this.getCurrentWordFromPrefix(o);if(!c||c.length<2)return;let d=`word:${c}:${o.slice(-50)}`;if(this.activeRequests.has(d))return;let f=this.wordCompletionManager.getSuggestions(c);if(f.length===0)return;let p=f.some(g=>g.word===c),h=f.some(g=>g.word.length-c.length>=2);if(p&&!h)return;let m=p?f.filter(g=>g.word!==c):f;if(m.length===0)return;try{let g=m.map(P=>P.word),y=o.slice(-1e3),_=a.slice(0,500),w,S,C;if(this.cacheEnabled&&(S=this.cache.generateWordKey(y,_,g),C=this.cache.get(S)),C)w=C;else{let P=this.client.wordcomplete(y,_,g);this.activeRequests.set(d,P),this.lastRequestTime=s,w=await P,this.cacheEnabled&&S&&this.cache.set(S,w),this.activeRequests.delete(d)}let E=w.response.selected_word;if(E&&E!==c){let P=this.generateCaseMatchedCompletion(E,c);P&&(yield{display_suggestion:P,complete_suggestion:P})}}catch(g){this.activeRequests.delete(d),ie("[Copilot Autocomplete] Error with LLM word selection, falling back to trie:",g);let y=m[0],_=this.generateCaseMatchedCompletion(y.word,c);_&&(yield{display_suggestion:_,complete_suggestion:_})}}else{if(!u.enableAutocomplete||!this.shouldContinueSuggesting(o,a))return;let c=o.slice(-this.options.maxContextLength);if(c.length<this.options.minTriggerLength)return;let d=`sentence:${c.slice(-100)}`;if(this.activeRequests.has(d))return;try{let f=u.allowAdditionalContext,p="";f&&(p=await sbe.getInstance().getRelevantNotes(e.file));let h=e.file?.basename||"",m=h?`[[${h}]]:
${c}`:c,g,y,_;if(this.cacheEnabled&&(y=this.cache.generateSentenceKey(m,i,p),_=this.cache.get(y)),_)g=_;else{let C=this.client.autocomplete(m,i,p);this.activeRequests.set(d,C),this.lastRequestTime=s,g=await C,this.cacheEnabled&&y&&this.cache.set(y,g),this.activeRequests.delete(d)}let w=g.response.completion,S=this.detectContext(o);w=this.postProcessor.process(c,a,w,S),yield{display_suggestion:w,complete_suggestion:w}}catch(f){this.activeRequests.delete(d),ie("[Copilot Autocomplete] Error fetching autocomplete suggestions:",f)}}}shouldUseWordCompletion(e,r){if(!r.enableWordCompletion||e.endsWith("[[")||/\[\[[^\]]*$/.test(e))return!1;let o=e.trim(),i=o[o.length-1];if(i&&/[a-zA-Z']/.test(i)){let a=this.getCurrentWordFromPrefix(e);if(a&&a.length>=2){let s=this.wordCompletionManager.getSuggestions(a);if(s.length===0)return!1;let u=s.some(c=>c.word===a),l=s.some(c=>c.word.length-a.length>=2);return!(u&&!l)}}return!1}getCurrentWordFromPrefix(e){let r=e.length;for(let o=e.length-1;o>=0;o--){let i=e[o];if(!/[a-zA-Z']/.test(i)){r=o+1;break}o===0&&(r=0)}let n=e.substring(r);return n.length>=2?n:null}generateCaseMatchedCompletion(e,r){if(e.length<=r.length)return"";let n=e.substring(r.length),o=r===r.toUpperCase(),i=r===r.toLowerCase(),a=r.length>0&&r[0]===r[0].toUpperCase()&&r.slice(1)===r.slice(1).toLowerCase();return o?n.toUpperCase():i||a?n.toLowerCase():n}detectContext(e){let r=e.split(`
`).pop()||"";if(/^\s*[-*+]\s/.test(r))return"UnorderedList";if(/^\s*\d+\.\s/.test(r))return"NumberedList";if(/^\s*[-*+]\s\[[ x]\]\s/.test(r))return"TaskList";if(e.includes("```")&&(e.split("```").length-1)%2===1)return"CodeBlock"}triggerCompletion(){this.isActive&&(this.clearActiveRequests(),this.forceFetch())}clearActiveRequests(){this.activeRequests.size>0&&this.activeRequests.clear()}getWordCompletionManager(){return this.wordCompletionManager}setCacheEnabled(e){this.cacheEnabled=e,e||this.cache.clear()}getCacheEnabled(){return this.cacheEnabled}};var lbe=class t{constructor(e){this.plugin=e;let r=oe();this.cmIntegration=ube.getInstance({delay:Wg.DELAY_MS,minTriggerLength:Wg.MIN_TRIGGER_LENGTH,maxContextLength:Wg.MAX_CONTEXT_LENGTH}),this.unsubscribeSettings=va((o,i)=>{let a=(o.enableAutocomplete||o.enableWordCompletion)&&o.isPlusUser===!0,s=(i.enableAutocomplete||i.enableWordCompletion)&&i.isPlusUser===!0;a!==s&&this.cmIntegration.setActive(s)});let n=(r.enableAutocomplete||r.enableWordCompletion)&&r.isPlusUser===!0;this.cmIntegration.setActive(n),this.registerExtension()}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}registerExtension(){try{this.plugin.registerEditorExtension([this.cmIntegration.getExtension()])}catch(e){ie("[Copilot Autocomplete] Failed to register CodeMirror extension:",e)}}destroy(){this.unsubscribeSettings(),this.cmIntegration.setActive(!1),this.cmIntegration.destroy()}};nr();fr();LN();function Nor(t){let e=t.split(`
`),r=[],n="",o="",i="";for(let a of e)a.startsWith("**user**:")||a.startsWith("**ai**:")?(n&&o&&r.push({id:lm(),sender:n===Do?Do:Vg,message:o.trim(),isVisible:!0,timestamp:i?KSe(i):null}),n=a.startsWith("**user**:")?Do:Vg,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({id:lm(),sender:n===Do?Do:Vg,message:o.trim(),isVisible:!0,timestamp:i?KSe(i):null}),r}async function jor(t,e){await e.clearChatMemory();for(let r=0;r<t.length-1;r++){let n=t[r];if(n.sender===Do){let o=t[r+1];o?.sender===Vg&&await e.getMemory().saveContext({input:n.message},{output:o.message})}}}sa();lze();tG();oc();Kt();var dir=require("obsidian");vo();var cbe=j(X());wn();var mi=cbe.forwardRef(({className:t,type:e,...r},n)=>cbe.createElement("input",{type:e,className:me("!tw-h-9 !tw-min-w-[50px] !tw-rounded-md !tw-border tw-border-solid tw-border-border !tw-bg-transparent !tw-px-3 !tw-py-1 !tw-text-sm !tw-transition-colors md:!tw-text-base","focus-visible:!tw-shadow-sm focus-visible:!tw-outline-none focus-visible:!tw-ring-1 focus-visible:!tw-ring-ring","placeholder:tw-text-sm","tw-flex tw-w-full tw-shadow-sm placeholder:tw-text-muted disabled:tw-cursor-not-allowed disabled:tw-opacity-50",t),ref:n,...r}));mi.displayName="Input";var dbe=j(X());var Bor=j(X(),1);var Lor=j(X(),1),For=j(Ba(),1);var tf=j(X(),1);var Dor=j(X(),1);function xqn(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function Xk(...t){return e=>t.forEach(r=>xqn(r,e))}function qs(...t){return Dor.useCallback(Xk(...t),t)}var LH=j(ut(),1),i8e=tf.forwardRef((t,e)=>{let{children:r,...n}=t,o=tf.Children.toArray(r),i=o.find(Cqn);if(i){let a=i.props.children,s=o.map(u=>u===i?tf.Children.count(a)>1?tf.Children.only(null):tf.isValidElement(a)?a.props.children:null:u);return(0,LH.jsx)(o8e,{...n,ref:e,children:tf.isValidElement(a)?tf.cloneElement(a,void 0,s):null})}return(0,LH.jsx)(o8e,{...n,ref:e,children:r})});i8e.displayName="Slot";var o8e=tf.forwardRef((t,e)=>{let{children:r,...n}=t;if(tf.isValidElement(r)){let o=Eqn(r);return tf.cloneElement(r,{...Oqn(n,r.props),ref:e?Xk(e,o):o})}return tf.Children.count(r)>1?tf.Children.only(null):null});o8e.displayName="SlotClone";var Sqn=({children:t})=>(0,LH.jsx)(LH.Fragment,{children:t});function Cqn(t){return tf.isValidElement(t)&&t.type===Sqn}function Oqn(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 Eqn(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 kor=j(ut(),1),Pqn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],zi=Pqn.reduce((t,e)=>{let r=Lor.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?i8e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,kor.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function $or(t,e){t&&For.flushSync(()=>t.dispatchEvent(e))}var zor=j(ut(),1),Tqn="Label",Uor=Bor.forwardRef((t,e)=>(0,zor.jsx)(zi.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Uor.displayName=Tqn;var a8e=Uor;nre();wn();var Iqn=$z("tw-text-sm tw-font-medium tw-leading-none peer-disabled:tw-cursor-not-allowed peer-disabled:tw-opacity-70"),Xp=dbe.forwardRef(({className:t,...e},r)=>dbe.createElement(a8e,{ref:r,className:me(Iqn(),t),...e}));Xp.displayName=a8e.displayName;var $H=j(X());var wg=j(X(),1);var Hor=j(X(),1);function qor(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function s8e(...t){return e=>{let r=!1,n=t.map(o=>{let i=qor(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():qor(t[o],null)}}}}function Vor(...t){return Hor.useCallback(s8e(...t),t)}var nb=j(X(),1),u8e=j(ut(),1);function Wor(t,e){let r=nb.createContext(e),n=i=>{let{children:a,...s}=i,u=nb.useMemo(()=>s,Object.values(s));return(0,u8e.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=nb.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 Xa(t,e=[]){let r=[];function n(i,a){let s=nb.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...h}=d,m=f?.[t]?.[u]||s,g=nb.useMemo(()=>h,Object.values(h));return(0,u8e.jsx)(m.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,h=nb.useContext(p);if(h)return h;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=>nb.createContext(a));return function(s){let u=s?.[t]||i;return nb.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Mqn(o,...e)]}function Mqn(...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 nb.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}function l8e(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var D1=j(X(),1);var FH=j(X(),1);function un(t){let e=FH.useRef(t);return FH.useEffect(()=>{e.current=t}),FH.useMemo(()=>(...r)=>e.current?.(...r),[])}function Qp({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=Rqn({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=un(r),u=D1.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 Rqn({defaultProp:t,onChange:e}){let r=D1.useState(t),[n]=r,o=D1.useRef(n),i=un(e);return D1.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var fbe=j(X(),1);function pbe(t){let e=fbe.useRef({value:t,previous:t});return fbe.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Gor=j(X(),1);var Kor=j(X(),1),yo=globalThis?.document?Kor.useLayoutEffect:()=>{};function L1(t){let[e,r]=Gor.useState(void 0);return yo(()=>{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 mh=j(X(),1);var Zor=j(X(),1);function Jor(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Nqn(...t){return e=>{let r=!1,n=t.map(o=>{let i=Jor(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():Jor(t[o],null)}}}}function Yor(...t){return Zor.useCallback(Nqn(...t),t)}var Xor=j(X(),1);function jqn(t,e){return Xor.useReducer((r,n)=>e[r][n]??r,t)}var rf=t=>{let{present:e,children:r}=t,n=Dqn(e),o=typeof r=="function"?r({present:n.isPresent}):mh.Children.only(r),i=Yor(n.ref,Lqn(o));return typeof r=="function"||n.isPresent?mh.cloneElement(o,{ref:i}):null};rf.displayName="Presence";function Dqn(t){let[e,r]=mh.useState(),n=mh.useRef({}),o=mh.useRef(t),i=mh.useRef("none"),a=t?"mounted":"unmounted",[s,u]=jqn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return mh.useEffect(()=>{let l=mbe(n.current);i.current=s==="mounted"?l:"none"},[s]),yo(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=mbe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),yo(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let m=mbe(n.current).includes(p.animationName);if(p.target===e&&m&&(u("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=p=>{p.target===e&&(i.current=mbe(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:mh.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function mbe(t){return t?.animationName||"none"}function Lqn(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 Qor=j(X(),1),zqn=j(Ba(),1);var nf=j(X(),1);var kH=j(ut(),1),d8e=nf.forwardRef((t,e)=>{let{children:r,...n}=t,o=nf.Children.toArray(r),i=o.find(kqn);if(i){let a=i.props.children,s=o.map(u=>u===i?nf.Children.count(a)>1?nf.Children.only(null):nf.isValidElement(a)?a.props.children:null:u);return(0,kH.jsx)(c8e,{...n,ref:e,children:nf.isValidElement(a)?nf.cloneElement(a,void 0,s):null})}return(0,kH.jsx)(c8e,{...n,ref:e,children:r})});d8e.displayName="Slot";var c8e=nf.forwardRef((t,e)=>{let{children:r,...n}=t;if(nf.isValidElement(r)){let o=Bqn(r);return nf.cloneElement(r,{...$qn(n,r.props),ref:e?s8e(e,o):o})}return nf.Children.count(r)>1?nf.Children.only(null):null});c8e.displayName="SlotClone";var Fqn=({children:t})=>(0,kH.jsx)(kH.Fragment,{children:t});function kqn(t){return nf.isValidElement(t)&&t.type===Fqn}function $qn(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 Bqn(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 eir=j(ut(),1),Uqn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],f8e=Uqn.reduce((t,e)=>{let r=Qor.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?d8e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,eir.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var k1=j(ut(),1),p8e="Checkbox",[qqn,fUi]=Xa(p8e),[Hqn,Vqn]=qqn(p8e),tir=wg.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]=wg.useState(null),h=Vor(e,S=>p(S)),m=wg.useRef(!1),g=f?c||!!f.closest("form"):!0,[y=!1,_]=Qp({prop:o,defaultProp:i,onChange:l}),w=wg.useRef(y);return wg.useEffect(()=>{let S=f?.form;if(S){let C=()=>_(w.current);return S.addEventListener("reset",C),()=>S.removeEventListener("reset",C)}},[f,_]),(0,k1.jsxs)(Hqn,{scope:r,state:y,disabled:s,children:[(0,k1.jsx)(f8e.button,{type:"button",role:"checkbox","aria-checked":F1(y)?"mixed":y,"aria-required":a,"data-state":oir(y),"data-disabled":s?"":void 0,disabled:s,value:u,...d,ref:h,onKeyDown:l8e(t.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:l8e(t.onClick,S=>{_(C=>F1(C)?!0:!C),g&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})}),g&&(0,k1.jsx)(Wqn,{control:f,bubbles:!m.current,name:n,value:u,checked:y,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"},defaultChecked:F1(i)?!1:i})]})});tir.displayName=p8e;var rir="CheckboxIndicator",nir=wg.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=Vqn(rir,r);return(0,k1.jsx)(rf,{present:n||F1(i.state)||i.state===!0,children:(0,k1.jsx)(f8e.span,{"data-state":oir(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});nir.displayName=rir;var Wqn=t=>{let{control:e,checked:r,bubbles:n=!0,defaultChecked:o,...i}=t,a=wg.useRef(null),s=pbe(r),u=L1(e);wg.useEffect(()=>{let c=a.current,d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(s!==r&&p){let h=new Event("click",{bubbles:n});c.indeterminate=F1(r),p.call(c,F1(r)?!1:r),c.dispatchEvent(h)}},[s,r,n]);let l=wg.useRef(F1(r)?!1:r);return(0,k1.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 F1(t){return t==="indeterminate"}function oir(t){return F1(t)?"indeterminate":t?"checked":"unchecked"}var m8e=tir,iir=nir;fn();wn();var Cc=$H.forwardRef(({className:t,...e},r)=>$H.createElement(m8e,{ref:r,className:me("tw-border-solid !tw-bg-transparent tw-p-0 !tw-shadow tw-transition-colors","hover:!tw-bg-interactive-accent hover:!tw-text-on-accent data-[state=checked]:!tw-bg-interactive-accent data-[state=checked]:!tw-text-on-accent","tw-peer tw-size-4 tw-shrink-0 tw-rounded-sm tw-border tw-border-interactive-accent focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring disabled:tw-cursor-not-allowed disabled:tw-opacity-50",t),...e},$H.createElement(iir,{className:me("tw-flex tw-items-center tw-justify-center tw-text-current")},$H.createElement(Fc,{className:"tw-size-4"}))));Cc.displayName=m8e.displayName;var ob=j(X());wn();var W_=ob.forwardRef(({className:t,value:e,...r},n)=>{let o=ob.useRef(null),i=ob.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);ob.useLayoutEffect(()=>{i()},[e,i]),ob.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 ob.createElement("textarea",{className:me("tw-min-w-fit tw-resize-y tw-overflow-auto tw-border-solid","tw-flex tw-max-h-[300px] tw-min-h-[60px] tw-w-full tw-rounded-md tw-border tw-bg-transparent tw-px-3 tw-py-2 tw-text-base tw-shadow-sm placeholder:tw-text-muted focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring disabled:tw-cursor-not-allowed disabled:tw-opacity-50 md:tw-text-sm",t),value:e,ref:a,onChange:s=>{i(),r.onChange?.(s)},onInput:i,onCompositionEnd:i,onPaste:()=>{setTimeout(i,0)},...r})});W_.displayName="Textarea";var hi=j(X()),fir=j(Lc());bt();var LO=j(X());fr();fn();nr();var h8e=({capabilities:t=[],iconSize:e=16})=>LO.default.createElement(LO.default.Fragment,null,t.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return LO.default.createElement(zE,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return LO.default.createElement($E,{key:n,className:"tw-text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return LO.default.createElement(BE,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),g8e=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return LO.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},LO.default.createElement("span",{className:"tw-text-sm hover:tw-text-normal"},r),t.capabilities&&t.capabilities.length>0&&LO.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-0.5"},LO.default.createElement(h8e,{capabilities:t.capabilities,iconSize:e})))},hbe=t=>{let e=t.displayName||t.name,r=`(${Ap(t.provider)})`;return`${e} ${r}`},BH=t=>{let e=t.displayName||t.name,r=`(${Ap(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}`};wn();fn();Kt();var FO=j(X());function air(){return FO.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},FO.default.createElement("li",null,FO.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{}")," represents the selected text."),FO.default.createElement("li",null,FO.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),FO.default.createElement("li",null,FO.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),FO.default.createElement("li",null,FO.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{#tag1, #tag2}")," represents ALL notes with ANY of the specified tags in their property (an OR operation)."))}var y8e="{copilot-selection}";var zH="copilotquickcommand",kO={title:"",content:"",showInContextMenu:!0,showInSlashMenu:!0,order:0,modelKey:"",lastUsedMs:0},XT="copilot-command-context-menu-enabled",QT="copilot-command-slash-enabled",$O="copilot-command-context-menu-order",eA="copilot-command-model-key",tA="copilot-command-last-used",sir=[{title:"Fix grammar and spelling",content:"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,showInSlashMenu:!0,order:1e3,modelKey:"",lastUsedMs:0},{title:"Translate to Chinese",content:`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,showInSlashMenu:!0,order:1010,modelKey:"",lastUsedMs:0},{title:"Summarize",content:"Create a bullet-point summary of {}. Each bullet point should capture a key point. Return only the bullet-point summary.",showInContextMenu:!0,showInSlashMenu:!0,order:1020,modelKey:"",lastUsedMs:0},{title:"Simplify",content:"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,showInSlashMenu:!0,order:1030,modelKey:"",lastUsedMs:0},{title:"Explain like I am 5",content:`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:!0,showInSlashMenu:!0,order:1040,modelKey:"",lastUsedMs:0},{title:"Emojify",content:`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,showInSlashMenu:!0,order:1050,modelKey:"",lastUsedMs:0},{title:"Make shorter",content:`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,showInSlashMenu:!0,order:1060,modelKey:"",lastUsedMs:0},{title:"Make longer",content:`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,showInSlashMenu:!0,order:1070,modelKey:"",lastUsedMs:0},{title:"Generate table of contents",content:"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,showInSlashMenu:!1,order:1080,modelKey:"",lastUsedMs:0},{title:"Generate glossary",content:'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,showInSlashMenu:!1,order:1090,modelKey:"",lastUsedMs:0},{title:"Remove URLs",content:"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,showInSlashMenu:!1,order:1100,modelKey:"",lastUsedMs:0},{title:"Rewrite as tweet",content:`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,showInSlashMenu:!1,order:1110,modelKey:"",lastUsedMs:0},{title:"Rewrite as tweet thread",content:`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,showInSlashMenu:!1,order:1120,modelKey:"",lastUsedMs:0}];var UH=require("obsidian");bt();t8();t8();var Qk=HB(),e$=Ih([]),b8e=new Set;function t$(t){b8e.add(t)}function r$(t){b8e.delete(t)}function kZ(t){return b8e.has(t)}function $Z(t){let e=Qk.get(e$);Qk.set(e$,e.filter(r=>r.title!==t))}function n$(t,e){let r=Qk.get(e$),n;(e?r.findIndex(i=>i.title===e):-1)!==-1?n=r.map(i=>i.title===e?t:i):n=[...r,t],Qk.set(e$,n)}function gbe(t){Qk.set(e$,t)}function uir(){return e8(e$,{store:Qk})}function ap(){return Qk.get(e$)}u8();fr();nr();function ybe(t,e,r){let n=t.trim();return r&&n===r?null:n?/[#<>:"/\\|?*[\]^\x00-\x1F]/g.test(n)?'Command name contains invalid characters. Avoid using: < > : " / \\ | ? * [ ] ^':e.some(i=>i.title.toLowerCase()===n.toLowerCase())?"A command with this name already exists":null:"Command name cannot be empty"}function qH(t){return encodeURIComponent(t.toLowerCase())}function $1(){return(0,UH.normalizePath)(oe().customPromptsFolder)}function HH(t){return`${$1()}/${t}.md`}function VH(t){if(!(t instanceof UH.TFile)||t.extension!=="md")return!1;let e=$1();return!(!t.path.startsWith(e+"/")||t.path.slice(e.length+1).includes("/"))}function Gqn(t){if(t.startsWith("---")){let e=t.indexOf("---",3);if(e!==-1)return t.slice(e+3).trimStart()}return t}function lir(t){return app.metadataCache.getFileCache(t)?.frontmatter?.[$O]!=null}async function BZ(t){let e=await app.vault.read(t),r=Gqn(e),n=app.metadataCache.getFileCache(t),o=n?.frontmatter?.[XT]??kO.showInContextMenu,i=n?.frontmatter?.[QT]??kO.showInSlashMenu,a=n?.frontmatter?.[tA]??kO.lastUsedMs,s=n?.frontmatter?.[$O]??kO.order,u=n?.frontmatter?.[eA]??kO.modelKey;return{title:t.basename,modelKey:u,content:r,showInContextMenu:o,showInSlashMenu:i,order:s,lastUsedMs:a}}async function bbe(){let t=app.vault.getFiles().filter(r=>VH(r)),e=await Promise.all(t.map(BZ));return gbe(e),e}function zZ(t){return[...t].sort((e,r)=>e.order===r.order?e.title.localeCompare(r.title):e.order-r.order)}function Jqn(t){return[...t].sort((e,r)=>e.lastUsedMs===r.lastUsedMs?e.title.localeCompare(r.title):r.lastUsedMs-e.lastUsedMs)}function Zqn(t){return[...t].sort((e,r)=>e.title.localeCompare(r.title))}function _be(t){switch(oe().promptSortStrategy){case"timestamp":return Jqn(t);case"alphabetical":return Zqn(t);case"manual":return zZ(t);default:return t}}async function _8e(t,e,r=!1){let o=(await v8e(t,e,app.vault,app.workspace.getActiveFile())).processedPrompt;if(o.includes(`{${Em}}`)||r)return o;let i=o.indexOf(y8e);return i===-1&&e.trim()?o+`
<`+Em+">"+e+"</"+Em+">":o.slice(0,i)+e+o.slice(i+y8e.length)}var Yqn=/\{(?!copilot-selection\})([^}]+)\}/g;async function Xqn(t,e,r){let n=new Map,o=new Set,i;for(;(i=Yqn.exec(t))!==null;){let a=i[1].trim(),s={content:"",files:[]};if(a.toLowerCase()==="activenote")if(r){let u=await JB(r,e);u&&(s.content=`<${Oj}>
## ${gee(r)}
${u}
</${Oj}>`,s.files.push(r))}else new UH.Notice("No active note found.");else if(a.startsWith("#")){let u=a.slice(1).split(",").map(d=>d.trim()),l=await Tet(e,u),c=[];for(let d of l){let f=await JB(d,e);f&&(c.push(`<${Oj}>
## ${gee(d)}
${f}
</${Oj}>`),s.files.push(d))}s.content=c.join(`
`)}else{let u=Met(a),l=await WSe(e,u),c=[];for(let d of l){let f=await JB(d,e);f&&(c.push(`<${Oj}>
## ${gee(d)}
${f}
</${Oj}>`),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"&&(a.startsWith('"')||console.warn(`No notes found for variable: ${a}`))}return{variablesMap:n,includedFiles:o}}async function v8e(t,e,r,n){let o=oe(),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 Xqn(t,r,n);s.forEach(f=>i.add(f));let u=t,l="",c=null;u.includes("{}")&&(u=u.replace(/\{\}/g,`{${Em}}`),e?l+=`<${Em}>
${e}
</${Em}>`:n?(c=await JB(n,r),l+=`<${Em} type="active_note">
${c||""}
</${Em}>`,i.add(n)):l+=`<${Em}>
(No selected text or active note available)
</${Em}>`);for(let[f,p]of a.entries())f.toLowerCase()==="activenote"&&c!==null||(l?l+=`
<${c8} name="${f}">
${p}
</${c8}>`:l+=`<${c8} name="${f}">
${p}
</${c8}>`);let d=Hg(u,r);for(let f of d)if(!i.has(f)){let p=await JB(f,r);if(p){let h=await r.adapter.stat(f.path),m=h?new Date(h.ctime).toISOString():"Unknown",g=h?new Date(h.mtime).toISOString():"Unknown",y=`<${l8}>
<title>${f.basename}</title>
<path>${f.path}</path>
<ctime>${m}</ctime>
<mtime>${g}</mtime>
<content>
${p}
</content>
</${l8}>`;l&&(l+=`
`),l+=`${y}`,i.add(f)}}return{processedPrompt:l?`${u}
${l}`:`${u}
`,includedFiles:Array.from(i)}}function cir(t,e){let n=`${t} (copy)`,o=1;for(;e.some(i=>i.title.toLowerCase()===n.toLowerCase());)o++,n=`${t} (copy ${o})`;return n}function vbe(){let e=ap().reduce((r,n)=>r>n.order?r:n.order,0);return e===Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+10}async function w8e(t,e){try{t$(t.path),await app.fileManager.processFrontMatter(t,r=>{r[XT]==null&&(r[XT]=e.showInContextMenu),r[QT]==null&&(r[QT]=e.showInSlashMenu),r[$O]==null&&(r[$O]=e.order),r[eA]==null&&(r[eA]=e.modelKey),r[tA]==null&&(r[tA]=e.lastUsedMs)})}finally{r$(t.path)}}function wbe(t){let e=t.getCursor("from"),r=t.getCursor("to"),o=t.getValue().split(`
`),i=!1,a=[],s=0,u=0,l=0;for(;l<o.length;)if(o[l].trim()===`\`\`\`${zH}`){i=!0;let c=l;for(l++;l<o.length&&o[l].trim()!=="```";)l++;l++;let d=l-c;c<=e.line&&(s+=d),c<=r.line&&(u+=d)}else a.push(o[l]),l++;if(i){t.setValue(a.join(`
`));let c=Math.max(0,e.line-s),d=Math.max(0,r.line-u);t.setSelection({line:c,ch:e.ch},{line:d,ch:r.ch})}return i}function Qqn({commands:t,command:e,onConfirm:r,onCancel:n}){let i=_n().activeModels.filter(f=>f.enabled).map(f=>({label:hbe(f),value:en(f)})),[a,s]=(0,hi.useState)(e),[u,l]=(0,hi.useState)({}),c=(f,p)=>{s(h=>({...h,[f]:p})),l(h=>({...h,[f]:void 0}))},d=()=>{let f={},p=ybe(a.title,t,e.title);if(p&&(f.title=p),a.content.trim()||(f.content="Prompt is required"),Object.keys(f).length>0){l(f);return}r(a)};return hi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},hi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},hi.default.createElement(Xp,{htmlFor:"title"},"Name"),hi.default.createElement(mi,{id:"title",value:a.title,onChange:f=>c("title",f.target.value),placeholder:"Enter command name"}),u.title&&hi.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.title)),hi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},hi.default.createElement(Xp,{htmlFor:"content"},"Prompt"),hi.default.createElement(air,null),hi.default.createElement(W_,{id:"content",value:a.content,onChange:f=>c("content",f.target.value),placeholder:"Enter command prompt",className:"tw-min-h-[200px]"}),u.content&&hi.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.content)),hi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},hi.default.createElement(Xp,{htmlFor:"modelKey"},"Model (Optional)"),hi.default.createElement("div",{className:"tw-group tw-relative tw-w-full"},hi.default.createElement("select",{value:a.modelKey,onChange:f=>{let p=f.target.value;if(!p){c("modelKey","");return}if(!i.find(m=>m.value===p)){ie(`Model ${p} not found`),c("modelKey","");return}c("modelKey",f.target.value)},className:me("tw-w-full tw-appearance-none","tw-flex tw-h-9 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-dropdown tw-px-3 tw-py-1 tw-pr-8","tw-text-sm !tw-shadow tw-transition-colors","focus:tw-outline-none focus:tw-ring-1 focus:tw-ring-ring","disabled:tw-cursor-not-allowed disabled:tw-opacity-50","hover:tw-bg-interactive-hover hover:tw-text-normal")},hi.default.createElement("option",{value:""},"Inherit from chat model"),i.map(f=>hi.default.createElement("option",{key:f.value,value:f.value.toString()},f.label))),hi.default.createElement("div",{className:me("tw-pointer-events-none tw-absolute tw-inset-y-0 tw-right-0 tw-flex tw-items-center tw-pr-2","tw-transition-colors group-hover:[&>svg]:tw-text-normal")},hi.default.createElement(Li,{className:"tw-size-4"})))),hi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},hi.default.createElement(Cc,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),hi.default.createElement(Xp,{htmlFor:"showInContextMenu"},"Show in context menu")),hi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},hi.default.createElement(Cc,{id:"showInSlashMenu",checked:a.showInSlashMenu,onCheckedChange:f=>c("showInSlashMenu",f)}),hi.default.createElement(Xp,{htmlFor:"showInSlashMenu"},"Show in slash menu")),hi.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},hi.default.createElement(he,{variant:"secondary",onClick:n},"Cancel"),hi.default.createElement(he,{variant:"default",onClick:d},"Save")))}var o$=class extends dir.Modal{constructor(r,n,o,i){super(r);this.commands=n;this.command=o;this.onUpdate=i;this.setTitle("Edit Command")}onOpen(){let{contentEl:r}=this;this.root=(0,fir.createRoot)(r);let n=o=>{this.onUpdate(o),this.close()};this.root.render(hi.default.createElement(Qqn,{commands:this.commands,command:this.command,onConfirm:n,onCancel:()=>this.close()}))}onClose(){this.root.unmount()}};var UZ=require("obsidian");vE();var Oc=class t{static getInstance(){return t.instance||(t.instance=new t),t.instance}async createCommand(e,r={}){let n={skipStoreUpdate:!1,autoOrder:!0,...r},o=HH(e.title);try{t$(o);let i=e.order;n.autoOrder&&(i=vbe()),e={...e,order:i};let a=$1();await app.vault.adapter.exists(a)||await app.vault.createFolder(a);let u=app.vault.getAbstractFileByPath(o);!u||!(u instanceof UZ.TFile)?u=await app.vault.create(o,e.content):await app.vault.modify(u,e.content),await app.fileManager.processFrontMatter(u,l=>{l[XT]=e.showInContextMenu,l[QT]=e.showInSlashMenu,l[$O]=e.order,l[eA]=e.modelKey,l[tA]=e.lastUsedMs}),n.skipStoreUpdate||n$(e,e.title)}finally{r$(o)}}async recordUsage(e){this.updateCommand({...e,lastUsedMs:Date.now()},e.title)}async updateCommand(e,r,n=!1){let o=HH(e.title),i=HH(r),a=e.title!==r;try{t$(o),a&&t$(i),n||n$(e,r);let s=app.vault.getAbstractFileByPath(o);if(a){if(app.vault.getAbstractFileByPath(o))throw new tn("Error saving custom prompt. Please check if the title already exists.");let l=app.vault.getAbstractFileByPath(i);l instanceof UZ.TFile&&(await app.vault.rename(l,o),s=app.vault.getAbstractFileByPath(o))}s||(await this.createCommand(e,{skipStoreUpdate:n,autoOrder:!0}),s=app.vault.getAbstractFileByPath(HH(e.title))),s instanceof UZ.TFile&&(await app.vault.modify(s,e.content),await app.fileManager.processFrontMatter(s,u=>{u[XT]=e.showInContextMenu,u[QT]=e.showInSlashMenu,u[$O]=e.order,u[eA]=e.modelKey,u[tA]=e.lastUsedMs}))}finally{r$(o),a&&r$(i)}}async updateCommands(e){gbe(e),await Promise.all(e.map(r=>this.updateCommand(r,r.title,!0)))}async reorderCommands(e){let r=[...e];for(let n=0;n<r.length;n++)r[n]={...r[n],order:n*10};await this.updateCommands(r)}async deleteCommand(e){let r=HH(e.title);try{t$(r),$Z(e.title);let n=app.vault.getAbstractFileByPath(r);n instanceof UZ.TFile&&await app.vault.delete(n)}finally{r$(r)}}};var Sbe=require("obsidian");sa();vo();Xge();Kt();fr();VA();Om();W6e();fn();var K_=require("obsidian"),Nt=j(X()),pir=j(Lc());bt();function e2n(t,e){let[r]=(0,Nt.useState)(new IZ({returnMessages:!0,memoryKey:"history"})),[n,o]=(0,Nt.useState)(null);return(0,Nt.useEffect)(()=>{async function i(){let a=await c1.getInstance().createModelInstance(t),u=Cm.fromMessages([HA.fromTemplate(e||"You are a helpful assistant. You'll help the user with their content editing needs."),new Ov("history"),Ev.fromTemplate("{input}")]),l=ji.from([{input:c=>c.input,memory:()=>r.loadMemoryVariables({})},{input:c=>c.input,history:c=>c.memory.history},u,a]);o(l)}i()},[t,r,e]),{chatChain:n,chatMemory:r}}function t2n({originalText:t,command:e,onInsert:r,onReplace:n,systemPrompt:o}){let[i,a]=(0,Nt.useState)(null),[s,u]=(0,Nt.useState)(null),[l,c]=(0,Nt.useState)(""),d=(0,Nt.useRef)(null),f=(0,Nt.useRef)(null),[p,h]=(0,Nt.useState)(!0),[m]=QA(),g=_n(),y=(0,Nt.useMemo)(()=>bee(e.modelKey||m,g.activeModels),[e.modelKey,m,g.activeModels]),{chatChain:_,chatMemory:w}=e2n(y,o),S=e.title,C=(0,Nt.useCallback)(async(M,D)=>{if(!_)return console.error("Chat chain not initialized"),new K_.Notice("Chat engine not ready. Please try again."),h(!1),null;try{a(null),u(null),h(!0);let k="",K=await _.bind({signal:D.signal}).stream({input:M});for await(let U of K){if(D.signal.aborted)break;let Y=typeof U.content=="string"?U.content:"";k+=Y,a(k)}if(!D.signal.aborted){let U=k.trim();return u(U),h(!1),await w.saveContext({input:M},{output:U}),U}return null}catch(k){return ie("Error generating response:",k),h(!1),null}},[_,w]);(0,Nt.useEffect)(()=>{let M=new AbortController;E.current=M;async function D(){if(_)try{let k=await _8e(e.content,t);await C(k,M)}catch(k){ie("Error in initial response:",k),h(!1)}}return D(),()=>{M.abort()}},[e.content,t,_,C]);let E=(0,Nt.useRef)(null),P=async()=>{if(!l.trim()||!_){_||new K_.Notice("Chat engine not ready. Please try again.");return}let M=new AbortController;E.current=M;let D=await _8e(l,t,!0);try{await C(D,M)&&c("")}finally{M.signal.aborted&&(h(!1),u(i??"")),E.current=null}},T=()=>{E.current&&(E.current.abort(),E.current=null,h(!1))},I=M=>{M.nativeEvent.isComposing||(!p&&s&&!N&&(M.key==="Enter"&&(K_.Platform.isMacOS?M.metaKey:M.ctrlKey)&&!M.shiftKey&&(M.preventDefault(),n(s)),M.key==="Enter"&&(K_.Platform.isMacOS?M.metaKey:M.ctrlKey)&&M.shiftKey&&(M.preventDefault(),r(s))),N&&M.key==="Enter"&&!M.shiftKey&&!M.metaKey&&!M.ctrlKey&&(M.preventDefault(),P()))};(0,Nt.useEffect)(()=>{if(d.current&&i&&p){let M=d.current;M.scrollTop=M.scrollHeight}},[i,p]);let N=!p&&l.trim().length>0;return Nt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4",onKeyDown:I},Nt.default.createElement("div",{className:"tw-max-h-60 tw-overflow-y-auto tw-whitespace-pre-wrap tw-text-muted"},t),Nt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},S&&Nt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-font-bold tw-text-normal"},Nt.default.createElement(Uv,{className:"tw-size-4"}),S)),Nt.default.createElement("div",{className:"tw-group tw-relative"},Nt.default.createElement("textarea",{ref:d,className:"tw-peer tw-h-60 tw-w-full tw-text-text",value:s??i??"loading...",disabled:s==null,onChange:M=>u(M.target.value)}),s&&Nt.default.createElement("button",{className:"tw-absolute tw-right-2 tw-top-2 tw-opacity-0 tw-transition-opacity group-hover:tw-opacity-100 peer-focus-visible:!tw-opacity-0",onClick:()=>{navigator.clipboard.writeText(s),new K_.Notice("Copied to clipboard")}},Nt.default.createElement($h,{className:"tw-size-4 hover:tw-text-accent"}))),!p&&s&&Nt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Nt.default.createElement("textarea",{autoFocus:!0,ref:f,className:"tw-h-20 tw-w-full tw-text-text",placeholder:"Enter follow-up instructions...",value:l,onChange:M=>c(M.target.value)})),Nt.default.createElement("div",{className:"tw-flex tw-justify-between tw-gap-2"},Nt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs tw-font-bold tw-text-faint"},Nt.default.createElement(Jj,{className:"tw-size-4"}),hbe(y)),Nt.default.createElement("div",{className:"tw-flex tw-gap-2"},p?Nt.default.createElement(he,{size:"sm",variant:"secondary",onClick:T},"Stop"):N?Nt.default.createElement(he,{size:"sm",onClick:P,className:"tw-flex tw-items-center tw-gap-1"},Nt.default.createElement("span",null,"Submit"),Nt.default.createElement(Ub,{className:"tw-size-3"})):Nt.default.createElement(Nt.default.Fragment,null,Nt.default.createElement(he,{size:"sm",onClick:()=>r(s??""),className:"tw-flex tw-items-center tw-gap-1"},Nt.default.createElement("span",null,"Insert"),Nt.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs"},K_.Platform.isMacOS?Nt.default.createElement(Nt.default.Fragment,null,Nt.default.createElement(EI,{className:"tw-size-3"}),Nt.default.createElement(Uz,{className:"tw-size-3"}),Nt.default.createElement(Ub,{className:"tw-size-3"})):Nt.default.createElement(Nt.default.Fragment,null,Nt.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Nt.default.createElement(Uz,{className:"tw-size-3"}),Nt.default.createElement(Ub,{className:"tw-size-3"})))),Nt.default.createElement(he,{size:"sm",onClick:()=>n(s??""),className:"tw-flex tw-items-center tw-gap-1"},Nt.default.createElement("span",null,"Replace"),Nt.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs"},K_.Platform.isMacOS?Nt.default.createElement(Nt.default.Fragment,null,Nt.default.createElement(EI,{className:"tw-size-3"}),Nt.default.createElement(Ub,{className:"tw-size-3"})):Nt.default.createElement(Nt.default.Fragment,null,Nt.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Nt.default.createElement(Ub,{className:"tw-size-3"}))))))))}var B1=class extends K_.Modal{constructor(r,n){super(r);this.configs=n}onOpen(){let{contentEl:r}=this;this.root=(0,pir.createRoot)(r);let{selectedText:n,command:o,systemPrompt:i}=this.configs,a=u=>{i8(u),this.close()},s=u=>{i8(u,!0),this.close()};this.root.render(Nt.default.createElement(t2n,{originalText:n,command:o,onInsert:a,onReplace:s,systemPrompt:i}))}onClose(){this.root.unmount()}};var xbe=class extends Sbe.FuzzySuggestModal{constructor(e){super(e),this.setPlaceholder("Select a custom command to apply...");let r=ap();this.commands=_be(r)}onOpen(){super.onOpen(),this.commands.length===0&&this.setInstructions([{command:"",purpose:"No custom commands found. Create some custom commands first in the settings."}])}getItems(){return this.commands}getItemText(e){return e.title}onChooseItem(e,r){let n=this.app.workspace.getActiveViewOfType(Sbe.MarkdownView);if(!n||!n.editor){this.openCommandModal(e,"");return}let o=n.editor.getSelection();this.openCommandModal(e,o)}openCommandModal(e,r){Oc.getInstance().recordUsage(e),new B1(this.app,{selectedText:r,command:e}).open()}};th();bt();fr();var Xi=require("obsidian");LN();nr();function hh(t,e,r){t.addCommand({id:e,name:See[e],callback:r})}function mir(t,e,r){t.addCommand({id:e,name:See[e],editorCallback:r})}function r2n(t,e,r){t.addCommand({id:e,name:See[e],checkCallback:r})}function x8e(t,e,r){mir(t,dn.COUNT_WORD_AND_TOKENS_SELECTION,async n=>{let o=await n.getSelection(),i=o.split(" ").length,a=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(o);new Xi.Notice(`Selected text contains ${i} words and ${a} tokens.`)}),hh(t,dn.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let n=await eze(t.app),o=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(n);new Xi.Notice(`Total tokens in your vault: ${o}`)}catch(n){ie("Error counting tokens: ",n),new Xi.Notice("An error occurred while counting tokens.")}}),hh(t,dn.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),hh(t,dn.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),hh(t,dn.NEW_CHAT,()=>{t.newChat()}),r2n(t,dn.TRIGGER_QUICK_COMMAND,n=>{let o=t.app.workspace.getActiveViewOfType(Xi.MarkdownView);if(n)return!!(!QSe()&&o&&o.editor);if(QSe())return new Xi.Notice("Quick command is not available in source mode."),!1;if(!o||!o.editor)return new Xi.Notice("No active editor found."),!1;let i=o.editor;if(!i.getSelection().trim())return new Xi.Notice("Please select some text first. Selected text is required for quick commands."),!1;wbe(i);let u=i.getCursor("from").line,l=`\`\`\`${zH}
\`\`\`
`;return i.replaceRange(l,{line:u,ch:0}),!0}),hh(t,dn.CLEAR_LOCAL_COPILOT_INDEX,async()=>{try{await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().clearIndex(),new Xi.Notice("Cleared local Copilot semantic index.")}catch(n){ie("Error clearing semantic index:",n),new Xi.Notice("Failed to clear semantic index.")}}),hh(t,dn.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let o=await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().garbageCollectVectorStore();new Xi.Notice(`Garbage collection completed. Removed ${o} stale documents.`)}catch(n){ie("Error during garbage collection:",n),new Xi.Notice("Failed to garbage collect semantic index.")}}),hh(t,dn.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(bt(),r8));if(n().enableSemanticSearchV3){let a=await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().indexVaultToVectorStore(!1);new Xi.Notice(`Semantic search index refreshed with ${a} documents.`)}else new Xi.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(n){ie("Error building index:",n),new Xi.Notice("An error occurred while building the index.")}}),hh(t,dn.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(bt(),r8));if(n().enableSemanticSearchV3){let a=await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().indexVaultToVectorStore(!0);new Xi.Notice(`Semantic search index rebuilt with ${a} documents.`)}else new Xi.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(n){ie("Error rebuilding index:",n),new Xi.Notice("An error occurred while rebuilding the index.")}}),hh(t,dn.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),hh(t,dn.LIST_INDEXED_FILES,async()=>{try{let o=await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().getIndexedFiles(),{getMatchingPatterns:i,shouldIndexFile:a}=await Promise.resolve().then(()=>(th(),E3t)),{inclusions:s,exclusions:u}=i(),l=t.app.vault.getMarkdownFiles(),c=new Set,d=new Set,f=new Set,p=new Set(o);for(let w of l){if(!a(w,s,u)){f.add(w.path);continue}let S=await t.app.vault.cachedRead(w);!S||S.trim().length===0?c.add(w.path):p.has(w.path)||d.add(w.path)}let h=["# Copilot Files Status",`- Indexed files: ${p.size}`,`- Unindexed files: ${d.size}`,`- Empty files: ${c.size}`,`- Excluded files: ${f.size}`,"","## Indexed Files",...p.size>0?Array.from(p).sort().map(w=>`- [[${w}]]`):["No indexed files found."],"","## Unindexed Files",...d.size>0?Array.from(d).sort().map(w=>`- [[${w}]]`):["No unindexed files found."],"","## Empty Files",...c.size>0?Array.from(c).sort().map(w=>`- [[${w}]]`):["No empty files found."],"","## Excluded Files (based on settings)",...f.size>0?Array.from(f).sort().map(w=>`- [[${w}]]`):["No excluded files."]].join(`
`),g=`${`Copilot-Indexed-Files-${new Date().toLocaleDateString().replace(/\//g,"-")}.md`}`,y=t.app.vault.getAbstractFileByPath(g);y?await t.app.vault.modify(y,h):await t.app.vault.create(g,h);let _=t.app.vault.getAbstractFileByPath(g);_&&(await t.app.workspace.getLeaf().openFile(_),new Xi.Notice(`Listed ${p.size} indexed files`))}catch(n){ie("Error listing indexed files:",n),new Xi.Notice("Failed to list indexed files.")}}),hh(t,dn.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),await h_.getInstance().clearAllCache(),await c4.getInstance().clear();let{AutocompleteCache:o}=await Promise.resolve().then(()=>(K6e(),wor));o.getInstance().clear(),new Xi.Notice("All Copilot caches cleared successfully")}catch(n){ie("Error clearing Copilot caches:",n),new Xi.Notice("Failed to clear Copilot caches")}}),hh(t,dn.TOGGLE_AUTOCOMPLETE,()=>{let o=!oe().enableAutocomplete;ot("enableAutocomplete",o),new Xi.Notice(`Copilot autocomplete ${o?"enabled":"disabled"}`)}),mir(t,dn.ADD_SELECTION_TO_CHAT_CONTEXT,async n=>{let o=Jg();if(o!=="copilot_plus"&&o!=="project"){new Xi.Notice("Selected text context is only available in Copilot Plus and Project modes");return}let i=n.getSelection();if(!i){new Xi.Notice("No text selected");return}let a=t.app.workspace.getActiveFile();if(!a){new Xi.Notice("No active file");return}let s=n.listSelections()[0];if(!s){new Xi.Notice("Could not determine selection range");return}let u=s.anchor.line+1,l=s.head.line+1,c={id:lm(),content:i,noteTitle:a.basename,notePath:a.path,startLine:Math.min(u,l),endLine:Math.max(u,l)};gtt(c),t.activateView()}),hh(t,dn.ADD_CUSTOM_COMMAND,async()=>{let n=ap(),o={...kO};new o$(t.app,n,o,async a=>{await Oc.getInstance().createCommand(a)}).open()}),hh(t,dn.APPLY_CUSTOM_COMMAND,()=>{new xbe(t.app).open()})}sa();oc();oc();sa();function Cbe(){let[t]=Ip(),[e]=jee(),[r]=Dee();return(()=>{if(t!=="project")return"initial";let{total:o,success:i,failed:a,processingFiles:s}=r;return e||s.length>0?"loading":a.length>0?"error":o.length>0&&i.length===o.length?"success":"initial"})()}Kt();sa();tG();oc();vo();var hir=require("obsidian"),i$=j(X()),gir=j(Lc());function n2n({content:t,onConfirm:e,onCancel:r,confirmButtonText:n,cancelButtonText:o}){return i$.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-5"},i$.default.createElement("div",{className:"tw-whitespace-pre-wrap"},t),i$.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},o&&i$.default.createElement(he,{variant:"secondary",onClick:r},o),n&&i$.default.createElement(he,{variant:"default",onClick:e},n)))}var Ec=class extends hir.Modal{constructor(r,n,o,i,a="Continue",s="Cancel"){super(r);this.onConfirm=n;this.content=o;this.confirmButtonText=a;this.cancelButtonText=s;this.setTitle(i)}onOpen(){let{contentEl:r}=this;this.root=(0,gir.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(i$.default.createElement(n2n,{content:this.content,onConfirm:n,onCancel:o,confirmButtonText:this.confirmButtonText,cancelButtonText:this.cancelButtonText}))}onClose(){this.root.unmount()}};vo();var aa=j(X());var Pc=j(X(),1);function qZ(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var o2n=j(X(),1);function yir(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Obe(...t){return e=>{let r=!1,n=t.map(o=>{let i=yir(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():yir(t[o],null)}}}}var bir=j(X(),1),l2n=j(Ba(),1);var of=j(X(),1);var WH=j(ut(),1),C8e=of.forwardRef((t,e)=>{let{children:r,...n}=t,o=of.Children.toArray(r),i=o.find(a2n);if(i){let a=i.props.children,s=o.map(u=>u===i?of.Children.count(a)>1?of.Children.only(null):of.isValidElement(a)?a.props.children:null:u);return(0,WH.jsx)(S8e,{...n,ref:e,children:of.isValidElement(a)?of.cloneElement(a,void 0,s):null})}return(0,WH.jsx)(S8e,{...n,ref:e,children:r})});C8e.displayName="Slot";var S8e=of.forwardRef((t,e)=>{let{children:r,...n}=t;if(of.isValidElement(r)){let o=u2n(r);return of.cloneElement(r,{...s2n(n,r.props),ref:e?Obe(e,o):o})}return of.Children.count(r)>1?of.Children.only(null):null});S8e.displayName="SlotClone";var i2n=({children:t})=>(0,WH.jsx)(WH.Fragment,{children:t});function a2n(t){return of.isValidElement(t)&&t.type===i2n}function s2n(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 u2n(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 _ir=j(ut(),1),c2n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],vir=c2n.reduce((t,e)=>{let r=bir.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?C8e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,_ir.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var Qt=j(X(),1);function ma(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var U1=j(X(),1);var xir=j(X(),1);function wir(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function HZ(...t){return e=>{let r=!1,n=t.map(o=>{let i=wir(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():wir(t[o],null)}}}}function af(...t){return xir.useCallback(HZ(...t),t)}var sf=j(X(),1);var KH=j(ut(),1),z1=sf.forwardRef((t,e)=>{let{children:r,...n}=t,o=sf.Children.toArray(r),i=o.find(f2n);if(i){let a=i.props.children,s=o.map(u=>u===i?sf.Children.count(a)>1?sf.Children.only(null):sf.isValidElement(a)?a.props.children:null:u);return(0,KH.jsx)(O8e,{...n,ref:e,children:sf.isValidElement(a)?sf.cloneElement(a,void 0,s):null})}return(0,KH.jsx)(O8e,{...n,ref:e,children:r})});z1.displayName="Slot";var O8e=sf.forwardRef((t,e)=>{let{children:r,...n}=t;if(sf.isValidElement(r)){let o=m2n(r);return sf.cloneElement(r,{...p2n(n,r.props),ref:e?HZ(e,o):o})}return sf.Children.count(r)>1?sf.Children.only(null):null});O8e.displayName="SlotClone";var d2n=({children:t})=>(0,KH.jsx)(KH.Fragment,{children:t});function f2n(t){return sf.isValidElement(t)&&t.type===d2n}function p2n(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 m2n(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 Ebe=j(ut(),1);function Sir(t){let e=t+"CollectionProvider",[r,n]=Xa(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:h,children:m}=p,g=U1.default.useRef(null),y=U1.default.useRef(new Map).current;return(0,Ebe.jsx)(o,{scope:h,itemMap:y,collectionRef:g,children:m})};a.displayName=e;let s=t+"CollectionSlot",u=U1.default.forwardRef((p,h)=>{let{scope:m,children:g}=p,y=i(s,m),_=af(h,y.collectionRef);return(0,Ebe.jsx)(z1,{ref:_,children:g})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=U1.default.forwardRef((p,h)=>{let{scope:m,children:g,...y}=p,_=U1.default.useRef(null),w=af(h,_),S=i(l,m);return U1.default.useEffect(()=>(S.itemMap.set(_,{ref:_,...y}),()=>void S.itemMap.delete(_))),(0,Ebe.jsx)(z1,{[c]:"",ref:w,children:g})});d.displayName=l;function f(p){let h=i(t+"CollectionConsumer",p);return U1.default.useCallback(()=>{let g=h.collectionRef.current;if(!g)return[];let y=Array.from(g.querySelectorAll(`[${c}]`));return Array.from(h.itemMap.values()).sort((S,C)=>y.indexOf(S.ref.current)-y.indexOf(C.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var Pbe=j(X(),1),h2n=j(ut(),1),g2n=Pbe.createContext(void 0);function GH(t){let e=Pbe.useContext(g2n);return t||e||"ltr"}var xs=j(X(),1);var Cir=j(X(),1),Oir=j(Ba(),1);var Eir=j(ut(),1),y2n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ld=y2n.reduce((t,e)=>{let r=Cir.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?z1:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Eir.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Tbe(t,e){t&&Oir.flushSync(()=>t.dispatchEvent(e))}var Pir=j(X(),1);function q1(t,e=globalThis?.document){let r=un(t);Pir.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 P8e=j(ut(),1),b2n="DismissableLayer",E8e="dismissableLayer.update",_2n="dismissableLayer.pointerDownOutside",v2n="dismissableLayer.focusOutside",Tir,Iir=xs.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),T8e=xs.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=xs.useContext(Iir),[c,d]=xs.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=xs.useState({}),h=af(e,P=>d(P)),m=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),_=c?m.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=y,C=S2n(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=C2n(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return q1(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),xs.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Tir=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Air(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Tir)}},[c,f,r,l]),xs.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Air())},[c,l]),xs.useEffect(()=>{let P=()=>p({});return document.addEventListener(E8e,P),()=>document.removeEventListener(E8e,P)},[]),(0,P8e.jsx)(ld.div,{...u,ref:h,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:ma(t.onFocusCapture,E.onFocusCapture),onBlurCapture:ma(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ma(t.onPointerDownCapture,C.onPointerDownCapture)})});T8e.displayName=b2n;var w2n="DismissableLayerBranch",x2n=xs.forwardRef((t,e)=>{let r=xs.useContext(Iir),n=xs.useRef(null),o=af(e,n);return xs.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,P8e.jsx)(ld.div,{...t,ref:o})});x2n.displayName=w2n;function S2n(t,e=globalThis?.document){let r=un(t),n=xs.useRef(!1),o=xs.useRef(()=>{});return xs.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Mir(_2n,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 C2n(t,e=globalThis?.document){let r=un(t),n=xs.useRef(!1);return xs.useEffect(()=>{let o=i=>{i.target&&!n.current&&Mir(v2n,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 Air(){let t=new CustomEvent(E8e);document.dispatchEvent(t)}function Mir(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?Tbe(o,i):o.dispatchEvent(i)}var Nir=j(X(),1),A8e=0;function H1(){Nir.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Rir()),document.body.insertAdjacentElement("beforeend",t[1]??Rir()),A8e++,()=>{A8e===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),A8e--}},[])}function Rir(){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 ib=j(X(),1);var kir=j(ut(),1),I8e="focusScope.autoFocusOnMount",M8e="focusScope.autoFocusOnUnmount",jir={bubbles:!1,cancelable:!0},O2n="FocusScope",R8e=ib.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=ib.useState(null),l=un(o),c=un(i),d=ib.useRef(null),f=af(e,m=>u(m)),p=ib.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;ib.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:V1(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||V1(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let T of E)T.removedNodes.length>0&&V1(s)};var m=_,g=w,y=S;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(S);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),ib.useEffect(()=>{if(s){Lir.add(p);let m=document.activeElement;if(!s.contains(m)){let y=new CustomEvent(I8e,jir);s.addEventListener(I8e,l),s.dispatchEvent(y),y.defaultPrevented||(E2n(M2n($ir(s)),{select:!0}),document.activeElement===m&&V1(s))}return()=>{s.removeEventListener(I8e,l),setTimeout(()=>{let y=new CustomEvent(M8e,jir);s.addEventListener(M8e,c),s.dispatchEvent(y),y.defaultPrevented||V1(m??document.body,{select:!0}),s.removeEventListener(M8e,c),Lir.remove(p)},0)}}},[s,l,c,p]);let h=ib.useCallback(m=>{if(!r&&!n||p.paused)return;let g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){let _=m.currentTarget,[w,S]=P2n(_);w&&S?!m.shiftKey&&y===S?(m.preventDefault(),r&&V1(w,{select:!0})):m.shiftKey&&y===w&&(m.preventDefault(),r&&V1(S,{select:!0})):y===_&&m.preventDefault()}},[r,n,p.paused]);return(0,kir.jsx)(ld.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});R8e.displayName=O2n;function E2n(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(V1(n,{select:e}),document.activeElement!==r)return}function P2n(t){let e=$ir(t),r=Dir(e,t),n=Dir(e.reverse(),t);return[r,n]}function $ir(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 Dir(t,e){for(let r of t)if(!T2n(r,{upTo:e}))return r}function T2n(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 A2n(t){return t instanceof HTMLInputElement&&"select"in t}function V1(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&A2n(t)&&e&&t.select()}}var Lir=I2n();function I2n(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=Fir(t,e),t.unshift(e)},remove(e){t=Fir(t,e),t[0]?.resume()}}}function Fir(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function M2n(t){return t.filter(e=>e.tagName!=="A")}var Abe=j(X(),1);var R2n=Abe.useId||(()=>{}),N2n=0;function Wl(t){let[e,r]=Abe.useState(R2n());return yo(()=>{t||r(n=>n??String(N2n++))},[t]),t||(e?`radix-${e}`:"")}var xg=j(X(),1);var Bir=["top","right","bottom","left"];var BO=Math.min,em=Math.max,WZ=Math.round,KZ=Math.floor,G_=t=>({x:t,y:t}),j2n={left:"right",right:"left",bottom:"top",top:"bottom"},D2n={start:"end",end:"start"};function Mbe(t,e,r){return em(t,BO(e,r))}function zO(t,e){return typeof t=="function"?t(e):t}function UO(t){return t.split("-")[0]}function a$(t){return t.split("-")[1]}function Rbe(t){return t==="x"?"y":"x"}function Nbe(t){return t==="y"?"height":"width"}function rA(t){return["top","bottom"].includes(UO(t))?"y":"x"}function jbe(t){return Rbe(rA(t))}function zir(t,e,r){r===void 0&&(r=!1);let n=a$(t),o=jbe(t),i=Nbe(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=VZ(a)),[a,VZ(a)]}function Uir(t){let e=VZ(t);return[Ibe(t),e,Ibe(e)]}function Ibe(t){return t.replace(/start|end/g,e=>D2n[e])}function L2n(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 qir(t,e,r,n){let o=a$(t),i=L2n(UO(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(Ibe)))),i}function VZ(t){return t.replace(/left|right|bottom|top/g,e=>j2n[e])}function F2n(t){return{top:0,right:0,bottom:0,left:0,...t}}function N8e(t){return typeof t!="number"?F2n(t):{top:t,right:t,bottom:t,left:t}}function s$(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 Hir(t,e,r){let{reference:n,floating:o}=t,i=rA(e),a=jbe(e),s=Nbe(a),u=UO(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(a$(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var Kir=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}=Hir(l,n,u),f=n,p={},h=0;for(let m=0;m<s.length;m++){let{name:g,fn:y}=s[m],{x:_,y:w,data:S,reset:C}=await y({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,[g]:{...p[g],...S}},C&&h<=50&&(h++,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}=Hir(l,f,u)),m=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}};async function JH(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}=zO(e,t),h=N8e(p),g=s[f?d==="floating"?"reference":"floating":d],y=s$(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(g)))==null||r?g:g.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)),S=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=s$(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:w,strategy:u}):_);return{top:(y.top-C.top+h.top)/S.y,bottom:(C.bottom-y.bottom+h.bottom)/S.y,left:(y.left-C.left+h.left)/S.x,right:(C.right-y.right+h.right)/S.x}}var Gir=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}=zO(t,e)||{};if(l==null)return{};let d=N8e(c),f={x:r,y:n},p=jbe(o),h=Nbe(p),m=await a.getDimensions(l),g=p==="y",y=g?"top":"left",_=g?"bottom":"right",w=g?"clientHeight":"clientWidth",S=i.reference[h]+i.reference[p]-f[p]-i.floating[h],C=f[p]-i.reference[p],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l)),P=E?E[w]:0;(!P||!await(a.isElement==null?void 0:a.isElement(E)))&&(P=s.floating[w]||i.floating[h]);let T=S/2-C/2,I=P/2-m[h]/2-1,N=BO(d[y],I),M=BO(d[_],I),D=N,k=P-m[h]-M,F=P/2-m[h]/2+T,K=Mbe(D,F,k),U=!u.arrow&&a$(o)!=null&&F!==K&&i.reference[h]/2-(F<D?N:M)-m[h]/2<0,Y=U?F<D?F-D:F-k:0;return{[p]:f[p]+Y,data:{[p]:K,centerOffset:F-K-Y,...U&&{alignmentOffset:Y}},reset:U}}});var Jir=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:h="none",flipAlignment:m=!0,...g}=zO(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};let y=UO(o),_=rA(s),w=UO(s)===s,S=await(u.isRTL==null?void 0:u.isRTL(l.floating)),C=f||(w||!m?[VZ(s)]:Uir(s)),E=h!=="none";!f&&E&&C.push(...qir(s,m,h,S));let P=[s,...C],T=await JH(e,g),I=[],N=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&I.push(T[y]),d){let F=zir(o,a,S);I.push(T[F[0]],T[F[1]])}if(N=[...N,{placement:o,overflows:I}],!I.every(F=>F<=0)){var M,D;let F=(((M=i.flip)==null?void 0:M.index)||0)+1,K=P[F];if(K)return{data:{index:F,overflows:N},reset:{placement:K}};let U=(D=N.filter(Y=>Y.overflows[0]<=0).sort((Y,ee)=>Y.overflows[1]-ee.overflows[1])[0])==null?void 0:D.placement;if(!U)switch(p){case"bestFit":{var k;let Y=(k=N.filter(ee=>{if(E){let L=rA(ee.placement);return L===_||L==="y"}return!0}).map(ee=>[ee.placement,ee.overflows.filter(L=>L>0).reduce((L,Q)=>L+Q,0)]).sort((ee,L)=>ee[1]-L[1])[0])==null?void 0:k[0];Y&&(U=Y);break}case"initialPlacement":U=s;break}if(o!==U)return{reset:{placement:U}}}return{}}}};function Vir(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Wir(t){return Bir.some(e=>t[e]>=0)}var Zir=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=zO(t,e);switch(n){case"referenceHidden":{let i=await JH(e,{...o,elementContext:"reference"}),a=Vir(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Wir(a)}}}case"escaped":{let i=await JH(e,{...o,altBoundary:!0}),a=Vir(i,r.floating);return{data:{escapedOffsets:a,escaped:Wir(a)}}}default:return{}}}}};async function k2n(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=UO(r),s=a$(r),u=rA(r)==="y",l=["left","top"].includes(a)?-1:1,c=i&&u?-1:1,d=zO(e,t),{mainAxis:f,crossAxis:p,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof h=="number"&&(p=s==="end"?h*-1:h),u?{x:p*c,y:f*l}:{x:f*l,y:p*c}}var Yir=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 k2n(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}}}}},Xir=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:g=>{let{x:y,y:_}=g;return{x:y,y:_}}},...u}=zO(t,e),l={x:r,y:n},c=await JH(e,u),d=rA(UO(o)),f=Rbe(d),p=l[f],h=l[d];if(i){let g=f==="y"?"top":"left",y=f==="y"?"bottom":"right",_=p+c[g],w=p-c[y];p=Mbe(_,p,w)}if(a){let g=d==="y"?"top":"left",y=d==="y"?"bottom":"right",_=h+c[g],w=h-c[y];h=Mbe(_,h,w)}let m=s.fn({...e,[f]:p,[d]:h});return{...m,data:{x:m.x-r,y:m.y-n,enabled:{[f]:i,[d]:a}}}}}},Qir=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}=zO(t,e),c={x:r,y:n},d=rA(o),f=Rbe(d),p=c[f],h=c[d],m=zO(s,e),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(u){let w=f==="y"?"height":"width",S=i.reference[f]-i.floating[w]+g.mainAxis,C=i.reference[f]+i.reference[w]-g.mainAxis;p<S?p=S:p>C&&(p=C)}if(l){var y,_;let w=f==="y"?"width":"height",S=["top","left"].includes(UO(o)),C=i.reference[d]-i.floating[w]+(S&&((y=a.offset)==null?void 0:y[d])||0)+(S?0:g.crossAxis),E=i.reference[d]+i.reference[w]+(S?0:((_=a.offset)==null?void 0:_[d])||0)-(S?g.crossAxis:0);h<C?h=C:h>E&&(h=E)}return{[f]:p,[d]:h}}}},ear=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}=zO(t,e),c=await JH(e,l),d=UO(o),f=a$(o),p=rA(o)==="y",{width:h,height:m}=i.floating,g,y;d==="top"||d==="bottom"?(g=d,y=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(y=d,g=f==="end"?"top":"bottom");let _=m-c.top-c.bottom,w=h-c.left-c.right,S=BO(m-c[g],_),C=BO(h-c[y],w),E=!e.middlewareData.shift,P=S,T=C;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(T=w),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(P=_),E&&!f){let N=em(c.left,0),M=em(c.right,0),D=em(c.top,0),k=em(c.bottom,0);p?T=h-2*(N!==0||M!==0?N+M:em(c.left,c.right)):P=m-2*(D!==0||k!==0?D+k:em(c.top,c.bottom))}await u({...e,availableWidth:T,availableHeight:P});let I=await a.getDimensions(s.floating);return h!==I.width||m!==I.height?{reset:{rects:!0}}:{}}}};function Dbe(){return typeof window<"u"}function l$(t){return rar(t)?(t.nodeName||"").toLowerCase():"#document"}function gh(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function J_(t){var e;return(e=(rar(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function rar(t){return Dbe()?t instanceof Node||t instanceof gh(t).Node:!1}function ab(t){return Dbe()?t instanceof Element||t instanceof gh(t).Element:!1}function Z_(t){return Dbe()?t instanceof HTMLElement||t instanceof gh(t).HTMLElement:!1}function tar(t){return!Dbe()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof gh(t).ShadowRoot}function ZH(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=sb(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(o)}function nar(t){return["table","td","th"].includes(l$(t))}function GZ(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Lbe(t){let e=Fbe(),r=ab(t)?sb(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 oar(t){let e=nA(t);for(;Z_(e)&&!c$(e);){if(Lbe(e))return e;if(GZ(e))return null;e=nA(e)}return null}function Fbe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function c$(t){return["html","body","#document"].includes(l$(t))}function sb(t){return gh(t).getComputedStyle(t)}function JZ(t){return ab(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function nA(t){if(l$(t)==="html")return t;let e=t.assignedSlot||t.parentNode||tar(t)&&t.host||J_(t);return tar(e)?e.host:e}function iar(t){let e=nA(t);return c$(e)?t.ownerDocument?t.ownerDocument.body:t.body:Z_(e)&&ZH(e)?e:iar(e)}function u$(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=iar(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=gh(o);if(i){let s=kbe(a);return e.concat(a,a.visualViewport||[],ZH(o)?o:[],s&&r?u$(s):[])}return e.concat(o,u$(o,[],r))}function kbe(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function uar(t){let e=sb(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=Z_(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=WZ(r)!==i||WZ(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function D8e(t){return ab(t)?t:t.contextElement}function YH(t){let e=D8e(t);if(!Z_(e))return G_(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=uar(e),a=(i?WZ(r.width):r.width)/n,s=(i?WZ(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var $2n=G_(0);function lar(t){let e=gh(t);return!Fbe()||!e.visualViewport?$2n:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function B2n(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==gh(t)?!1:e}function d$(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=D8e(t),a=G_(1);e&&(n?ab(n)&&(a=YH(n)):a=YH(t));let s=B2n(i,r,n)?lar(i):G_(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=gh(i),p=n&&ab(n)?gh(n):n,h=f,m=kbe(h);for(;m&&n&&p!==h;){let g=YH(m),y=m.getBoundingClientRect(),_=sb(m),w=y.left+(m.clientLeft+parseFloat(_.paddingLeft))*g.x,S=y.top+(m.clientTop+parseFloat(_.paddingTop))*g.y;u*=g.x,l*=g.y,c*=g.x,d*=g.y,u+=w,l+=S,h=gh(m),m=kbe(h)}}return s$({width:c,height:d,x:u,y:l})}function L8e(t,e){let r=JZ(t).scrollLeft;return e?e.left+r:d$(J_(t)).left+r}function car(t,e,r){r===void 0&&(r=!1);let n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-(r?0:L8e(t,n)),i=n.top+e.scrollTop;return{x:o,y:i}}function z2n(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=J_(n),s=e?GZ(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=G_(1),c=G_(0),d=Z_(n);if((d||!d&&!i)&&((l$(n)!=="body"||ZH(a))&&(u=JZ(n)),Z_(n))){let p=d$(n);l=YH(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?car(a,u,!0):G_(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 U2n(t){return Array.from(t.getClientRects())}function q2n(t){let e=J_(t),r=JZ(t),n=t.ownerDocument.body,o=em(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=em(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+L8e(t),s=-r.scrollTop;return sb(n).direction==="rtl"&&(a+=em(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}function H2n(t,e){let r=gh(t),n=J_(t),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let l=Fbe();(!l||l&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}return{width:i,height:a,x:s,y:u}}function V2n(t,e){let r=d$(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=Z_(t)?YH(t):G_(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 aar(t,e,r){let n;if(e==="viewport")n=H2n(t,r);else if(e==="document")n=q2n(J_(t));else if(ab(e))n=V2n(e,r);else{let o=lar(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return s$(n)}function dar(t,e){let r=nA(t);return r===e||!ab(r)||c$(r)?!1:sb(r).position==="fixed"||dar(r,e)}function W2n(t,e){let r=e.get(t);if(r)return r;let n=u$(t,[],!1).filter(s=>ab(s)&&l$(s)!=="body"),o=null,i=sb(t).position==="fixed",a=i?nA(t):t;for(;ab(a)&&!c$(a);){let s=sb(a),u=Lbe(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||ZH(a)&&!u&&dar(t,a))?n=n.filter(c=>c!==a):o=s,a=nA(a)}return e.set(t,n),n}function K2n(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?GZ(e)?[]:W2n(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=aar(e,c,o);return l.top=em(d.top,l.top),l.right=BO(d.right,l.right),l.bottom=BO(d.bottom,l.bottom),l.left=em(d.left,l.left),l},aar(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function G2n(t){let{width:e,height:r}=uar(t);return{width:e,height:r}}function J2n(t,e,r){let n=Z_(e),o=J_(e),i=r==="fixed",a=d$(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=G_(0);if(n||!n&&!i)if((l$(e)!=="body"||ZH(o))&&(s=JZ(e)),n){let f=d$(e,!0,i,e);u.x=f.x+e.clientLeft,u.y=f.y+e.clientTop}else o&&(u.x=L8e(o));let l=o&&!n&&!i?car(o,s):G_(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 j8e(t){return sb(t).position==="static"}function sar(t,e){if(!Z_(t)||sb(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return J_(t)===r&&(r=r.ownerDocument.body),r}function far(t,e){let r=gh(t);if(GZ(t))return r;if(!Z_(t)){let o=nA(t);for(;o&&!c$(o);){if(ab(o)&&!j8e(o))return o;o=nA(o)}return r}let n=sar(t,e);for(;n&&nar(n)&&j8e(n);)n=sar(n,e);return n&&c$(n)&&j8e(n)&&!Lbe(n)?r:n||oar(t)||r}var Z2n=async function(t){let e=this.getOffsetParent||far,r=this.getDimensions,n=await r(t.floating);return{reference:J2n(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Y2n(t){return sb(t).direction==="rtl"}var par={convertOffsetParentRelativeRectToViewportRelativeRect:z2n,getDocumentElement:J_,getClippingRect:K2n,getOffsetParent:far,getElementRects:Z2n,getClientRects:U2n,getDimensions:G2n,getScale:YH,isElement:ab,isRTL:Y2n};function X2n(t,e){let r=null,n,o=J_(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=KZ(c),h=KZ(o.clientWidth-(l+d)),m=KZ(o.clientHeight-(c+f)),g=KZ(l),_={rootMargin:-p+"px "+-h+"px "+-m+"px "+-g+"px",threshold:em(0,BO(1,u))||1},w=!0;function S(C){let E=C[0].intersectionRatio;if(E!==u){if(!w)return a();E?a(!1,E):n=setTimeout(()=>{a(!1,1e-7)},1e3)}w=!1}try{r=new IntersectionObserver(S,{..._,root:o.ownerDocument})}catch{r=new IntersectionObserver(S,_)}r.observe(t)}return a(!0),i}function oA(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=D8e(t),c=o||i?[...l?u$(l):[],...u$(e)]:[];c.forEach(y=>{o&&y.addEventListener("scroll",r,{passive:!0}),i&&y.addEventListener("resize",r)});let d=l&&s?X2n(l,r):null,f=-1,p=null;a&&(p=new ResizeObserver(y=>{let[_]=y;_&&_.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 h,m=u?d$(t):null;u&&g();function g(){let y=d$(t);m&&(y.x!==m.x||y.y!==m.y||y.width!==m.width||y.height!==m.height)&&r(),m=y,h=requestAnimationFrame(g)}return r(),()=>{var y;c.forEach(_=>{o&&_.removeEventListener("scroll",r),i&&_.removeEventListener("resize",r)}),d?.(),(y=p)==null||y.disconnect(),p=null,u&&cancelAnimationFrame(h)}}var mar=Yir;var har=Xir,gar=Jir,yar=ear,bar=Zir,F8e=Gir;var _ar=Qir,k8e=(t,e,r)=>{let n=new Map,o={platform:par,...r},i={...o.platform,_c:n};return Kir(t,e,{...o,platform:i})};var Kl=j(X(),1),zbe=j(X(),1),xar=j(Ba(),1),$be=typeof document<"u"?zbe.useLayoutEffect:zbe.useEffect;function Bbe(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(!Bbe(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)&&!Bbe(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function Sar(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function war(t,e){let r=Sar(t);return Math.round(e*r)/r}function $8e(t){let e=Kl.useRef(t);return $be(()=>{e.current=t}),e}function W1(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]=Kl.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=Kl.useState(n);Bbe(f,n)||p(n);let[h,m]=Kl.useState(null),[g,y]=Kl.useState(null),_=Kl.useCallback(ee=>{ee!==E.current&&(E.current=ee,m(ee))},[]),w=Kl.useCallback(ee=>{ee!==P.current&&(P.current=ee,y(ee))},[]),S=i||h,C=a||g,E=Kl.useRef(null),P=Kl.useRef(null),T=Kl.useRef(c),I=u!=null,N=$8e(u),M=$8e(o),D=$8e(l),k=Kl.useCallback(()=>{if(!E.current||!P.current)return;let ee={placement:e,strategy:r,middleware:f};M.current&&(ee.platform=M.current),k8e(E.current,P.current,ee).then(L=>{let Q={...L,isPositioned:D.current!==!1};F.current&&!Bbe(T.current,Q)&&(T.current=Q,xar.flushSync(()=>{d(Q)}))})},[f,e,r,M,D]);$be(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(ee=>({...ee,isPositioned:!1})))},[l]);let F=Kl.useRef(!1);$be(()=>(F.current=!0,()=>{F.current=!1}),[]),$be(()=>{if(S&&(E.current=S),C&&(P.current=C),S&&C){if(N.current)return N.current(S,C,k);k()}},[S,C,k,N,I]);let K=Kl.useMemo(()=>({reference:E,floating:P,setReference:_,setFloating:w}),[_,w]),U=Kl.useMemo(()=>({reference:S,floating:C}),[S,C]),Y=Kl.useMemo(()=>{let ee={position:r,left:0,top:0};if(!U.floating)return ee;let L=war(U.floating,c.x),Q=war(U.floating,c.y);return s?{...ee,transform:"translate("+L+"px, "+Q+"px)",...Sar(U.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:L,top:Q}},[r,s,U.floating,c.x,c.y]);return Kl.useMemo(()=>({...c,update:k,refs:K,elements:U,floatingStyles:Y}),[c,k,K,U,Y])}var Q2n=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?F8e({element:n.current,padding:o}).fn(r):{}:n?F8e({element:n,padding:o}).fn(r):{}}}},K1=(t,e)=>({...mar(t),options:[t,e]}),G1=(t,e)=>({...har(t),options:[t,e]}),J1=(t,e)=>({..._ar(t),options:[t,e]}),Z1=(t,e)=>({...gar(t),options:[t,e]}),Y1=(t,e)=>({...yar(t),options:[t,e]});var X1=(t,e)=>({...bar(t),options:[t,e]});var Q1=(t,e)=>({...Q2n(t),options:[t,e]});var Car=j(X(),1);var B8e=j(ut(),1),e4n="Arrow",Oar=Car.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,B8e.jsx)(ld.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,B8e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Oar.displayName=e4n;var Ear=Oar;var eN=j(ut(),1);var z8e="Popper",[Par,U8e]=Xa(z8e),[r4n,Tar]=Par(z8e),Aar=t=>{let{__scopePopper:e,children:r}=t,[n,o]=xg.useState(null);return(0,eN.jsx)(r4n,{scope:e,anchor:n,onAnchorChange:o,children:r})};Aar.displayName=z8e;var Iar="PopperAnchor",Mar=xg.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=Tar(Iar,r),a=xg.useRef(null),s=af(e,a);return xg.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,eN.jsx)(ld.div,{...o,ref:s})});Mar.displayName=Iar;var q8e="PopperContent",[n4n,o4n]=Par(q8e),Rar=xg.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:h,...m}=t,g=Tar(q8e,r),[y,_]=xg.useState(null),w=af(e,Z=>_(Z)),[S,C]=xg.useState(null),E=L1(S),P=E?.width??0,T=E?.height??0,I=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},M=Array.isArray(l)?l:[l],D=M.length>0,k={padding:N,boundary:M.filter(a4n),altBoundary:D},{refs:F,floatingStyles:K,placement:U,isPositioned:Y,middlewareData:ee}=W1({strategy:"fixed",placement:I,whileElementsMounted:(...Z)=>oA(...Z,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[K1({mainAxis:o+T,alignmentAxis:a}),u&&G1({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?J1():void 0,...k}),u&&Z1({...k}),Y1({...k,apply:({elements:Z,rects:de,availableWidth:pe,availableHeight:ae})=>{let{width:Te,height:Ae}=de.reference,ke=Z.floating.style;ke.setProperty("--radix-popper-available-width",`${pe}px`),ke.setProperty("--radix-popper-available-height",`${ae}px`),ke.setProperty("--radix-popper-anchor-width",`${Te}px`),ke.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),S&&Q1({element:S,padding:s}),s4n({arrowWidth:P,arrowHeight:T}),f&&X1({strategy:"referenceHidden",...k})]}),[L,Q]=Dar(U),z=un(h);yo(()=>{Y&&z?.()},[Y,z]);let W=ee.arrow?.x,V=ee.arrow?.y,q=ee.arrow?.centerOffset!==0,[H,G]=xg.useState();return yo(()=>{y&&G(window.getComputedStyle(y).zIndex)},[y]),(0,eN.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:Y?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[ee.transformOrigin?.x,ee.transformOrigin?.y].join(" "),...ee.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,eN.jsx)(n4n,{scope:r,placedSide:L,onArrowChange:C,arrowX:W,arrowY:V,shouldHideArrow:q,children:(0,eN.jsx)(ld.div,{"data-side":L,"data-align":Q,...m,ref:w,style:{...m.style,animation:Y?void 0:"none"}})})})});Rar.displayName=q8e;var Nar="PopperArrow",i4n={top:"bottom",right:"left",bottom:"top",left:"right"},jar=xg.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=o4n(Nar,n),a=i4n[i.placedSide];return(0,eN.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,eN.jsx)(Ear,{...o,ref:r,style:{...o.style,display:"block"}})})});jar.displayName=Nar;function a4n(t){return t!==null}var s4n=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]=Dar(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,h="",m="";return l==="bottom"?(h=a?d:`${f}px`,m=`${-u}px`):l==="top"?(h=a?d:`${f}px`,m=`${n.floating.height+u}px`):l==="right"?(h=`${-u}px`,m=a?d:`${p}px`):l==="left"&&(h=`${n.floating.width+u}px`,m=a?d:`${p}px`),{data:{x:h,y:m}}}});function Dar(t){let[e,r="center"]=t.split("-");return[e,r]}var H8e=Aar,Lar=Mar,Far=Rar,kar=jar;var Ube=j(X(),1),$ar=j(Ba(),1);var Bar=j(ut(),1),l4n="Portal",V8e=Ube.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Ube.useState(!1);yo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?$ar.default.createPortal((0,Bar.jsx)(ld.div,{...n,ref:e}),a):null});V8e.displayName=l4n;var cd=j(X(),1);function f$(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var tN=j(X(),1);var Uar=j(X(),1);function zar(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function W8e(...t){return e=>{let r=!1,n=t.map(o=>{let i=zar(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():zar(t[o],null)}}}}function ZZ(...t){return Uar.useCallback(W8e(...t),t)}var uf=j(X(),1);var XH=j(ut(),1),QH=uf.forwardRef((t,e)=>{let{children:r,...n}=t,o=uf.Children.toArray(r),i=o.find(d4n);if(i){let a=i.props.children,s=o.map(u=>u===i?uf.Children.count(a)>1?uf.Children.only(null):uf.isValidElement(a)?a.props.children:null:u);return(0,XH.jsx)(K8e,{...n,ref:e,children:uf.isValidElement(a)?uf.cloneElement(a,void 0,s):null})}return(0,XH.jsx)(K8e,{...n,ref:e,children:r})});QH.displayName="Slot";var K8e=uf.forwardRef((t,e)=>{let{children:r,...n}=t;if(uf.isValidElement(r)){let o=p4n(r);return uf.cloneElement(r,{...f4n(n,r.props),ref:e?W8e(e,o):o})}return uf.Children.count(r)>1?uf.Children.only(null):null});K8e.displayName="SlotClone";var c4n=({children:t})=>(0,XH.jsx)(XH.Fragment,{children:t});function d4n(t){return uf.isValidElement(t)&&t.type===c4n}function f4n(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 p4n(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 qbe=j(ut(),1);function qar(t){let e=t+"CollectionProvider",[r,n]=Xa(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:h,children:m}=p,g=tN.default.useRef(null),y=tN.default.useRef(new Map).current;return(0,qbe.jsx)(o,{scope:h,itemMap:y,collectionRef:g,children:m})};a.displayName=e;let s=t+"CollectionSlot",u=tN.default.forwardRef((p,h)=>{let{scope:m,children:g}=p,y=i(s,m),_=ZZ(h,y.collectionRef);return(0,qbe.jsx)(QH,{ref:_,children:g})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=tN.default.forwardRef((p,h)=>{let{scope:m,children:g,...y}=p,_=tN.default.useRef(null),w=ZZ(h,_),S=i(l,m);return tN.default.useEffect(()=>(S.itemMap.set(_,{ref:_,...y}),()=>void S.itemMap.delete(_))),(0,qbe.jsx)(QH,{[c]:"",ref:w,children:g})});d.displayName=l;function f(p){let h=i(t+"CollectionConsumer",p);return tN.default.useCallback(()=>{let g=h.collectionRef.current;if(!g)return[];let y=Array.from(g.querySelectorAll(`[${c}]`));return Array.from(h.itemMap.values()).sort((S,C)=>y.indexOf(S.ref.current)-y.indexOf(C.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var Har=j(X(),1),m4n=j(Ba(),1);var Var=j(ut(),1),h4n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],G8e=h4n.reduce((t,e)=>{let r=Har.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?QH:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Var.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var rN=j(ut(),1),J8e="rovingFocusGroup.onEntryFocus",g4n={bubbles:!1,cancelable:!0},Hbe="RovingFocusGroup",[Z8e,War,y4n]=qar(Hbe),[b4n,Y8e]=Xa(Hbe,[y4n]),[_4n,v4n]=b4n(Hbe),Kar=cd.forwardRef((t,e)=>(0,rN.jsx)(Z8e.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,rN.jsx)(Z8e.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,rN.jsx)(w4n,{...t,ref:e})})}));Kar.displayName=Hbe;var w4n=cd.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=cd.useRef(null),p=ZZ(e,f),h=GH(i),[m=null,g]=Qp({prop:a,defaultProp:s,onChange:u}),[y,_]=cd.useState(!1),w=un(l),S=War(r),C=cd.useRef(!1),[E,P]=cd.useState(0);return cd.useEffect(()=>{let T=f.current;if(T)return T.addEventListener(J8e,w),()=>T.removeEventListener(J8e,w)},[w]),(0,rN.jsx)(_4n,{scope:r,orientation:n,dir:h,loop:o,currentTabStopId:m,onItemFocus:cd.useCallback(T=>g(T),[g]),onItemShiftTab:cd.useCallback(()=>_(!0),[]),onFocusableItemAdd:cd.useCallback(()=>P(T=>T+1),[]),onFocusableItemRemove:cd.useCallback(()=>P(T=>T-1),[]),children:(0,rN.jsx)(G8e.div,{tabIndex:y||E===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:f$(t.onMouseDown,()=>{C.current=!0}),onFocus:f$(t.onFocus,T=>{let I=!C.current;if(T.target===T.currentTarget&&I&&!y){let N=new CustomEvent(J8e,g4n);if(T.currentTarget.dispatchEvent(N),!N.defaultPrevented){let M=S().filter(U=>U.focusable),D=M.find(U=>U.active),k=M.find(U=>U.id===m),K=[D,k,...M].filter(Boolean).map(U=>U.ref.current);Zar(K,c)}}C.current=!1}),onBlur:f$(t.onBlur,()=>_(!1))})})}),Gar="RovingFocusGroupItem",Jar=cd.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...a}=t,s=Wl(),u=i||s,l=v4n(Gar,r),c=l.currentTabStopId===u,d=War(r),{onFocusableItemAdd:f,onFocusableItemRemove:p}=l;return cd.useEffect(()=>{if(n)return f(),()=>p()},[n,f,p]),(0,rN.jsx)(Z8e.ItemSlot,{scope:r,id:u,focusable:n,active:o,children:(0,rN.jsx)(G8e.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...a,ref:e,onMouseDown:f$(t.onMouseDown,h=>{n?l.onItemFocus(u):h.preventDefault()}),onFocus:f$(t.onFocus,()=>l.onItemFocus(u)),onKeyDown:f$(t.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){l.onItemShiftTab();return}if(h.target!==h.currentTarget)return;let m=C4n(h,l.orientation,l.dir);if(m!==void 0){if(h.metaKey||h.ctrlKey||h.altKey||h.shiftKey)return;h.preventDefault();let y=d().filter(_=>_.focusable).map(_=>_.ref.current);if(m==="last")y.reverse();else if(m==="prev"||m==="next"){m==="prev"&&y.reverse();let _=y.indexOf(h.currentTarget);y=l.loop?O4n(y,_+1):y.slice(_+1)}setTimeout(()=>Zar(y))}})})})});Jar.displayName=Gar;var x4n={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function S4n(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function C4n(t,e,r){let n=S4n(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return x4n[n]}function Zar(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function O4n(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var Yar=Kar,Xar=Jar;var P4n=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},eV=new WeakMap,Vbe=new WeakMap,Wbe={},X8e=0,Qar=function(t){return t&&(t.host||Qar(t.parentNode))},T4n=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=Qar(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})},A4n=function(t,e,r,n){var o=T4n(e,Array.isArray(t)?t:[t]);Wbe[r]||(Wbe[r]=new WeakMap);var i=Wbe[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),h=p!==null&&p!=="false",m=(eV.get(f)||0)+1,g=(i.get(f)||0)+1;eV.set(f,m),i.set(f,g),a.push(f),m===1&&h&&Vbe.set(f,!0),g===1&&f.setAttribute(r,"true"),h||f.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",f,y)}})};return c(e),s.clear(),X8e++,function(){a.forEach(function(d){var f=eV.get(d)-1,p=i.get(d)-1;eV.set(d,f),i.set(d,p),f||(Vbe.has(d)||d.removeAttribute(n),Vbe.delete(d)),p||d.removeAttribute(r)}),X8e--,X8e||(eV=new WeakMap,eV=new WeakMap,Vbe=new WeakMap,Wbe={})}},nN=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||P4n(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),A4n(n,o,r,"aria-hidden")):function(){return null}};var Ni=function(){return Ni=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},Ni.apply(this,arguments)};function oN(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 tV(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 Ybe=j(X());var sp=j(X());var Y_="right-scroll-bar-position",X_="width-before-scroll-bar",Q8e="with-scroll-bars-hidden",e5e="--removed-body-scroll-bar-size";function Kbe(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var esr=j(X());function tsr(t,e){var r=(0,esr.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 Gbe=j(X());var I4n=typeof window<"u"?Gbe.useLayoutEffect:Gbe.useEffect,rsr=new WeakMap;function p$(t,e){var r=tsr(e||null,function(n){return t.forEach(function(o){return Kbe(o,n)})});return I4n(function(){var n=rsr.get(r);if(n){var o=new Set(n),i=new Set(t),a=r.current;o.forEach(function(s){i.has(s)||Kbe(s,null)}),i.forEach(function(s){o.has(s)||Kbe(s,a)})}rsr.set(r,t)},[t]),r}function M4n(t){return t}function R4n(t,e){e===void 0&&(e=M4n);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 m$(t){t===void 0&&(t={});var e=R4n(null);return e.options=Ni({async:!0,ssr:!1},t),e}var nsr=j(X()),osr=function(t){var e=t.sideCar,r=oN(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 nsr.createElement(n,Ni({},r))};osr.isSideCarExport=!0;function h$(t,e){return t.useMedium(e),osr}var Jbe=m$();var t5e=function(){},YZ=sp.forwardRef(function(t,e){var r=sp.useRef(null),n=sp.useState({onScrollCapture:t5e,onWheelCapture:t5e,onTouchMoveCapture:t5e}),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,h=t.inert,m=t.allowPinchZoom,g=t.as,y=g===void 0?"div":g,_=t.gapMode,w=oN(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=p$([r,e]),E=Ni(Ni({},w),o);return sp.createElement(sp.Fragment,null,c&&sp.createElement(S,{sideCar:Jbe,removeScrollBar:l,shards:d,noIsolation:p,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:r,gapMode:_}),a?sp.cloneElement(sp.Children.only(s),Ni(Ni({},E),{ref:C})):sp.createElement(y,Ni({},E,{className:u,ref:C}),s))});YZ.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};YZ.classNames={fullWidth:X_,zeroRight:Y_};var Na=j(X());var nV=j(X());var ssr=j(X());var isr;var asr=function(){if(isr)return isr;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function N4n(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=asr();return e&&t.setAttribute("nonce",e),t}function j4n(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function D4n(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var r5e=function(){var t=0,e=null;return{add:function(r){t==0&&(e=N4n())&&(j4n(e,r),D4n(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};var n5e=function(){var t=r5e();return function(e,r){ssr.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}};var iA=function(){var t=n5e(),e=function(r){var n=r.styles,o=r.dynamic;return t(n,o),null};return e};var L4n={left:0,top:0,right:0,gap:0},o5e=function(t){return parseInt(t||"",10)||0},F4n=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[o5e(r),o5e(n),o5e(o)]},i5e=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return L4n;var e=F4n(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 k4n=iA(),rV="data-scroll-locked",$4n=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(Q8e,` {
overflow: hidden `).concat(n,`;
padding-right: `).concat(s,"px ").concat(n,`;
}
body[`).concat(rV,`] {
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(Y_,` {
right: `).concat(s,"px ").concat(n,`;
}
.`).concat(X_,` {
margin-right: `).concat(s,"px ").concat(n,`;
}
.`).concat(Y_," .").concat(Y_,` {
right: 0 `).concat(n,`;
}
.`).concat(X_," .").concat(X_,` {
margin-right: 0 `).concat(n,`;
}
body[`).concat(rV,`] {
`).concat(e5e,": ").concat(s,`px;
}
`)},usr=function(){var t=parseInt(document.body.getAttribute(rV)||"0",10);return isFinite(t)?t:0},B4n=function(){nV.useEffect(function(){return document.body.setAttribute(rV,(usr()+1).toString()),function(){var t=usr()-1;t<=0?document.body.removeAttribute(rV):document.body.setAttribute(rV,t.toString())}},[])},g$=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;B4n();var i=nV.useMemo(function(){return i5e(o)},[o]);return nV.createElement(k4n,{styles:$4n(i,!e,o,r?"":"!important")})};var a5e=!1;if(typeof window<"u")try{XZ=Object.defineProperty({},"passive",{get:function(){return a5e=!0,!0}}),window.addEventListener("test",XZ,XZ),window.removeEventListener("test",XZ,XZ)}catch{a5e=!1}var XZ,y$=a5e?{passive:!1}:!1;var z4n=function(t){return t.tagName==="TEXTAREA"},lsr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!z4n(t)&&r[e]==="visible")},U4n=function(t){return lsr(t,"overflowY")},q4n=function(t){return lsr(t,"overflowX")},s5e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=csr(t,n);if(o){var i=dsr(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},H4n=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},V4n=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},csr=function(t,e){return t==="v"?U4n(e):q4n(e)},dsr=function(t,e){return t==="v"?H4n(e):V4n(e)},W4n=function(t,e){return t==="h"&&e==="rtl"?-1:1},fsr=function(t,e,r,n,o){var i=W4n(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=dsr(t,s),h=p[0],m=p[1],g=p[2],y=m-g-i*h;(h||y)&&csr(t,s)&&(d+=y,f+=h),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 Zbe=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},psr=function(t){return[t.deltaX,t.deltaY]},msr=function(t){return t&&"current"in t?t.current:t},K4n=function(t,e){return t[0]===e[0]&&t[1]===e[1]},G4n=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},J4n=0,oV=[];function hsr(t){var e=Na.useRef([]),r=Na.useRef([0,0]),n=Na.useRef(),o=Na.useState(J4n++)[0],i=Na.useState(iA)[0],a=Na.useRef(t);Na.useEffect(function(){a.current=t},[t]),Na.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=tV([t.lockRef.current],(t.shards||[]).map(msr),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Na.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var y=Zbe(m),_=r.current,w="deltaX"in m?m.deltaX:_[0]-y[0],S="deltaY"in m?m.deltaY:_[1]-y[1],C,E=m.target,P=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&P==="h"&&E.type==="range")return!1;var T=s5e(P,E);if(!T)return!0;if(T?C=P:(C=P==="v"?"h":"v",T=s5e(P,E)),!T)return!1;if(!n.current&&"changedTouches"in m&&(w||S)&&(n.current=C),!C)return!0;var I=n.current||C;return fsr(I,g,m,I==="h"?w:S,!0)},[]),u=Na.useCallback(function(m){var g=m;if(!(!oV.length||oV[oV.length-1]!==i)){var y="deltaY"in g?psr(g):Zbe(g),_=e.current.filter(function(C){return C.name===g.type&&(C.target===g.target||g.target===C.shadowParent)&&K4n(C.delta,y)})[0];if(_&&_.should){g.cancelable&&g.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(msr).filter(Boolean).filter(function(C){return C.contains(g.target)}),S=w.length>0?s(g,w[0]):!a.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),l=Na.useCallback(function(m,g,y,_){var w={name:m,delta:g,target:y,should:_,shadowParent:Z4n(y)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),c=Na.useCallback(function(m){r.current=Zbe(m),n.current=void 0},[]),d=Na.useCallback(function(m){l(m.type,psr(m),m.target,s(m,t.lockRef.current))},[]),f=Na.useCallback(function(m){l(m.type,Zbe(m),m.target,s(m,t.lockRef.current))},[]);Na.useEffect(function(){return oV.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,y$),document.addEventListener("touchmove",u,y$),document.addEventListener("touchstart",c,y$),function(){oV=oV.filter(function(m){return m!==i}),document.removeEventListener("wheel",u,y$),document.removeEventListener("touchmove",u,y$),document.removeEventListener("touchstart",c,y$)}},[]);var p=t.removeScrollBar,h=t.inert;return Na.createElement(Na.Fragment,null,h?Na.createElement(i,{styles:G4n(o)}):null,p?Na.createElement(g$,{gapMode:t.gapMode}):null)}function Z4n(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var gsr=h$(Jbe,hsr);var ysr=Ybe.forwardRef(function(t,e){return Ybe.createElement(YZ,Ni({},t,{ref:e,sideCar:gsr}))});ysr.classNames=YZ.classNames;var u5e=ysr;var Zr=j(ut(),1),l5e=["Enter"," "],Y4n=["ArrowDown","PageUp","Home"],_sr=["ArrowUp","PageDown","End"],X4n=[...Y4n,..._sr],Q4n={ltr:[...l5e,"ArrowRight"],rtl:[...l5e,"ArrowLeft"]},e3n={ltr:["ArrowLeft"],rtl:["ArrowRight"]},rY="Menu",[eY,t3n,r3n]=Sir(rY),[b$,c5e]=Xa(rY,[r3n,U8e,Y8e]),nY=U8e(),vsr=Y8e(),[wsr,iN]=b$(rY),[n3n,oY]=b$(rY),xsr=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=nY(e),[u,l]=Qt.useState(null),c=Qt.useRef(!1),d=un(i),f=GH(o);return Qt.useEffect(()=>{let p=()=>{c.current=!0,document.addEventListener("pointerdown",h,{capture:!0,once:!0}),document.addEventListener("pointermove",h,{capture:!0,once:!0})},h=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",h,{capture:!0}),document.removeEventListener("pointermove",h,{capture:!0})}},[]),(0,Zr.jsx)(H8e,{...s,children:(0,Zr.jsx)(wsr,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,Zr.jsx)(n3n,{scope:e,onClose:Qt.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};xsr.displayName=rY;var o3n="MenuAnchor",d5e=Qt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=nY(r);return(0,Zr.jsx)(Lar,{...o,...n,ref:e})});d5e.displayName=o3n;var f5e="MenuPortal",[i3n,Ssr]=b$(f5e,{forceMount:void 0}),Csr=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=iN(f5e,e);return(0,Zr.jsx)(i3n,{scope:e,forceMount:r,children:(0,Zr.jsx)(rf,{present:r||i.open,children:(0,Zr.jsx)(V8e,{asChild:!0,container:o,children:n})})})};Csr.displayName=f5e;var ub="MenuContent",[a3n,p5e]=b$(ub),Osr=Qt.forwardRef((t,e)=>{let r=Ssr(ub,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=iN(ub,t.__scopeMenu),a=oY(ub,t.__scopeMenu);return(0,Zr.jsx)(eY.Provider,{scope:t.__scopeMenu,children:(0,Zr.jsx)(rf,{present:n||i.open,children:(0,Zr.jsx)(eY.Slot,{scope:t.__scopeMenu,children:a.modal?(0,Zr.jsx)(s3n,{...o,ref:e}):(0,Zr.jsx)(u3n,{...o,ref:e})})})})}),s3n=Qt.forwardRef((t,e)=>{let r=iN(ub,t.__scopeMenu),n=Qt.useRef(null),o=af(e,n);return Qt.useEffect(()=>{let i=n.current;if(i)return nN(i)},[]),(0,Zr.jsx)(m5e,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ma(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),u3n=Qt.forwardRef((t,e)=>{let r=iN(ub,t.__scopeMenu);return(0,Zr.jsx)(m5e,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),m5e=Qt.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:h,...m}=t,g=iN(ub,r),y=oY(ub,r),_=nY(r),w=vsr(r),S=t3n(r),[C,E]=Qt.useState(null),P=Qt.useRef(null),T=af(e,P,g.onContentChange),I=Qt.useRef(0),N=Qt.useRef(""),M=Qt.useRef(0),D=Qt.useRef(null),k=Qt.useRef("right"),F=Qt.useRef(0),K=h?u5e:Qt.Fragment,U=h?{as:z1,allowPinchZoom:!0}:void 0,Y=L=>{let Q=N.current+L,z=S().filter(Z=>!Z.disabled),W=document.activeElement,V=z.find(Z=>Z.ref.current===W)?.textValue,q=z.map(Z=>Z.textValue),H=w3n(q,Q,V),G=z.find(Z=>Z.textValue===H)?.ref.current;(function Z(de){N.current=de,window.clearTimeout(I.current),de!==""&&(I.current=window.setTimeout(()=>Z(""),1e3))})(Q),G&&setTimeout(()=>G.focus())};Qt.useEffect(()=>()=>window.clearTimeout(I.current),[]),H1();let ee=Qt.useCallback(L=>k.current===D.current?.side&&S3n(L,D.current?.area),[]);return(0,Zr.jsx)(a3n,{scope:r,searchRef:N,onItemEnter:Qt.useCallback(L=>{ee(L)&&L.preventDefault()},[ee]),onItemLeave:Qt.useCallback(L=>{ee(L)||(P.current?.focus(),E(null))},[ee]),onTriggerLeave:Qt.useCallback(L=>{ee(L)&&L.preventDefault()},[ee]),pointerGraceTimerRef:M,onPointerGraceIntentChange:Qt.useCallback(L=>{D.current=L},[]),children:(0,Zr.jsx)(K,{...U,children:(0,Zr.jsx)(R8e,{asChild:!0,trapped:o,onMountAutoFocus:ma(i,L=>{L.preventDefault(),P.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,Zr.jsx)(T8e,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Zr.jsx)(Yar,{asChild:!0,...w,dir:y.dir,orientation:"vertical",loop:n,currentTabStopId:C,onCurrentTabStopIdChange:E,onEntryFocus:ma(u,L=>{y.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Zr.jsx)(Far,{role:"menu","aria-orientation":"vertical","data-state":zsr(g.open),"data-radix-menu-content":"",dir:y.dir,..._,...m,ref:T,style:{outline:"none",...m.style},onKeyDown:ma(m.onKeyDown,L=>{let z=L.target.closest("[data-radix-menu-content]")===L.currentTarget,W=L.ctrlKey||L.altKey||L.metaKey,V=L.key.length===1;z&&(L.key==="Tab"&&L.preventDefault(),!W&&V&&Y(L.key));let q=P.current;if(L.target!==q||!X4n.includes(L.key))return;L.preventDefault();let G=S().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);_sr.includes(L.key)&&G.reverse(),_3n(G)}),onBlur:ma(t.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(I.current),N.current="")}),onPointerMove:ma(t.onPointerMove,tY(L=>{let Q=L.target,z=F.current!==L.clientX;if(L.currentTarget.contains(Q)&&z){let W=L.clientX>F.current?"right":"left";k.current=W,F.current=L.clientX}}))})})})})})})});Osr.displayName=ub;var l3n="MenuGroup",h5e=Qt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Zr.jsx)(ld.div,{role:"group",...n,ref:e})});h5e.displayName=l3n;var c3n="MenuLabel",Esr=Qt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Zr.jsx)(ld.div,{...n,ref:e})});Esr.displayName=c3n;var Xbe="MenuItem",bsr="menu.itemSelect",e_e=Qt.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=Qt.useRef(null),a=oY(Xbe,t.__scopeMenu),s=p5e(Xbe,t.__scopeMenu),u=af(e,i),l=Qt.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(bsr,{bubbles:!0,cancelable:!0});d.addEventListener(bsr,p=>n?.(p),{once:!0}),Tbe(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,Zr.jsx)(Psr,{...o,ref:u,disabled:r,onClick:ma(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:ma(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:ma(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||l5e.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});e_e.displayName=Xbe;var Psr=Qt.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=p5e(Xbe,r),s=vsr(r),u=Qt.useRef(null),l=af(e,u),[c,d]=Qt.useState(!1),[f,p]=Qt.useState("");return Qt.useEffect(()=>{let h=u.current;h&&p((h.textContent??"").trim())},[i.children]),(0,Zr.jsx)(eY.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,Zr.jsx)(Xar,{asChild:!0,...s,focusable:!n,children:(0,Zr.jsx)(ld.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:ma(t.onPointerMove,tY(h=>{n?a.onItemLeave(h):(a.onItemEnter(h),h.defaultPrevented||h.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ma(t.onPointerLeave,tY(h=>a.onItemLeave(h))),onFocus:ma(t.onFocus,()=>d(!0)),onBlur:ma(t.onBlur,()=>d(!1))})})})}),d3n="MenuCheckboxItem",Tsr=Qt.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,Zr.jsx)(Nsr,{scope:t.__scopeMenu,checked:r,children:(0,Zr.jsx)(e_e,{role:"menuitemcheckbox","aria-checked":Qbe(r)?"mixed":r,...o,ref:e,"data-state":b5e(r),onSelect:ma(o.onSelect,()=>n?.(Qbe(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Tsr.displayName=d3n;var Asr="MenuRadioGroup",[f3n,p3n]=b$(Asr,{value:void 0,onValueChange:()=>{}}),Isr=Qt.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=un(n);return(0,Zr.jsx)(f3n,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,Zr.jsx)(h5e,{...o,ref:e})})});Isr.displayName=Asr;var Msr="MenuRadioItem",Rsr=Qt.forwardRef((t,e)=>{let{value:r,...n}=t,o=p3n(Msr,t.__scopeMenu),i=r===o.value;return(0,Zr.jsx)(Nsr,{scope:t.__scopeMenu,checked:i,children:(0,Zr.jsx)(e_e,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":b5e(i),onSelect:ma(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});Rsr.displayName=Msr;var g5e="MenuItemIndicator",[Nsr,m3n]=b$(g5e,{checked:!1}),jsr=Qt.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=m3n(g5e,r);return(0,Zr.jsx)(rf,{present:n||Qbe(i.checked)||i.checked===!0,children:(0,Zr.jsx)(ld.span,{...o,ref:e,"data-state":b5e(i.checked)})})});jsr.displayName=g5e;var h3n="MenuSeparator",Dsr=Qt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Zr.jsx)(ld.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});Dsr.displayName=h3n;var g3n="MenuArrow",Lsr=Qt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=nY(r);return(0,Zr.jsx)(kar,{...o,...n,ref:e})});Lsr.displayName=g3n;var y5e="MenuSub",[y3n,Fsr]=b$(y5e),b3n=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=iN(y5e,e),a=nY(e),[s,u]=Qt.useState(null),[l,c]=Qt.useState(null),d=un(o);return Qt.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,Zr.jsx)(H8e,{...a,children:(0,Zr.jsx)(wsr,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,Zr.jsx)(y3n,{scope:e,contentId:Wl(),triggerId:Wl(),trigger:s,onTriggerChange:u,children:r})})})};b3n.displayName=y5e;var QZ="MenuSubTrigger",ksr=Qt.forwardRef((t,e)=>{let r=iN(QZ,t.__scopeMenu),n=oY(QZ,t.__scopeMenu),o=Fsr(QZ,t.__scopeMenu),i=p5e(QZ,t.__scopeMenu),a=Qt.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:t.__scopeMenu},c=Qt.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return Qt.useEffect(()=>c,[c]),Qt.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,Zr.jsx)(d5e,{asChild:!0,...l,children:(0,Zr.jsx)(Psr,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":zsr(r.open),...t,ref:HZ(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ma(t.onPointerMove,tY(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:ma(t.onPointerLeave,tY(d=>{c();let f=r.content?.getBoundingClientRect();if(f){let p=r.content?.dataset.side,h=p==="right",m=h?-5:5,g=f[h?"left":"right"],y=f[h?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:g,y:f.top},{x:y,y:f.top},{x:y,y:f.bottom},{x:g,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:ma(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||Q4n[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});ksr.displayName=QZ;var $sr="MenuSubContent",Bsr=Qt.forwardRef((t,e)=>{let r=Ssr(ub,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=iN(ub,t.__scopeMenu),a=oY(ub,t.__scopeMenu),s=Fsr($sr,t.__scopeMenu),u=Qt.useRef(null),l=af(e,u);return(0,Zr.jsx)(eY.Provider,{scope:t.__scopeMenu,children:(0,Zr.jsx)(rf,{present:n||i.open,children:(0,Zr.jsx)(eY.Slot,{scope:t.__scopeMenu,children:(0,Zr.jsx)(m5e,{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:ma(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ma(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:ma(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=e3n[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});Bsr.displayName=$sr;function zsr(t){return t?"open":"closed"}function Qbe(t){return t==="indeterminate"}function b5e(t){return Qbe(t)?"indeterminate":t?"checked":"unchecked"}function _3n(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function v3n(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function w3n(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=v3n(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 x3n(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 S3n(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return x3n(r,e)}function tY(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Usr=xsr,qsr=d5e,Hsr=Csr,Vsr=Osr,Wsr=h5e,Ksr=Esr,Gsr=e_e,Jsr=Tsr,Zsr=Isr,Ysr=Rsr,Xsr=jsr,Qsr=Dsr,eur=Lsr;var tur=ksr,rur=Bsr;var dd=j(ut(),1),_5e="DropdownMenu",[O3n,sHi]=Xa(_5e,[c5e]),tm=c5e(),[E3n,nur]=O3n(_5e),iY=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=tm(e),l=Pc.useRef(null),[c=!1,d]=Qp({prop:o,defaultProp:i,onChange:a});return(0,dd.jsx)(E3n,{scope:e,triggerId:Wl(),triggerRef:l,contentId:Wl(),open:c,onOpenChange:d,onOpenToggle:Pc.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,dd.jsx)(Usr,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};iY.displayName=_5e;var our="DropdownMenuTrigger",aY=Pc.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=nur(our,r),a=tm(r);return(0,dd.jsx)(qsr,{asChild:!0,...a,children:(0,dd.jsx)(vir.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:Obe(e,i.triggerRef),onPointerDown:qZ(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:qZ(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});aY.displayName=our;var P3n="DropdownMenuPortal",iur=t=>{let{__scopeDropdownMenu:e,...r}=t,n=tm(e);return(0,dd.jsx)(Hsr,{...n,...r})};iur.displayName=P3n;var aur="DropdownMenuContent",sur=Pc.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=nur(aur,r),i=tm(r),a=Pc.useRef(!1);return(0,dd.jsx)(Vsr,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:qZ(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:qZ(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)"}})});sur.displayName=aur;var T3n="DropdownMenuGroup",A3n=Pc.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=tm(r);return(0,dd.jsx)(Wsr,{...o,...n,ref:e})});A3n.displayName=T3n;var I3n="DropdownMenuLabel",uur=Pc.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=tm(r);return(0,dd.jsx)(Ksr,{...o,...n,ref:e})});uur.displayName=I3n;var M3n="DropdownMenuItem",lur=Pc.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=tm(r);return(0,dd.jsx)(Gsr,{...o,...n,ref:e})});lur.displayName=M3n;var R3n="DropdownMenuCheckboxItem",cur=Pc.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=tm(r);return(0,dd.jsx)(Jsr,{...o,...n,ref:e})});cur.displayName=R3n;var N3n="DropdownMenuRadioGroup",j3n=Pc.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=tm(r);return(0,dd.jsx)(Zsr,{...o,...n,ref:e})});j3n.displayName=N3n;var D3n="DropdownMenuRadioItem",dur=Pc.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=tm(r);return(0,dd.jsx)(Ysr,{...o,...n,ref:e})});dur.displayName=D3n;var L3n="DropdownMenuItemIndicator",fur=Pc.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=tm(r);return(0,dd.jsx)(Xsr,{...o,...n,ref:e})});fur.displayName=L3n;var F3n="DropdownMenuSeparator",pur=Pc.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=tm(r);return(0,dd.jsx)(Qsr,{...o,...n,ref:e})});pur.displayName=F3n;var k3n="DropdownMenuArrow",$3n=Pc.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=tm(r);return(0,dd.jsx)(eur,{...o,...n,ref:e})});$3n.displayName=k3n;var B3n="DropdownMenuSubTrigger",mur=Pc.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=tm(r);return(0,dd.jsx)(tur,{...o,...n,ref:e})});mur.displayName=B3n;var z3n="DropdownMenuSubContent",hur=Pc.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=tm(r);return(0,dd.jsx)(rur,{...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)"}})});hur.displayName=z3n;var gur=iY,yur=aY,bur=iur,v5e=sur;var w5e=uur,x5e=lur,S5e=cur;var C5e=dur,O5e=fur,E5e=pur;var P5e=mur,T5e=hur;fn();wn();var _$=gur,v$=yur;var q3n=aa.forwardRef(({className:t,inset:e,children:r,...n},o)=>aa.createElement(P5e,{ref:o,className:me("tw-flex tw-cursor-default tw-select-none tw-items-center tw-gap-2 tw-rounded-sm tw-px-2 tw-py-1.5 tw-text-sm tw-outline-none focus:tw-bg-dropdown-hover data-[state=open]:tw-bg-dropdown-hover [&_svg]:tw-pointer-events-none [&_svg]:tw-size-4 [&_svg]:tw-shrink-0",e&&"tw-pl-8",t),...n},r,aa.createElement(jm,{className:"tw-ml-auto"})));q3n.displayName=P5e.displayName;var H3n=aa.forwardRef(({className:t,...e},r)=>aa.createElement(T5e,{ref:r,className:me("tw-z-[50] tw-min-w-32 tw-overflow-hidden tw-rounded-md tw-border tw-bg-primary tw-p-1 tw-text-normal tw-shadow-lg data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",t),...e}));H3n.displayName=T5e.displayName;var Q_=aa.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>aa.createElement(bur,{container:r??activeDocument.body},aa.createElement(v5e,{ref:o,sideOffset:e,className:me("tw-z-[50] tw-min-w-32 tw-overflow-hidden tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-1 tw-text-normal tw-shadow-md","data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",t),...n})));Q_.displayName=v5e.displayName;var Ui=aa.forwardRef(({className:t,inset:e,...r},n)=>aa.createElement(x5e,{ref:n,className:me("tw-relative tw-flex tw-cursor-default tw-select-none tw-items-center tw-gap-2 tw-rounded-sm tw-px-2 tw-py-1.5 tw-text-sm tw-outline-none tw-transition-colors focus:tw-bg-dropdown-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50 [&>svg]:tw-size-4 [&>svg]:tw-shrink-0",e&&"tw-pl-8",t),...r}));Ui.displayName=x5e.displayName;var V3n=aa.forwardRef(({className:t,children:e,checked:r,...n},o)=>aa.createElement(S5e,{ref:o,className:me("tw-relative tw-flex tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-py-1.5 tw-pl-8 tw-pr-2 tw-text-sm tw-outline-none tw-transition-colors focus:tw-bg-dropdown-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t),checked:r,...n},aa.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},aa.createElement(O5e,null,aa.createElement(Fc,{className:"tw-size-4"}))),e));V3n.displayName=S5e.displayName;var W3n=aa.forwardRef(({className:t,children:e,...r},n)=>aa.createElement(C5e,{ref:n,className:me("tw-relative tw-flex tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-py-1.5 tw-pl-8 tw-pr-2 tw-text-sm tw-outline-none tw-transition-colors focus:tw-bg-dropdown-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t),...r},aa.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},aa.createElement(O5e,null,aa.createElement(p5,{className:"tw-size-2 tw-fill-current"}))),e));W3n.displayName=C5e.displayName;var K3n=aa.forwardRef(({className:t,inset:e,...r},n)=>aa.createElement(w5e,{ref:n,className:me("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",e&&"tw-pl-8",t),...r}));K3n.displayName=w5e.displayName;var G3n=aa.forwardRef(({className:t,...e},r)=>aa.createElement(E5e,{ref:r,className:me("-tw-mx-1 tw-my-1 tw-h-px",t),...e}));G3n.displayName=E5e.displayName;var J3n=({className:t,...e})=>aa.createElement("span",{className:me("tw-ml-auto tw-text-xs tw-tracking-widest tw-opacity-60",t),...e});J3n.displayName="DropdownMenuShortcut";var sY=j(X());wn();var iV=sY.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 sY.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:me("tw-relative tw-inline-flex tw-h-5.5 tw-w-10 tw-shrink-0 tw-cursor-pointer tw-items-center tw-rounded-full tw-transition-colors","focus-visible:tw-outline-none focus-visible:tw-ring-2 focus-visible:tw-ring-ring focus-visible:tw-ring-offset-2",t?"tw-bg-interactive-accent":"tw-bg-[--background-modifier-border-hover]",r&&"tw-cursor-not-allowed tw-opacity-50",n),onClick:a,onKeyDown:s,...o},sY.createElement("div",{className:me("tw-pointer-events-none tw-block tw-size-4 tw-rounded-full tw-bg-toggle-thumb tw-shadow-lg tw-ring-0 tw-transition-transform",t?"tw-translate-x-5.5":"tw-translate-x-0.5")}))});iV.displayName="SettingSwitch";var cY=j(X());var bn=j(X(),1);function ev(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var vur=j(X(),1);function _ur(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Z3n(...t){return e=>{let r=!1,n=t.map(o=>{let i=_ur(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():_ur(t[o],null)}}}}function tv(...t){return vur.useCallback(Z3n(...t),t)}var aA=j(X(),1),wur=j(ut(),1);function t_e(t,e=[]){let r=[];function n(i,a){let s=aA.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...h}=d,m=f?.[t]?.[u]||s,g=aA.useMemo(()=>h,Object.values(h));return(0,wur.jsx)(m.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,h=aA.useContext(p);if(h)return h;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=>aA.createContext(a));return function(s){let u=s?.[t]||i;return aA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Y3n(o,...e)]}function Y3n(...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 aA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Ss=j(X(),1);var xur=j(X(),1),Sur=j(Ba(),1);kv();var Cur=j(ut(),1),X3n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lb=X3n.reduce((t,e)=>{let r=Ff(`Primitive.${e}`),n=xur.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Cur.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function Our(t,e){t&&Sur.flushSync(()=>t.dispatchEvent(e))}var aV=j(X(),1);function w$(t){let e=aV.useRef(t);return aV.useEffect(()=>{e.current=t}),aV.useMemo(()=>(...r)=>e.current?.(...r),[])}var Eur=j(X(),1);function Pur(t,e=globalThis?.document){let r=w$(t);Eur.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 I5e=j(ut(),1),Q3n="DismissableLayer",A5e="dismissableLayer.update",eHn="dismissableLayer.pointerDownOutside",tHn="dismissableLayer.focusOutside",Tur,Iur=Ss.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),M5e=Ss.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ss.useContext(Iur),[c,d]=Ss.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ss.useState({}),h=tv(e,P=>d(P)),m=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),_=c?m.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=y,C=oHn(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=iHn(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return Pur(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Ss.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Tur=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Aur(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Tur)}},[c,f,r,l]),Ss.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Aur())},[c,l]),Ss.useEffect(()=>{let P=()=>p({});return document.addEventListener(A5e,P),()=>document.removeEventListener(A5e,P)},[]),(0,I5e.jsx)(lb.div,{...u,ref:h,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:ev(t.onFocusCapture,E.onFocusCapture),onBlurCapture:ev(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ev(t.onPointerDownCapture,C.onPointerDownCapture)})});M5e.displayName=Q3n;var rHn="DismissableLayerBranch",nHn=Ss.forwardRef((t,e)=>{let r=Ss.useContext(Iur),n=Ss.useRef(null),o=tv(e,n);return Ss.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,I5e.jsx)(lb.div,{...t,ref:o})});nHn.displayName=rHn;function oHn(t,e=globalThis?.document){let r=w$(t),n=Ss.useRef(!1),o=Ss.useRef(()=>{});return Ss.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Mur(eHn,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 iHn(t,e=globalThis?.document){let r=w$(t),n=Ss.useRef(!1);return Ss.useEffect(()=>{let o=i=>{i.target&&!n.current&&Mur(tHn,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 Aur(){let t=new CustomEvent(A5e);document.dispatchEvent(t)}function Mur(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?Our(o,i):o.dispatchEvent(i)}var R5e=j(X(),1);var Rur=j(X(),1),yh=globalThis?.document?Rur.useLayoutEffect:()=>{};var aHn=R5e[" useId ".trim().toString()]||(()=>{}),sHn=0;function Nur(t){let[e,r]=R5e.useState(aHn());return yh(()=>{t||r(n=>n??String(sHn++))},[t]),t||(e?`radix-${e}`:"")}var Sg=j(X(),1);var jur=j(X(),1);var N5e=j(ut(),1),uHn="Arrow",Dur=jur.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,N5e.jsx)(lb.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,N5e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Dur.displayName=uHn;var Lur=Dur;var Fur=j(X(),1);function kur(t){let[e,r]=Fur.useState(void 0);return yh(()=>{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 aN=j(ut(),1);var j5e="Popper",[$ur,D5e]=t_e(j5e),[cHn,Bur]=$ur(j5e),zur=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Sg.useState(null);return(0,aN.jsx)(cHn,{scope:e,anchor:n,onAnchorChange:o,children:r})};zur.displayName=j5e;var Uur="PopperAnchor",qur=Sg.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=Bur(Uur,r),a=Sg.useRef(null),s=tv(e,a);return Sg.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,aN.jsx)(lb.div,{...o,ref:s})});qur.displayName=Uur;var L5e="PopperContent",[dHn,fHn]=$ur(L5e),Hur=Sg.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:h,...m}=t,g=Bur(L5e,r),[y,_]=Sg.useState(null),w=tv(e,Z=>_(Z)),[S,C]=Sg.useState(null),E=kur(S),P=E?.width??0,T=E?.height??0,I=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},M=Array.isArray(l)?l:[l],D=M.length>0,k={padding:N,boundary:M.filter(mHn),altBoundary:D},{refs:F,floatingStyles:K,placement:U,isPositioned:Y,middlewareData:ee}=W1({strategy:"fixed",placement:I,whileElementsMounted:(...Z)=>oA(...Z,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[K1({mainAxis:o+T,alignmentAxis:a}),u&&G1({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?J1():void 0,...k}),u&&Z1({...k}),Y1({...k,apply:({elements:Z,rects:de,availableWidth:pe,availableHeight:ae})=>{let{width:Te,height:Ae}=de.reference,ke=Z.floating.style;ke.setProperty("--radix-popper-available-width",`${pe}px`),ke.setProperty("--radix-popper-available-height",`${ae}px`),ke.setProperty("--radix-popper-anchor-width",`${Te}px`),ke.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),S&&Q1({element:S,padding:s}),hHn({arrowWidth:P,arrowHeight:T}),f&&X1({strategy:"referenceHidden",...k})]}),[L,Q]=Kur(U),z=w$(h);yh(()=>{Y&&z?.()},[Y,z]);let W=ee.arrow?.x,V=ee.arrow?.y,q=ee.arrow?.centerOffset!==0,[H,G]=Sg.useState();return yh(()=>{y&&G(window.getComputedStyle(y).zIndex)},[y]),(0,aN.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:Y?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[ee.transformOrigin?.x,ee.transformOrigin?.y].join(" "),...ee.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,aN.jsx)(dHn,{scope:r,placedSide:L,onArrowChange:C,arrowX:W,arrowY:V,shouldHideArrow:q,children:(0,aN.jsx)(lb.div,{"data-side":L,"data-align":Q,...m,ref:w,style:{...m.style,animation:Y?void 0:"none"}})})})});Hur.displayName=L5e;var Vur="PopperArrow",pHn={top:"bottom",right:"left",bottom:"top",left:"right"},Wur=Sg.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=fHn(Vur,n),a=pHn[i.placedSide];return(0,aN.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,aN.jsx)(Lur,{...o,ref:r,style:{...o.style,display:"block"}})})});Wur.displayName=Vur;function mHn(t){return t!==null}var hHn=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]=Kur(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,h="",m="";return l==="bottom"?(h=a?d:`${f}px`,m=`${-u}px`):l==="top"?(h=a?d:`${f}px`,m=`${n.floating.height+u}px`):l==="right"?(h=`${-u}px`,m=a?d:`${p}px`):l==="left"&&(h=`${n.floating.width+u}px`,m=a?d:`${p}px`),{data:{x:h,y:m}}}});function Kur(t){let[e,r="center"]=t.split("-");return[e,r]}var Gur=zur,Jur=qur,Zur=Hur,Yur=Wur;var r_e=j(X(),1),Xur=j(Ba(),1);var Qur=j(ut(),1),yHn="Portal",F5e=r_e.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=r_e.useState(!1);yh(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Xur.default.createPortal((0,Qur.jsx)(lb.div,{...n,ref:e}),a):null});F5e.displayName=yHn;var bh=j(X(),1);var elr=j(X(),1);function bHn(t,e){return elr.useReducer((r,n)=>e[r][n]??r,t)}var o_e=t=>{let{present:e,children:r}=t,n=_Hn(e),o=typeof r=="function"?r({present:n.isPresent}):bh.Children.only(r),i=tv(n.ref,vHn(o));return typeof r=="function"||n.isPresent?bh.cloneElement(o,{ref:i}):null};o_e.displayName="Presence";function _Hn(t){let[e,r]=bh.useState(),n=bh.useRef(null),o=bh.useRef(t),i=bh.useRef("none"),a=t?"mounted":"unmounted",[s,u]=bHn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return bh.useEffect(()=>{let l=n_e(n.current);i.current=s==="mounted"?l:"none"},[s]),yh(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=n_e(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),yh(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let m=n_e(n.current).includes(p.animationName);if(p.target===e&&m&&(u("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=p=>{p.target===e&&(i.current=n_e(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:bh.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function n_e(t){return t?.animationName||"none"}function vHn(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)}kv();var cb=j(X(),1);var i_e=j(X(),1);var wHn=cb[" useInsertionEffect ".trim().toString()]||yh;function tlr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=xHn({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=cb.useRef(t!==void 0);cb.useEffect(()=>{let d=c.current;d!==s&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}let l=cb.useCallback(c=>{if(s){let d=SHn(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function xHn({defaultProp:t,onChange:e}){let[r,n]=cb.useState(t),o=cb.useRef(r),i=cb.useRef(e);return wHn(()=>{i.current=e},[e]),cb.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function SHn(t){return typeof t=="function"}var ZHi=Symbol("RADIX:SYNC_STATE");var ilr=j(X(),1);var rlr=j(X(),1),CHn=j(Ba(),1);kv();var nlr=j(ut(),1),OHn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],olr=OHn.reduce((t,e)=>{let r=Ff(`Primitive.${e}`),n=rlr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,nlr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var alr=j(ut(),1),EHn=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),PHn="VisuallyHidden",slr=ilr.forwardRef((t,e)=>(0,alr.jsx)(olr.span,{...t,ref:e,style:{...EHn,...t.style}}));slr.displayName=PHn;var ulr=slr;var Gl=j(ut(),1),[a_e,fVi]=t_e("Tooltip",[D5e]),s_e=D5e(),llr="TooltipProvider",AHn=700,k5e="tooltip.open",[IHn,B5e]=a_e(llr),clr=t=>{let{__scopeTooltip:e,delayDuration:r=AHn,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,a=bn.useRef(!0),s=bn.useRef(!1),u=bn.useRef(0);return bn.useEffect(()=>{let l=u.current;return()=>window.clearTimeout(l)},[]),(0,Gl.jsx)(IHn,{scope:e,isOpenDelayedRef:a,delayDuration:r,onOpen:bn.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:bn.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:bn.useCallback(l=>{s.current=l},[]),disableHoverableContent:o,children:i})};clr.displayName=llr;var uY="Tooltip",[MHn,lY]=a_e(uY),dlr=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=B5e(uY,t.__scopeTooltip),l=s_e(e),[c,d]=bn.useState(null),f=Nur(),p=bn.useRef(0),h=a??u.disableHoverableContent,m=s??u.delayDuration,g=bn.useRef(!1),[y,_]=tlr({prop:n,defaultProp:o??!1,onChange:P=>{P?(u.onOpen(),document.dispatchEvent(new CustomEvent(k5e))):u.onClose(),i?.(P)},caller:uY}),w=bn.useMemo(()=>y?g.current?"delayed-open":"instant-open":"closed",[y]),S=bn.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,_(!0)},[_]),C=bn.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),E=bn.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,_(!0),p.current=0},m)},[m,_]);return bn.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,Gl.jsx)(Gur,{...l,children:(0,Gl.jsx)(MHn,{scope:e,contentId:f,open:y,stateAttribute:w,trigger:c,onTriggerChange:d,onTriggerEnter:bn.useCallback(()=>{u.isOpenDelayedRef.current?E():S()},[u.isOpenDelayedRef,E,S]),onTriggerLeave:bn.useCallback(()=>{h?C():(window.clearTimeout(p.current),p.current=0)},[C,h]),onOpen:S,onClose:C,disableHoverableContent:h,children:r})})};dlr.displayName=uY;var $5e="TooltipTrigger",flr=bn.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=lY($5e,r),i=B5e($5e,r),a=s_e(r),s=bn.useRef(null),u=tv(e,s,o.onTriggerChange),l=bn.useRef(!1),c=bn.useRef(!1),d=bn.useCallback(()=>l.current=!1,[]);return bn.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,Gl.jsx)(Jur,{asChild:!0,...a,children:(0,Gl.jsx)(lb.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:ev(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:ev(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:ev(t.onPointerDown,()=>{o.open&&o.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:ev(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:ev(t.onBlur,o.onClose),onClick:ev(t.onClick,o.onClose)})})});flr.displayName=$5e;var z5e="TooltipPortal",[RHn,NHn]=a_e(z5e,{forceMount:void 0}),plr=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=lY(z5e,e);return(0,Gl.jsx)(RHn,{scope:e,forceMount:r,children:(0,Gl.jsx)(o_e,{present:r||i.open,children:(0,Gl.jsx)(F5e,{asChild:!0,container:o,children:n})})})};plr.displayName=z5e;var sV="TooltipContent",mlr=bn.forwardRef((t,e)=>{let r=NHn(sV,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=lY(sV,t.__scopeTooltip);return(0,Gl.jsx)(o_e,{present:n||a.open,children:a.disableHoverableContent?(0,Gl.jsx)(hlr,{side:o,...i,ref:e}):(0,Gl.jsx)(jHn,{side:o,...i,ref:e})})}),jHn=bn.forwardRef((t,e)=>{let r=lY(sV,t.__scopeTooltip),n=B5e(sV,t.__scopeTooltip),o=bn.useRef(null),i=tv(e,o),[a,s]=bn.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=bn.useCallback(()=>{s(null),d(!1)},[d]),p=bn.useCallback((h,m)=>{let g=h.currentTarget,y={x:h.clientX,y:h.clientY},_=$Hn(y,g.getBoundingClientRect()),w=BHn(y,_),S=zHn(m.getBoundingClientRect()),C=qHn([...w,...S]);s(C),d(!0)},[d]);return bn.useEffect(()=>()=>f(),[f]),bn.useEffect(()=>{if(u&&c){let h=g=>p(g,c),m=g=>p(g,u);return u.addEventListener("pointerleave",h),c.addEventListener("pointerleave",m),()=>{u.removeEventListener("pointerleave",h),c.removeEventListener("pointerleave",m)}}},[u,c,p,f]),bn.useEffect(()=>{if(a){let h=m=>{let g=m.target,y={x:m.clientX,y:m.clientY},_=u?.contains(g)||c?.contains(g),w=!UHn(y,a);_?f():w&&(f(),l())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[u,c,a,l,f]),(0,Gl.jsx)(hlr,{...t,ref:i})}),[DHn,LHn]=a_e(uY,{isInside:!1}),FHn=Zot("TooltipContent"),hlr=bn.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=lY(sV,r),l=s_e(r),{onClose:c}=u;return bn.useEffect(()=>(document.addEventListener(k5e,c),()=>document.removeEventListener(k5e,c)),[c]),bn.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,Gl.jsx)(M5e,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,Gl.jsxs)(Zur,{"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,Gl.jsx)(FHn,{children:n}),(0,Gl.jsx)(DHn,{scope:r,isInside:!0,children:(0,Gl.jsx)(ulr,{id:u.contentId,role:"tooltip",children:o||n})})]})})});mlr.displayName=sV;var glr="TooltipArrow",kHn=bn.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=s_e(r);return LHn(glr,r).isInside?null:(0,Gl.jsx)(Yur,{...o,...n,ref:e})});kHn.displayName=glr;function $Hn(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 BHn(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 zHn(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 UHn(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],u=e[a],l=s.x,c=s.y,d=u.x,f=u.y;c>n!=f>n&&r<(d-l)*(n-c)/(f-c)+l&&(o=!o)}return o}function qHn(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),HHn(e)}function HHn(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 u_e=clr,ylr=dlr,blr=flr,_lr=plr,U5e=mlr;wn();var No=u_e,Ot=ylr,Et=blr,xt=cY.forwardRef(({className:t,sideOffset:e=4,...r},n)=>cY.createElement(_lr,{container:activeDocument.body},cY.createElement(U5e,{ref:n,sideOffset:e,className:me("tw-z-[50] tw-overflow-hidden tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-secondary tw-px-3 tw-py-1.5 tw-text-xs tw-text-normal tw-animate-in tw-fade-in-0 tw-zoom-in-95 data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=closed]:tw-zoom-out-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",t),...r})));xt.displayName=U5e.displayName;nr();Kt();oy();bt();jde();rG();fn();var rm=require("obsidian"),Ht=j(X());async function VHn(){try{let{getSettings:t}=await Promise.resolve().then(()=>(bt(),r8));if(t().enableSemanticSearchV3){let n=await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().indexVaultToVectorStore(!1);new rm.Notice(`Semantic search index refreshed with ${n} documents.`)}else new rm.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error refreshing vault index:",t),new rm.Notice("Failed to refresh vault index. Check console for details.")}}async function WHn(){try{let{getSettings:t}=await Promise.resolve().then(()=>(bt(),r8));if(t().enableSemanticSearchV3){let n=await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().indexVaultToVectorStore(!0);new rm.Notice(`Semantic search index rebuilt with ${n} documents.`)}else new rm.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error force reindexing vault:",t),new rm.Notice("Failed to force reindex vault. Check console for details.")}}async function l_e(){let t=bu();if(!t){new rm.Notice("No project is currently selected to reload.");return}try{EE(!0),await h_.getInstance().invalidateMarkdownContext(t,!0);let e=app.plugins.getPlugin("copilot");if(e&&e.projectManager)await e.projectManager.getProjectContext(t.id),new rm.Notice(`Project context for "${t.name}" reloaded successfully.`);else throw new Error("Copilot plugin or ProjectManager not available.")}catch(e){ie("Error reloading project context:",e),$P(e)||new rm.Notice("Failed to reload project context. Check console for details.")}finally{EE(!1)}}async function KHn(){let t=bu();if(!t){new rm.Notice("No project is currently selected to rebuild.");return}new Ec(app,async()=>{try{EE(!0),new rm.Notice(`Force rebuilding context for project: ${t.name}... This will take some time and re-fetch all data.`,1e4),nG.resetRateLimitNoticeTimer(),await h_.getInstance().clearForProject(t),new rm.Notice(`Cache for project "${t.name}" has been cleared.`);let r=app.plugins.getPlugin("copilot");if(r&&r.projectManager)await r.projectManager.getProjectContext(t.id),new rm.Notice(`Project context for "${t.name}" rebuilt successfully from scratch.`);else throw new Error("Copilot plugin or ProjectManager not available for rebuild.")}catch(r){ie("Error force rebuilding project context:",r),$P(r)||new rm.Notice("Failed to force rebuild project context. Check console for details.")}finally{EE(!1)}},`DANGER: This will permanently delete all cached data (markdown, web URLs, YouTube transcripts, and processed file content) for the project "${t.name}" from both memory and disk. The context will then be rebuilt from scratch, re-fetching all remote data and re-processing all local files. This cannot be undone. Are you absolutely sure?`,"Force Rebuild Project Context").open()}function wlr({onNewChat:t,onSaveAsNote:e,onLoadHistory:r,onModeChange:n,onCloseProject:o}){let i=_n(),[a,s]=Ip(),u=l4(),l=c=>{s(c),n(c),c!=="project"&&(Mj(null),o?.())};return Ht.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-p-1"},Ht.default.createElement("div",{className:"tw-flex-1"},Ht.default.createElement(iY,null,Ht.default.createElement(aY,{asChild:!0},Ht.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-ml-1 tw-text-sm tw-text-muted"},a==="llm_chain"&&"chat (free)",a==="vault_qa"&&"vault QA (free)",a==="copilot_plus"&&Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ht.default.createElement(Lm,{className:"tw-size-4"}),"copilot plus"),a==="project"&&"projects (alpha)",Ht.default.createElement(Li,{className:"tw-mt-0.5 tw-size-5"}))),Ht.default.createElement(Q_,{align:"start"},Ht.default.createElement(Ui,{onSelect:()=>{l("llm_chain")}},"chat (free)"),Ht.default.createElement(Ui,{onSelect:()=>{l("vault_qa")}},"vault QA (free)"),u?Ht.default.createElement(Ui,{onSelect:()=>{l("copilot_plus")}},Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ht.default.createElement(Lm,{className:"tw-size-4"}),"copilot plus")):Ht.default.createElement(Ui,{onSelect:()=>{tD(CE.CHAT_MODE_SELECT),o?.()}},"copilot plus",Ht.default.createElement(UE,{className:"tw-size-3"})),u?Ht.default.createElement(Ui,{className:"tw-flex tw-items-center tw-gap-1",onSelect:()=>{l("project")}},Ht.default.createElement(Xj,{className:"tw-size-4"}),"projects (alpha)"):Ht.default.createElement(Ui,{onSelect:()=>{tD(CE.CHAT_MODE_SELECT),o?.()}},"copilot plus",Ht.default.createElement(UE,{className:"tw-size-3"}))))),Ht.default.createElement("div",null,Ht.default.createElement(Ot,null,Ht.default.createElement(Et,{asChild:!0},Ht.default.createElement(he,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},Ht.default.createElement(P5,{className:"tw-size-4"}))),Ht.default.createElement(xt,null,"New Chat")),!i.autosaveChat&&Ht.default.createElement(Ot,null,Ht.default.createElement(Et,{asChild:!0},Ht.default.createElement(he,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},Ht.default.createElement(g5,{className:"tw-size-4"}))),Ht.default.createElement(xt,null,"Save Chat as Note")),Ht.default.createElement(Ot,null,Ht.default.createElement(Et,{asChild:!0},Ht.default.createElement(he,{variant:"ghost2",size:"icon",title:"Chat History",onClick:r},Ht.default.createElement(C5,{className:"tw-size-4"}))),Ht.default.createElement(xt,null,"Chat History")),Ht.default.createElement(iY,null,Ht.default.createElement(aY,{asChild:!0},Ht.default.createElement(he,{variant:"ghost2",size:"icon",title:"Advanced Settings"},Ht.default.createElement(PI,{className:"tw-size-4"}))),Ht.default.createElement(Q_,{align:"end",className:"tw-w-64"},Ht.default.createElement(Ui,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),ot("showSuggestedPrompts",!i.showSuggestedPrompts)}},Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ht.default.createElement(Lm,{className:"tw-size-4"}),"Suggested Prompt"),Ht.default.createElement(iV,{checked:i.showSuggestedPrompts})),Ht.default.createElement(Ui,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),ot("showRelevantNotes",!i.showRelevantNotes)}},Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ht.default.createElement(Dm,{className:"tw-size-4"}),"Relevant Note"),Ht.default.createElement(iV,{checked:i.showRelevantNotes})),a==="project"?Ht.default.createElement(Ht.default.Fragment,null,Ht.default.createElement(Ui,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>l_e()},Ht.default.createElement(qv,{className:"tw-size-4"}),"Reload Current Project"),Ht.default.createElement(Ui,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>KHn()},Ht.default.createElement(jp,{className:"tw-size-4"}),"Force Rebuild Context")):Ht.default.createElement(Ht.default.Fragment,null,Ht.default.createElement(Ui,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>VHn()},Ht.default.createElement(qv,{className:"tw-size-4"}),"Refresh Vault Index"),Ht.default.createElement(Ui,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>{new Ec(app,()=>WHn(),"This will delete and rebuild your entire vault index from scratch. This operation cannot be undone. Are you sure you want to proceed?","Force Reindex Vault").open()}},Ht.default.createElement(jp,{className:"tw-size-4"}),"Force Reindex Vault"))))))}sa();oc();var d_e=require("obsidian");var c_e=require("obsidian");fr();oc();var uV=class extends c_e.FuzzySuggestModal{constructor(e,r="copilot_plus"){super(e),this.activeNote=e.workspace.getActiveFile(),this.chainType=r}getOrderedNotes(e=[]){let r=this.app.workspace.getLastOpenFiles().map(a=>this.app.vault.getAbstractFileByPath(a)).filter(a=>a instanceof c_e.TFile&&ZB(a,this.chainType)&&!e.includes(a.path)&&a.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(a=>ZB(a,this.chainType)).filter(a=>!r.some(s=>s.path===a.path)&&!e.includes(a.path)&&a.path!==this.activeNote?.path);return[...this.activeNote&&ZB(this.activeNote,this.chainType)?[this.activeNote]:[],...r,...o]}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n==="pdf"?o+=" (PDF)":n==="canvas"&&(o+=" (Canvas)"),o}};oc();fr();nr();var sN=class extends uV{constructor({app:e,onNoteSelect:r,excludeNotePaths:n,titleOnly:o=!1,chainType:i="copilot_plus"}){super(e,i),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){if(!ZB(e,this.chainType)){new d_e.Notice(nz.NON_MARKDOWN_FILES_RESTRICTED);return}this.onNoteSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof d_e.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 f_e=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 xlr=require("obsidian"),dY=class extends xlr.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)}};vo();var db=j(X()),q5e=require("obsidian");vo();bt();fr();fn();wn();function p_e({disabled:t=!1,size:e="fit",variant:r="ghost2",className:n,value:o,onChange:i}){let[a,s]=(0,db.useState)(null),u=_n(),l=u.activeModels.find(c=>c.enabled&&en(c)===o);return db.default.createElement(_$,null,db.default.createElement(v$,{asChild:!0},db.default.createElement(he,{variant:r,size:e,disabled:t,className:me("tw-text-muted",n)},a?db.default.createElement("span",{className:"tw-text-error"},"Model Load Failed"):l?db.default.createElement(g8e,{model:l,iconSize:8}):"Select Model",!t&&db.default.createElement(Li,{className:"tw-mt-0.5 tw-size-5"}))),db.default.createElement(Q_,{align:"start"},u.activeModels.filter(c=>c.enabled).map(c=>{let{hasApiKey:d,errorNotice:f}=QB(c,u);return db.default.createElement(Ui,{key:en(c),onSelect:async p=>{if(!d&&f){p.preventDefault(),new q5e.Notice(f);return}try{s(null),i(en(c))}catch(h){let m="Model switch failed: "+Xn(h);s(m),new q5e.Notice(m);let g=u.activeModels.find(y=>y.enabled&&en(y)===o);g&&i(en(g))}},className:d?"":"tw-cursor-not-allowed tw-opacity-50"},db.default.createElement(g8e,{model:c,iconSize:12}))})))}sa();nr();fr();var m_e=require("obsidian");nr();var lV=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 m_e.TFile)try{let l=await n.parseFile(u,r);e=e.replace(a[0],`
<${d8}>
<name>${s}</name>
<content>
${l}
</content>
</${d8}>
`)}catch(l){console.error(`Error processing embedded PDF ${s}:`,l),e=e.replace(a[0],`
<${d8}>
<name>${s}</name>
<error>Could not process PDF</error>
</${d8}>
`)}}return e}async processContextNotes(e,r,n,o,i,a,s){let u="",l=async(d,f=l8)=>{try{if(e.has(d.path)){console.log(`Skipping note ${d.path} as it was included via custom prompt.`);return}if(console.log(`Processing note: ${d.path}, extension: ${d.extension}, chain: ${s}`),!r.supportsExtension(d.extension)){console.warn(`Unsupported file type: ${d.extension}`);return}if(!Rb(s)&&d.extension!=="md"&&d.extension!=="canvas"){console.warn(`File type ${d.extension} requires Copilot Plus mode for context processing.`),new m_e.Notice(nz.NON_MARKDOWN_FILES_RESTRICTED);return}let p=await r.parseFile(d,n);d.extension==="md"&&Rb(s)&&(p=await this.processEmbeddedPDFs(p,n,r));let h=await n.adapter.stat(d.path),m=h?new Date(h.ctime).toISOString():"Unknown",g=h?new Date(h.mtime).toISOString():"Unknown";u+=`
<${f}>
<title>${d.basename}</title>
<path>${d.path}</path>
<ctime>${m}</ctime>
<mtime>${g}</mtime>
<content>
${p}
</content>
</${f}>`}catch(p){console.error(`Error processing file ${d.path}:`,p),u+=`
<${f}_error>
<title>${d.basename}</title>
<path>${d.path}</path>
<error>[Error: Could not process file]</error>
</${f}_error>`}},c=new Set;i&&a&&(await l(a,"active_note"),c.add(a.path));for(let d of o)c.has(d.path)||(await l(d),c.add(d.path));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})])}processSelectedTextContexts(){let e=Nj();if(!e||e.length===0)return"";let r="";for(let n of e)r+=`
<${Em}>
<title>${n.noteTitle}</title>
<path>${n.notePath}</path>
<start_line>${n.startLine.toString()}</start_line>
<end_line>${n.endLine.toString()}</end_line>
<content>
${n.content}
</content>
</${Em}>`;return r}};wn();qye();fr();bt();r7();fr();fn();var oWe=require("obsidian"),tt=j(X());var Bn=j(X()),Qi=j(Ilr());function uN(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 ZHn=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 x$(t,e,r){let n=YHn(t),{webkitRelativePath:o}=t,i=typeof e=="string"?e:typeof o=="string"&&o.length>0?o:`./${t.name}`;return typeof n.path!="string"&&Mlr(n,"path",i),r!==void 0&&Object.defineProperty(n,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),Mlr(n,"relativePath",i),n}function YHn(t){let{name:e}=t;if(e&&e.lastIndexOf(".")!==-1&&!t.type){let n=e.split(".").pop().toLowerCase(),o=ZHn.get(n);o&&Object.defineProperty(t,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return t}function Mlr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!1,configurable:!1,enumerable:!0})}var XHn=[".DS_Store","Thumbs.db"];function V5e(t){return uN(this,void 0,void 0,function*(){return h_e(t)&&QHn(t.dataTransfer)?nVn(t.dataTransfer,t.type):eVn(t)?tVn(t):Array.isArray(t)&&t.every(e=>"getFile"in e&&typeof e.getFile=="function")?rVn(t):[]})}function QHn(t){return h_e(t)}function eVn(t){return h_e(t)&&h_e(t.target)}function h_e(t){return typeof t=="object"&&t!==null}function tVn(t){return H5e(t.target.files).map(e=>x$(e))}function rVn(t){return uN(this,void 0,void 0,function*(){return(yield Promise.all(t.map(r=>r.getFile()))).map(r=>x$(r))})}function nVn(t,e){return uN(this,void 0,void 0,function*(){if(t.items){let r=H5e(t.items).filter(o=>o.kind==="file");if(e!=="drop")return r;let n=yield Promise.all(r.map(oVn));return Rlr(jlr(n))}return Rlr(H5e(t.files).map(r=>x$(r)))})}function Rlr(t){return t.filter(e=>XHn.indexOf(e.name)===-1)}function H5e(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 oVn(t){if(typeof t.webkitGetAsEntry!="function")return Nlr(t);let e=t.webkitGetAsEntry();return e&&e.isDirectory?Dlr(e):Nlr(t,e)}function jlr(t){return t.reduce((e,r)=>[...e,...Array.isArray(r)?jlr(r):[r]],[])}function Nlr(t,e){return uN(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,x$(a)}}let n=t.getAsFile();if(!n)throw new Error(`${t} is not a File`);return x$(n,(r=e?.fullPath)!==null&&r!==void 0?r:void 0)})}function iVn(t){return uN(this,void 0,void 0,function*(){return t.isDirectory?Dlr(t):aVn(t)})}function Dlr(t){let e=t.createReader();return new Promise((r,n)=>{let o=[];function i(){e.readEntries(a=>uN(this,void 0,void 0,function*(){if(a.length){let s=Promise.all(a.map(iVn));o.push(s),i()}else try{let s=yield Promise.all(o);r(s)}catch(s){n(s)}}),a=>{n(a)})}i()})}function aVn(t){return uN(this,void 0,void 0,function*(){return new Promise((e,r)=>{t.file(n=>{let o=x$(n,t.fullPath);e(o)},n=>{r(n)})})})}var g_e=j(Llr());function Flr(t){return lVn(t)||uVn(t)||qlr(t)||sVn()}function sVn(){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 uVn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function lVn(t){if(Array.isArray(t))return K5e(t)}function klr(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 $lr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?klr(Object(r),!0).forEach(function(n){Ulr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):klr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ulr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fY(t,e){return fVn(t)||dVn(t,e)||qlr(t,e)||cVn()}function cVn(){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 qlr(t,e){if(t){if(typeof t=="string")return K5e(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 K5e(t,e)}}function K5e(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 dVn(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 fVn(t){if(Array.isArray(t))return t}var pVn=typeof g_e.default=="function"?g_e.default:g_e.default.default,mVn="file-invalid-type",hVn="file-too-large",gVn="file-too-small",yVn="too-many-files";var bVn=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:mVn,message:"File type must be ".concat(n)}},Blr=function(e){return{code:hVn,message:"File is larger than ".concat(e," ").concat(e===1?"byte":"bytes")}},zlr=function(e){return{code:gVn,message:"File is smaller than ".concat(e," ").concat(e===1?"byte":"bytes")}},Hlr={code:yVn,message:"Too many files"};function G5e(t,e){var r=t.type==="application/x-moz-file"||pVn(t,e);return[r,r?null:bVn(e)]}function J5e(t,e,r){if(S$(t.size))if(S$(e)&&S$(r)){if(t.size>r)return[!1,Blr(r)];if(t.size<e)return[!1,zlr(e)]}else{if(S$(e)&&t.size<e)return[!1,zlr(e)];if(S$(r)&&t.size>r)return[!1,Blr(r)]}return[!0,null]}function S$(t){return t!=null}function Vlr(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=G5e(u,r),c=fY(l,1),d=c[0],f=J5e(u,n,o),p=fY(f,1),h=p[0],m=s?s(u):null;return d&&h&&!m})}function pY(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function mY(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 Z5e(t){t.preventDefault()}function _Vn(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function vVn(t){return t.indexOf("Edge/")!==-1}function Wlr(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return _Vn(t)||vVn(t)}function rv(){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!pY(n)&&s&&s.apply(void 0,[n].concat(i)),pY(n)})}}function Klr(){return"showOpenFilePicker"in window}function Glr(t){if(S$(t)){var e=Object.entries(t).filter(function(r){var n=fY(r,2),o=n[0],i=n[1],a=!0;return Xlr(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(Qlr))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),a=!1),a}).reduce(function(r,n){var o=fY(n,2),i=o[0],a=o[1];return $lr($lr({},r),{},Ulr({},i,a))},{});return[{description:"Files",accept:e}]}return t}function Jlr(t){if(S$(t))return Object.entries(t).reduce(function(e,r){var n=fY(r,2),o=n[0],i=n[1];return[].concat(Flr(e),[o],Flr(i))},[]).filter(function(e){return Xlr(e)||Qlr(e)}).join(",")}function Zlr(t){return t instanceof DOMException&&(t.name==="AbortError"||t.code===t.ABORT_ERR)}function Ylr(t){return t instanceof DOMException&&(t.name==="SecurityError"||t.code===t.SECURITY_ERR)}function Xlr(t){return t==="audio/*"||t==="video/*"||t==="image/*"||t==="text/*"||t==="application/*"||/\w+\/[-+.\w]+/g.test(t)}function Qlr(t){return/^.*\.[\w]+$/.test(t)}var wVn=["children"],xVn=["open"],SVn=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],CVn=["refKey","onChange","onClick"];function OVn(t){return TVn(t)||PVn(t)||rcr(t)||EVn()}function EVn(){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 PVn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function TVn(t){if(Array.isArray(t))return X5e(t)}function Y5e(t,e){return MVn(t)||IVn(t,e)||rcr(t,e)||AVn()}function AVn(){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 rcr(t,e){if(t){if(typeof t=="string")return X5e(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 X5e(t,e)}}function X5e(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 IVn(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 MVn(t){if(Array.isArray(t))return t}function ecr(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 Cs(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ecr(Object(r),!0).forEach(function(n){Q5e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ecr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Q5e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y_e(t,e){if(t==null)return{};var r=RVn(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 RVn(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 tWe=(0,Bn.forwardRef)(function(t,e){var r=t.children,n=y_e(t,wVn),o=rWe(n),i=o.open,a=y_e(o,xVn);return(0,Bn.useImperativeHandle)(e,function(){return{open:i}},[i]),Bn.default.createElement(Bn.Fragment,null,r(Cs(Cs({},a),{},{open:i})))});tWe.displayName="Dropzone";var ncr={disabled:!1,getFilesFromEvent:V5e,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};tWe.defaultProps=ncr;tWe.propTypes={children:Qi.default.func,accept:Qi.default.objectOf(Qi.default.arrayOf(Qi.default.string)),multiple:Qi.default.bool,preventDropOnDocument:Qi.default.bool,noClick:Qi.default.bool,noKeyboard:Qi.default.bool,noDrag:Qi.default.bool,noDragEventsBubbling:Qi.default.bool,minSize:Qi.default.number,maxSize:Qi.default.number,maxFiles:Qi.default.number,disabled:Qi.default.bool,getFilesFromEvent:Qi.default.func,onFileDialogCancel:Qi.default.func,onFileDialogOpen:Qi.default.func,useFsAccessApi:Qi.default.bool,autoFocus:Qi.default.bool,onDragEnter:Qi.default.func,onDragLeave:Qi.default.func,onDragOver:Qi.default.func,onDrop:Qi.default.func,onDropAccepted:Qi.default.func,onDropRejected:Qi.default.func,onError:Qi.default.func,validator:Qi.default.func};var eWe={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function rWe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=Cs(Cs({},ncr),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,h=e.onDropRejected,m=e.onFileDialogCancel,g=e.onFileDialogOpen,y=e.useFsAccessApi,_=e.autoFocus,w=e.preventDropOnDocument,S=e.noClick,C=e.noKeyboard,E=e.noDrag,P=e.noDragEventsBubbling,T=e.onError,I=e.validator,N=(0,Bn.useMemo)(function(){return Jlr(r)},[r]),M=(0,Bn.useMemo)(function(){return Glr(r)},[r]),D=(0,Bn.useMemo)(function(){return typeof g=="function"?g:tcr},[g]),k=(0,Bn.useMemo)(function(){return typeof m=="function"?m:tcr},[m]),F=(0,Bn.useRef)(null),K=(0,Bn.useRef)(null),U=(0,Bn.useReducer)(NVn,eWe),Y=Y5e(U,2),ee=Y[0],L=Y[1],Q=ee.isFocused,z=ee.isFileDialogActive,W=(0,Bn.useRef)(typeof window<"u"&&window.isSecureContext&&y&&Klr()),V=function(){!W.current&&z&&setTimeout(function(){if(K.current){var fe=K.current.files;fe.length||(L({type:"closeDialog"}),k())}},300)};(0,Bn.useEffect)(function(){return window.addEventListener("focus",V,!1),function(){window.removeEventListener("focus",V,!1)}},[K,z,k,W]);var q=(0,Bn.useRef)([]),H=function(fe){F.current&&F.current.contains(fe.target)||(fe.preventDefault(),q.current=[])};(0,Bn.useEffect)(function(){return w&&(document.addEventListener("dragover",Z5e,!1),document.addEventListener("drop",H,!1)),function(){w&&(document.removeEventListener("dragover",Z5e),document.removeEventListener("drop",H))}},[F,w]),(0,Bn.useEffect)(function(){return!n&&_&&F.current&&F.current.focus(),function(){}},[F,_,n]);var G=(0,Bn.useCallback)(function(ne){T?T(ne):console.error(ne)},[T]),Z=(0,Bn.useCallback)(function(ne){ne.preventDefault(),ne.persist(),Me(ne),q.current=[].concat(OVn(q.current),[ne.target]),mY(ne)&&Promise.resolve(o(ne)).then(function(fe){if(!(pY(ne)&&!P)){var be=fe.length,ye=be>0&&Vlr({files:fe,accept:N,minSize:a,maxSize:i,multiple:s,maxFiles:u,validator:I}),ze=be>0&&!ye;L({isDragAccept:ye,isDragReject:ze,isDragActive:!0,type:"setDraggedFiles"}),l&&l(ne)}}).catch(function(fe){return G(fe)})},[o,l,G,P,N,a,i,s,u,I]),de=(0,Bn.useCallback)(function(ne){ne.preventDefault(),ne.persist(),Me(ne);var fe=mY(ne);if(fe&&ne.dataTransfer)try{ne.dataTransfer.dropEffect="copy"}catch{}return fe&&d&&d(ne),!1},[d,P]),pe=(0,Bn.useCallback)(function(ne){ne.preventDefault(),ne.persist(),Me(ne);var fe=q.current.filter(function(ye){return F.current&&F.current.contains(ye)}),be=fe.indexOf(ne.target);be!==-1&&fe.splice(be,1),q.current=fe,!(fe.length>0)&&(L({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),mY(ne)&&c&&c(ne))},[F,c,P]),ae=(0,Bn.useCallback)(function(ne,fe){var be=[],ye=[];ne.forEach(function(ze){var mr=G5e(ze,N),Ti=Y5e(mr,2),yi=Ti[0],yf=Ti[1],fp=J5e(ze,a,i),qi=Y5e(fp,2),md=qi[0],hd=qi[1],bf=I?I(ze):null;if(yi&&md&&!bf)be.push(ze);else{var Vn=[yf,hd];bf&&(Vn=Vn.concat(bf)),ye.push({file:ze,errors:Vn.filter(function(wA){return wA})})}}),(!s&&be.length>1||s&&u>=1&&be.length>u)&&(be.forEach(function(ze){ye.push({file:ze,errors:[Hlr]})}),be.splice(0)),L({acceptedFiles:be,fileRejections:ye,isDragReject:ye.length>0,type:"setFiles"}),f&&f(be,ye,fe),ye.length>0&&h&&h(ye,fe),be.length>0&&p&&p(be,fe)},[L,s,N,a,i,u,f,p,h,I]),Te=(0,Bn.useCallback)(function(ne){ne.preventDefault(),ne.persist(),Me(ne),q.current=[],mY(ne)&&Promise.resolve(o(ne)).then(function(fe){pY(ne)&&!P||ae(fe,ne)}).catch(function(fe){return G(fe)}),L({type:"reset"})},[o,ae,G,P]),Ae=(0,Bn.useCallback)(function(){if(W.current){L({type:"openDialog"}),D();var ne={multiple:s,types:M};window.showOpenFilePicker(ne).then(function(fe){return o(fe)}).then(function(fe){ae(fe,null),L({type:"closeDialog"})}).catch(function(fe){Zlr(fe)?(k(fe),L({type:"closeDialog"})):Ylr(fe)?(W.current=!1,K.current?(K.current.value=null,K.current.click()):G(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."))):G(fe)});return}K.current&&(L({type:"openDialog"}),D(),K.current.value=null,K.current.click())},[L,D,k,y,ae,G,M,s]),ke=(0,Bn.useCallback)(function(ne){!F.current||!F.current.isEqualNode(ne.target)||(ne.key===" "||ne.key==="Enter"||ne.keyCode===32||ne.keyCode===13)&&(ne.preventDefault(),Ae())},[F,Ae]),St=(0,Bn.useCallback)(function(){L({type:"focus"})},[]),Nr=(0,Bn.useCallback)(function(){L({type:"blur"})},[]),Ir=(0,Bn.useCallback)(function(){S||(Wlr()?setTimeout(Ae,0):Ae())},[S,Ae]),Hn=function(fe){return n?null:fe},Yr=function(fe){return C?null:Hn(fe)},Sr=function(fe){return E?null:Hn(fe)},Me=function(fe){P&&fe.stopPropagation()},Ge=(0,Bn.useMemo)(function(){return function(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},fe=ne.refKey,be=fe===void 0?"ref":fe,ye=ne.role,ze=ne.onKeyDown,mr=ne.onFocus,Ti=ne.onBlur,yi=ne.onClick,yf=ne.onDragEnter,fp=ne.onDragOver,qi=ne.onDragLeave,md=ne.onDrop,hd=y_e(ne,SVn);return Cs(Cs(Q5e({onKeyDown:Yr(rv(ze,ke)),onFocus:Yr(rv(mr,St)),onBlur:Yr(rv(Ti,Nr)),onClick:Hn(rv(yi,Ir)),onDragEnter:Sr(rv(yf,Z)),onDragOver:Sr(rv(fp,de)),onDragLeave:Sr(rv(qi,pe)),onDrop:Sr(rv(md,Te)),role:typeof ye=="string"&&ye!==""?ye:"presentation"},be,F),!n&&!C?{tabIndex:0}:{}),hd)}},[F,ke,St,Nr,Ir,Z,de,pe,Te,C,E,n]),je=(0,Bn.useCallback)(function(ne){ne.stopPropagation()},[]),le=(0,Bn.useMemo)(function(){return function(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},fe=ne.refKey,be=fe===void 0?"ref":fe,ye=ne.onChange,ze=ne.onClick,mr=y_e(ne,CVn),Ti=Q5e({accept:N,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:Hn(rv(ye,Te)),onClick:Hn(rv(ze,je)),tabIndex:-1},be,K);return Cs(Cs({},Ti),mr)}},[K,r,s,Te,n]);return Cs(Cs({},ee),{},{isFocused:Q&&!n,getRootProps:Ge,getInputProps:le,rootRef:F,inputRef:K,open:Hn(Ae)})}function NVn(t,e){switch(e.type){case"focus":return Cs(Cs({},t),{},{isFocused:!0});case"blur":return Cs(Cs({},t),{},{isFocused:!1});case"openDialog":return Cs(Cs({},eWe),{},{isFileDialogActive:!0});case"closeDialog":return Cs(Cs({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return Cs(Cs({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return Cs(Cs({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return Cs({},eWe);default:return t}}function tcr(){}var pcr=j(X());sa();fn();var En=j(X());vo();var b_e=j(X());nre();wn();var jVn=$z("tw-inline-flex tw-items-center tw-rounded-md tw-px-2.5 tw-py-0.5 tw-text-ui-smaller tw-text-normal tw-transition-colors focus:tw-outline-none",{variants:{variant:{default:"tw-bg-primary-alt tw-shadow",secondary:"tw-bg-secondary-alt",destructive:"tw-bg-modifier-error tw-shadow",outline:"tw-border tw-border-solid tw-border-border"}},defaultVariants:{variant:"default"}}),up=b_e.forwardRef(({className:t,variant:e,...r},n)=>b_e.createElement("div",{ref:n,className:me(jVn({variant:e}),t),...r}));up.displayName="Badge";oc();var __e=j(X());var ucr=j(X(),1);var ocr=j(X(),1),DVn=j(Ba(),1);kv();var icr=j(ut(),1),LVn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],acr=LVn.reduce((t,e)=>{let r=Ff(`Primitive.${e}`),n=ocr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,icr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var lcr=j(ut(),1),FVn="Separator",scr="horizontal",kVn=["horizontal","vertical"],ccr=ucr.forwardRef((t,e)=>{let{decorative:r,orientation:n=scr,...o}=t,i=$Vn(n)?n:scr,s=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return(0,lcr.jsx)(acr.div,{"data-orientation":i,...s,...o,ref:e})});ccr.displayName=FVn;function $Vn(t){return kVn.includes(t)}var nWe=ccr;wn();var C$=__e.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},o)=>__e.createElement(nWe,{ref:o,decorative:r,orientation:e,className:me("tw-shrink-0 tw-bg-[var(--background-modifier-border)]",e==="horizontal"?"tw-h-px tw-w-full":"tw-h-full tw-w-px",t),...n}));C$.displayName=nWe.displayName;sa();function dcr({note:t,isActive:e=!1,onRemoveContext:r}){return En.default.createElement(up,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},En.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},En.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.basename),e&&En.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),t.extension==="pdf"&&En.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")),En.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>r(t.path),"aria-label":"Remove from context",className:"tw-text-muted"},En.default.createElement(bi,{className:"tw-size-4"})))}function zVn({url:t,onRemoveUrl:e}){return En.default.createElement(up,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},En.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},En.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t),En.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Link")),En.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>e(t),"aria-label":"Remove from context",className:"tw-text-muted"},En.default.createElement(bi,{className:"tw-size-4"})))}function UVn({selectedText:t,onRemoveSelectedText:e}){let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`;return En.default.createElement(up,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},En.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},En.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.noteTitle),En.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r)),En.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>e(t.id),"aria-label":"Remove from context",className:"tw-text-muted"},En.default.createElement(bi,{className:"tw-size-4"})))}var fcr=({activeNote:t,contextNotes:e,contextUrls:r,selectedTextContexts:n=[],onAddContext:o,onRemoveContext:i,onRemoveUrl:a,onRemoveSelectedText:s,showProgressCard:u})=>{let[l]=Ip(),c=Cbe(),d=En.default.useMemo(()=>{let m=new Map(e.map(g=>[g.path,g]));return Array.from(m.values()).filter(g=>g.wasAddedManually?!0:!(t&&g.path===t.path))},[e,t]),f=En.default.useMemo(()=>Array.from(new Set(r)),[r]),p=d.length>0||f.length>0||n.length>0||!!t,h=()=>{switch(c){case"success":return En.default.createElement(SI,{className:"tw-size-4 tw-text-success"});case"loading":return En.default.createElement(tu,{className:"tw-size-4 tw-animate-spin tw-text-loading"});case"error":return En.default.createElement($v,{className:"tw-size-4 tw-text-error"});case"initial":return En.default.createElement(f5,{className:"tw-size-4 tw-text-faint"})}};return En.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-gap-1"},En.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},En.default.createElement(he,{onClick:o,variant:"ghost2",size:"fit",className:"tw-ml-1 tw-rounded-sm tw-border tw-border-solid tw-border-border tw-text-muted"},En.default.createElement(Bh,{className:"tw-size-4"}),!p&&En.default.createElement("span",{className:"tw-pr-1 tw-text-sm tw-leading-4"},"Add context"))),En.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-wrap tw-gap-1"},t&&En.default.createElement(dcr,{key:t.path,note:t,isActive:!0,onRemoveContext:i}),d.map(m=>En.default.createElement(dcr,{key:m.path,note:m,isActive:!1,onRemoveContext:i})),f.map(m=>En.default.createElement(zVn,{key:m,url:m,onRemoveUrl:a})),n.map(m=>En.default.createElement(UVn,{key:m.id,selectedText:m,onRemoveSelectedText:s||(()=>{})}))),l==="project"&&En.default.createElement(En.default.Fragment,null,En.default.createElement(C$,{orientation:"vertical"}),En.default.createElement("div",{className:""},En.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>u()},h()))))};var qVn=({app:t,excludeNotePaths:e,contextNotes:r,setContextNotes:n,includeActiveNote:o,setIncludeActiveNote:i,activeNote:a,contextUrls:s,onRemoveUrl:u,selectedTextContexts:l,onRemoveSelectedText:c,showProgressCard:d})=>{let[f]=Ip();return pcr.default.createElement(fcr,{activeNote:o?a:null,contextNotes:r,onAddContext:()=>{new sN({app:t,onNoteSelect:m=>{a&&m.path===a.path?(i(!0),n(g=>g.filter(y=>y.path!==m.path))):n(g=>[...g,Object.assign(m,{wasAddedManually:!0})])},excludeNotePaths:e,chainType:f}).open()},onRemoveContext:m=>{let g=r.find(_=>_.path===m);g&&g.wasAddedManually?n(_=>_.filter(w=>w.path!==m)):(i(!1),n(_=>_.filter(w=>w.path!==m)))},contextUrls:s,onRemoveUrl:u,selectedTextContexts:l,onRemoveSelectedText:c,showProgressCard:d})},mcr=qVn;var hcr=(0,tt.forwardRef)(({inputMessage:t,setInputMessage:e,handleSendMessage:r,isGenerating:n,onStopGenerating:o,app:i,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,mention:c,selectedImages:d,onAddImage:f,setSelectedImages:p,disableModelSwitch:h,selectedTextContexts:m,onRemoveSelectedText:g,showProgressCard:y},_)=>{let[w,S]=(0,tt.useState)([]),C=(0,tt.useRef)(null),E=(0,tt.useRef)(null),[P,T]=QA(),[I]=Ip(),[N]=jee(),M=_n(),[D,k]=(0,tt.useState)(()=>{let Ge=i.workspace.getActiveFile();return GSe(Ge)?Ge:null}),[F,K]=(0,tt.useState)(null),U=Rb(I),[Y,ee]=(0,tt.useState)(!1),[L,Q]=(0,tt.useState)(!1),[z,W]=(0,tt.useState)(!1),[V,q]=(0,tt.useState)(M.enableAutonomousAgent),[H,G]=(0,tt.useState)(0),Z=["Loading the project context...","Processing context files...","If you have many files in context, this can take a while..."];(0,tt.useImperativeHandle)(_,()=>({focus:()=>{C.current?.focus()}})),(0,tt.useEffect)(()=>{I==="project"?q(!1):q(M.enableAutonomousAgent)},[M.enableAutonomousAgent,I]),(0,tt.useEffect)(()=>{if(I==="project"){K(bu());let Ge=uz(je=>{K(je)});return()=>{Ge()}}else K(null)},[I]),(0,tt.useEffect)(()=>{if(!N)return;let Ge=setInterval(()=>{G(je=>(je+1)%Z.length)},3e3);return()=>clearInterval(Ge)},[N,Z.length]);let de=()=>F&&I==="project"&&F.projectModelKey?F.projectModelKey:P,pe=()=>{if(!U){r();return}let Ge=[];V||(Y&&Ge.push("@vault"),L&&Ge.push("@websearch"),z&&Ge.push("@composer")),r({toolCalls:Ge,contextNotes:a,urls:w})},ae=async Ge=>{let je=Ge.target.value,le=Ge.target.selectionStart,ne=le>0&&je[le-1]==="/"&&(le===1||je[le-2]===" ");e(je),Te();let be=c.extractAllUrls(je).filter(ye=>!w.includes(ye));be.length>0&&Rb(I)&&S(ye=>Array.from(new Set([...ye,...be]))),le>=2&&je.slice(le-2,le)==="[["?Ae(le):ne?ke(le,je):je.slice(-1)==="@"&&U&&St()},Te=()=>{C.current&&(C.current.style.height="auto",C.current.style.height=`${C.current.scrollHeight}px`)};(0,tt.useEffect)(()=>{Te()},[t]);let Ae=Ge=>{(async()=>{let le=lV.getInstance();new sN({app:i,onNoteSelect:async ne=>{let fe=t.slice(0,Ge-2),be=t.slice(Ge-1),ze=JSe(ne.basename,i.vault)?ne.basename:ne.path,mr=`${fe}[[${ze}]]${be}`;e(mr);let Ti=i.workspace.getActiveFile();ne&&await le.addNoteToContext(ne,i.vault,a,Ti,s,l),setTimeout(()=>{if(C.current){let yi=Ge+ze.length+2;C.current.setSelectionRange(yi,yi)}},0)},excludeNotePaths:Me}).open()})()},ke=(Ge,je)=>{let le=Oc.getInstance(),ne=ap(),fe=_be(ne.filter(mr=>mr.showInSlashMenu)),be=fe.map(mr=>mr.title),ye=Ge-1;new dY(i,be,mr=>{let Ti=fe.find(yi=>yi.title===mr);if(Ti){le.recordUsage(Ti);let yi="",yf="";ye>=0&&je[ye]==="/"&&(yi=je.slice(0,ye),yf=je.slice(ye+1));let fp=yi+Ti.content+yf;e(fp),setTimeout(()=>{if(C.current){let qi=yi.length+Ti.content.length;C.current.setSelectionRange(qi,qi),C.current.focus()}},0)}}).open()},St=()=>{let Ge=SZ.map(je=>({title:je,description:Oer(je)}));new dY(i,Ge.map(je=>je.title),je=>{e(t+je+" ")},Ge.map(je=>je.description)).open()},Nr=Ge=>{if(!Ge.nativeEvent.isComposing&&Ge.key==="Enter"){if(!(!Ge.shiftKey&&!oWe.Platform.isMobile||Ge.shiftKey&&oWe.Platform.isMobile))return;Ge.preventDefault(),pe()}},Ir=(0,tt.useCallback)(async Ge=>{let je=Ge.clipboardData?.items;if(!je)return;let le=Array.from(je).filter(ne=>ne.type.indexOf("image")!==-1);if(le.length>0){Ge.preventDefault();let fe=(await Promise.all(le.map(be=>{let ye=be.getAsFile();return ye||null}))).filter(be=>be!==null);fe.length>0&&f(fe)}},[f]);(0,tt.useEffect)(()=>{let Ge=new Set(Hg(t,i.vault)),je=c.extractAllUrls(t);s(le=>le.filter(ne=>{if(ne.wasAddedManually===!0)return!0;let be=ne.wasAddedViaReference===!0;return ne.path===D?.path?be?Ge.has(ne):u:be?Ge.has(ne):!0})),Rb(I)?S(le=>le.filter(ne=>je.includes(ne))):S([])},[t,u,D,c,s,i.vault,I]),(0,tt.useEffect)(()=>{let Ge,je=()=>{clearTimeout(Ge),Ge=setTimeout(()=>{let ne=i.workspace.getActiveFile();k(GSe(ne)?ne:null)},100)},le=i.workspace.on("active-leaf-change",je);return()=>{clearTimeout(Ge),i.workspace.offref(le)}},[i.workspace]);let{getRootProps:Hn,getInputProps:Yr,isDragActive:Sr}=rWe({accept:{"image/*":[".png",".gif",".jpeg",".jpg",".webp"]},onDrop:Ge=>{f(Ge)},noClick:!0,noDragEventsBubbling:!0}),Me=(0,tt.useMemo)(()=>[...a.map(Ge=>Ge.path),...u&&D?[D.path]:[]].filter(Ge=>Ge!=null),[a,u,D]);return tt.default.createElement("div",{className:"tw-flex tw-w-full tw-flex-col tw-gap-0.5 tw-rounded-md tw-border tw-border-solid tw-border-border tw-px-1 tw-pb-1 tw-pt-2 tw-@container/chat-input",ref:E},tt.default.createElement(mcr,{app:i,excludeNotePaths:Me,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,activeNote:D,contextUrls:w,onRemoveUrl:Ge=>S(je=>je.filter(le=>le!==Ge)),selectedTextContexts:m,onRemoveSelectedText:g,showProgressCard:y}),d.length>0&&tt.default.createElement("div",{className:"selected-images"},d.map((Ge,je)=>tt.default.createElement("div",{key:je,className:"image-preview-container"},tt.default.createElement("img",{src:URL.createObjectURL(Ge),alt:Ge.name,className:"selected-image-preview"}),tt.default.createElement("button",{className:"remove-image-button",onClick:()=>p(le=>le.filter((ne,fe)=>fe!==je)),title:"Remove image"},tt.default.createElement(bi,{className:"tw-size-4"}))))),tt.default.createElement("div",{className:"tw-relative",...Hn()},N&&tt.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-bg-primary tw-opacity-80 tw-backdrop-blur-sm"},tt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},tt.default.createElement(tu,{className:"tw-size-4 tw-animate-spin"}),tt.default.createElement("span",{className:"tw-text-sm"},Z[H]))),tt.default.createElement("textarea",{ref:C,className:"tw-max-h-40 tw-min-h-[60px] tw-w-full tw-resize-none tw-overflow-y-auto tw-rounded-md tw-border-none tw-bg-transparent tw-px-2 tw-text-sm tw-text-normal placeholder:tw-text-sm placeholder:tw-text-muted/60 focus-visible:tw-ring-0",placeholder:"Ask anything. [[ for notes. / for custom prompts. "+(U?"@ for tools.":""),value:t,onChange:ae,onKeyDown:Nr,onPaste:Ir,disabled:N}),tt.default.createElement("input",{...Yr()}),Sr&&tt.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-flex tw-items-center tw-justify-center tw-rounded-md tw-border tw-border-dashed tw-bg-primary"},tt.default.createElement("span",null,"Drop images here..."))),tt.default.createElement("div",{className:"tw-flex tw-h-6 tw-justify-between tw-gap-1 tw-px-1"},n?tt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-px-1 tw-text-sm tw-text-muted"},tt.default.createElement(tu,{className:"tw-size-3 tw-animate-spin"}),tt.default.createElement("span",null,"Generating...")):tt.default.createElement(p_e,{variant:"ghost2",size:"fit",disabled:h,value:de(),onChange:Ge=>{I!=="project"&&T(Ge)}}),tt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},n?tt.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>o()},tt.default.createElement(CI,{className:"tw-size-4"}),"Stop"):tt.default.createElement(No,{delayDuration:0},U&&I!=="project"&&tt.default.createElement(Ot,null,tt.default.createElement(Et,{asChild:!0},tt.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>{let Ge=!V;q(Ge),ot("enableAutonomousAgent",Ge)},className:me("tw-mr-2 tw-text-muted hover:tw-text-accent",V&&"tw-text-accent tw-bg-accent/10")},tt.default.createElement(d5,{className:"tw-size-4"}))),tt.default.createElement(xt,{className:"tw-px-1 tw-py-0.5"},"Toggle autonomous agent mode")),!V&&U&&tt.default.createElement(tt.default.Fragment,null,tt.default.createElement(Ot,null,tt.default.createElement(Et,{asChild:!0},tt.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>ee(!Y),className:me("tw-mr-2 tw-text-muted hover:tw-text-accent",Y&&"tw-text-accent tw-bg-accent/10")},tt.default.createElement(Zj,{className:"tw-size-4"}))),tt.default.createElement(xt,{className:"tw-px-1 tw-py-0.5"},"Toggle vault search")),tt.default.createElement(Ot,null,tt.default.createElement(Et,{asChild:!0},tt.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>Q(!L),className:me("tw-mr-2 tw-text-muted hover:tw-text-accent",L&&"tw-text-accent tw-bg-accent/10")},tt.default.createElement(BE,{className:"tw-size-4"}))),tt.default.createElement(xt,{className:"tw-px-1 tw-py-0.5"},"Toggle web search")),tt.default.createElement(Ot,null,tt.default.createElement(Et,{asChild:!0},tt.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>W(!z),className:me("tw-mr-2 tw-text-muted hover:tw-text-accent",z&&"tw-text-accent tw-bg-accent/10")},tt.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},tt.default.createElement(Lm,{className:"tw-size-2"}),tt.default.createElement(qb,{className:"tw-size-3"})))),tt.default.createElement(xt,{className:"tw-px-1 tw-py-0.5"},"Toggle composer (note editing)"))),tt.default.createElement(Ot,null,tt.default.createElement(Et,{asChild:!0},tt.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted hover:tw-text-accent",onClick:()=>{new f_e(i,f).open()}},tt.default.createElement(O5,{className:"tw-size-4"}))),tt.default.createElement(xt,{className:"tw-px-1 tw-py-0.5"},"Add image(s)")),tt.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>pe()},tt.default.createElement(Ub,{className:"!tw-size-3"}),tt.default.createElement("span",null,"chat"))))))});hcr.displayName="ChatInput";var gcr=hcr;vo();nr();wn();fn();var ycr=require("obsidian"),Br=j(X()),bcr=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>Br.default.createElement("div",{className:me("tw-flex tw-gap-1",{"group-hover:opacity-100 opacity-0":!ycr.Platform.isMobile})},t.sender===Do?Br.default.createElement(Br.default.Fragment,null,Br.default.createElement(Ot,null,Br.default.createElement(Et,{asChild:!0},Br.default.createElement(he,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?Br.default.createElement(Fc,{className:"tw-size-4"}):Br.default.createElement($h,{className:"tw-size-4"}))),Br.default.createElement(xt,null,"Copy")),Br.default.createElement(Ot,null,Br.default.createElement(Et,{asChild:!0},Br.default.createElement(he,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},Br.default.createElement(Fm,{className:"tw-size-4"}))),Br.default.createElement(xt,null,"Edit")),Br.default.createElement(Ot,null,Br.default.createElement(Et,{asChild:!0},Br.default.createElement(he,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Br.default.createElement(zh,{className:"tw-size-4"}))),Br.default.createElement(xt,null,"Delete"))):Br.default.createElement(Br.default.Fragment,null,u&&Br.default.createElement(Ot,null,Br.default.createElement(Et,{asChild:!0},Br.default.createElement(he,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},Br.default.createElement(Xj,{className:"tw-size-4"}))),Br.default.createElement(xt,null,"Show Sources")),Br.default.createElement(Ot,null,Br.default.createElement(Et,{asChild:!0},Br.default.createElement(he,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},Br.default.createElement(M5,{className:"tw-size-4"}))),Br.default.createElement(xt,null,"Insert / Replace at cursor")),Br.default.createElement(Ot,null,Br.default.createElement(Et,{asChild:!0},Br.default.createElement(he,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?Br.default.createElement(Fc,{className:"tw-size-4"}):Br.default.createElement($h,{className:"tw-size-4"}))),Br.default.createElement(xt,null,"Copy")),Br.default.createElement(Ot,null,Br.default.createElement(Et,{asChild:!0},Br.default.createElement(he,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},Br.default.createElement(I5,{className:"tw-size-4"}))),Br.default.createElement(xt,null,"Regenerate")),Br.default.createElement(Ot,null,Br.default.createElement(Et,{asChild:!0},Br.default.createElement(he,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Br.default.createElement(zh,{className:"tw-size-4"}))),Br.default.createElement(xt,null,"Delete"))));var Qa=j(X());fn();var cf=j(X(),1);function _cr(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var wcr=j(X(),1);function vcr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function iWe(...t){return e=>{let r=!1,n=t.map(o=>{let i=vcr(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():vcr(t[o],null)}}}}function xcr(...t){return wcr.useCallback(iWe(...t),t)}var Scr=j(X(),1),GVn=j(Ba(),1);var lf=j(X(),1);var cV=j(ut(),1),sWe=lf.forwardRef((t,e)=>{let{children:r,...n}=t,o=lf.Children.toArray(r),i=o.find(VVn);if(i){let a=i.props.children,s=o.map(u=>u===i?lf.Children.count(a)>1?lf.Children.only(null):lf.isValidElement(a)?a.props.children:null:u);return(0,cV.jsx)(aWe,{...n,ref:e,children:lf.isValidElement(a)?lf.cloneElement(a,void 0,s):null})}return(0,cV.jsx)(aWe,{...n,ref:e,children:r})});sWe.displayName="Slot";var aWe=lf.forwardRef((t,e)=>{let{children:r,...n}=t;if(lf.isValidElement(r)){let o=KVn(r);return lf.cloneElement(r,{...WVn(n,r.props),ref:e?iWe(e,o):o})}return lf.Children.count(r)>1?lf.Children.only(null):null});aWe.displayName="SlotClone";var HVn=({children:t})=>(0,cV.jsx)(cV.Fragment,{children:t});function VVn(t){return lf.isValidElement(t)&&t.type===HVn}function WVn(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 KVn(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 Ccr=j(ut(),1),JVn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],v_e=JVn.reduce((t,e)=>{let r=Scr.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?sWe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Ccr.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var O$=j(ut(),1),uWe="Collapsible",[ZVn,j8i]=Xa(uWe),[YVn,lWe]=ZVn(uWe),Ocr=cf.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=Qp({prop:n,defaultProp:o,onChange:a});return(0,O$.jsx)(YVn,{scope:r,disabled:i,contentId:Wl(),open:u,onOpenToggle:cf.useCallback(()=>l(c=>!c),[l]),children:(0,O$.jsx)(v_e.div,{"data-state":pWe(u),"data-disabled":i?"":void 0,...s,ref:e})})});Ocr.displayName=uWe;var Ecr="CollapsibleTrigger",cWe=cf.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=lWe(Ecr,r);return(0,O$.jsx)(v_e.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":pWe(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:_cr(t.onClick,o.onOpenToggle)})});cWe.displayName=Ecr;var dWe="CollapsibleContent",fWe=cf.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=lWe(dWe,t.__scopeCollapsible);return(0,O$.jsx)(rf,{present:r||o.open,children:({present:i})=>(0,O$.jsx)(XVn,{...n,ref:e,present:i})})});fWe.displayName=dWe;var XVn=cf.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=lWe(dWe,r),[s,u]=cf.useState(n),l=cf.useRef(null),c=xcr(e,l),d=cf.useRef(0),f=d.current,p=cf.useRef(0),h=p.current,m=a.open||s,g=cf.useRef(m),y=cf.useRef(void 0);return cf.useEffect(()=>{let _=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(_)},[]),yo(()=>{let _=l.current;if(_){y.current=y.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";let w=_.getBoundingClientRect();d.current=w.height,p.current=w.width,g.current||(_.style.transitionDuration=y.current.transitionDuration,_.style.animationName=y.current.animationName),u(n)}},[a.open,n]),(0,O$.jsx)(v_e.div,{"data-state":pWe(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!m,...i,ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...t.style},children:m&&o})});function pWe(t){return t?"open":"closed"}var Pcr=Ocr;var nv=Pcr,sA=cWe,ov=fWe;wn();E6e();var e6n="shimmer 2s ease-in-out infinite",mWe=({toolName:t,displayName:e,emoji:r,isExecuting:n,result:o,confirmationMessage:i,onAccept:a,onReject:s})=>{let[u,l]=(0,Qa.useState)(!1),c=!n&&o!==null;return Qa.default.createElement(nv,{open:u,onOpenChange:l,disabled:!c,"aria-disabled":!c,className:"tw-my-3 tw-w-full sm:tw-max-w-sm"},Qa.default.createElement("div",{className:me("tw-rounded-md tw-border tw-border-border tw-bg-secondary/50",n&&"tw-relative tw-overflow-hidden")},n&&Qa.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-z-[1] tw-overflow-hidden"},Qa.default.createElement("div",{className:"tw-absolute tw-inset-0 -tw-translate-x-full",style:{background:"linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%)",animation:e6n}})),Qa.default.createElement(sA,{className:me("tw-flex tw-w-full tw-items-center tw-justify-between tw-px-3 tw-py-2.5 tw-text-sm sm:tw-px-4 sm:tw-py-3",c&&"hover:tw-bg-secondary/70",!c&&"tw-cursor-default")},Qa.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qa.default.createElement("span",{className:"tw-text-base"},r),Qa.default.createElement("span",{className:"tw-font-medium"},n?"Calling":"Called"," ",e,n&&"..."),n&&i&&Qa.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"\u2022 ",i,"...")),Qa.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},!n&&a&&s&&Qa.default.createElement(Qa.default.Fragment,null,Qa.default.createElement("button",{onClick:d=>{d.stopPropagation(),a()},className:"hover:tw-bg-green-rgb/20 tw-rounded tw-p-1",title:"Accept"},Qa.default.createElement(Fc,{className:"tw-size-4 tw-text-success"})),Qa.default.createElement("button",{onClick:d=>{d.stopPropagation(),s()},className:"hover:tw-bg-red-rgb/20 tw-rounded tw-p-1",title:"Reject"},Qa.default.createElement(bi,{className:"tw-size-4 tw-text-error"}))),c&&Qa.default.createElement(jm,{className:me("tw-size-4 tw-text-muted tw-transition-transform",u&&"tw-rotate-90")}))),Qa.default.createElement(ov,null,Qa.default.createElement("div",{className:"tw-border-t tw-border-border tw-px-3 tw-py-2.5 sm:tw-px-4 sm:tw-py-3"},Qa.default.createElement("div",{className:"tw-text-sm tw-text-muted"},Qa.default.createElement("pre",{className:"tw-overflow-x-auto tw-whitespace-pre-wrap tw-font-mono tw-text-xs"},o?MH.format(t,o):"No result available"))))))};var Tcr=require("obsidian"),w_e=class extends Tcr.Modal{constructor(e,r){super(e),this.sources=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Sources"}),this.createSourceList(e,this.sources)}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";let a=i.createDiv();a.style.cursor="pointer";let s=a.createSpan();s.style.marginRight="0.5em",s.style.display="inline-block",s.style.width="1em",s.style.transition="transform 0.2s",s.textContent=o.explanation?"\u25B6":"";let u=o.path&&o.path!==o.title?`${o.title} (${o.path})`:o.title,l=a.createEl("a",{href:`obsidian://open?vault=${encodeURIComponent(this.app.vault.getName())}&file=${encodeURIComponent(o.path||o.title)}`,text:u});l.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),this.app.workspace.openLinkText(o.path||o.title,"")}),typeof o.score=="number"&&a.appendChild(document.createTextNode(` - Relevance score: ${o.score.toFixed(4)}`));let c=null;o.explanation&&(c=this.addExplanation(i,o.explanation),c.style.display="none",a.addEventListener("click",d=>{if(d.target!==l&&c){let f=c.style.display!=="none";c.style.display=f?"none":"block",s.style.transform=f?"":"rotate(90deg)"}}))})}addExplanation(e,r){let n=e.createDiv({cls:"search-explanation"});n.style.marginTop="0.5em",n.style.marginLeft="2.5em",n.style.fontSize="0.9em",n.style.color="var(--text-muted)",n.style.borderLeft="2px solid var(--background-modifier-border)",n.style.paddingLeft="0.5em";let o=[];if(r.lexicalMatches&&r.lexicalMatches.length>0){let i=new Set(r.lexicalMatches.map(s=>s.field)),a=new Set(r.lexicalMatches.map(s=>s.query));o.push(`Lexical: matched "${Array.from(a).join('", "')}" in ${Array.from(i).join(", ")}`)}if(r.semanticScore!==void 0&&r.semanticScore>0&&o.push(`Semantic: ${(r.semanticScore*100).toFixed(1)}% similarity`),r.folderBoost&&o.push(`Folder boost: ${r.folderBoost.boostFactor.toFixed(2)}x (${r.folderBoost.documentCount} docs in ${r.folderBoost.folder||"root"})`),r.graphConnections){let i=r.graphConnections,a=[];i.backlinks>0&&a.push(`${i.backlinks} backlinks`),i.coCitations>0&&a.push(`${i.coCitations} co-citations`),i.sharedTags>0&&a.push(`${i.sharedTags} shared tags`),a.length>0&&o.push(`Graph connections: ${i.score.toFixed(1)} score (${a.join(", ")})`)}return r.graphBoost&&!r.graphConnections&&o.push(`Graph boost: ${r.graphBoost.boostFactor.toFixed(2)}x (${r.graphBoost.connections} connections)`),r.baseScore!==r.finalScore&&o.push(`Score: ${r.baseScore.toFixed(4)} \u2192 ${r.finalScore.toFixed(4)}`),o.length>0&&o.forEach(i=>{let a=n.createEl("div");a.style.marginBottom="0.25em",a.textContent=`\u2022 ${i}`}),n}onClose(){let{contentEl:e}=this;e.empty()}};nr();wn();f4();fr();fn();var E$=require("obsidian"),_r=j(X()),Acr=j(Lc());function t6n({context:t}){return!t||!t.notes?.length&&!t.urls?.length?null:_r.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-2"},t.notes.map((e,r)=>_r.default.createElement(Ot,{key:`${r}-${e.path}`},_r.default.createElement(Et,{asChild:!0},_r.default.createElement(up,{variant:"secondary"},_r.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e.basename))),_r.default.createElement(xt,null,e.path))),t.urls.map((e,r)=>_r.default.createElement(Ot,{key:`${r}-${e}`},_r.default.createElement(Et,{asChild:!0},_r.default.createElement(up,{variant:"secondary"},_r.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e))),_r.default.createElement(xt,null,e))))}var r6n=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i,chatHistory:a=[]})=>{let[s,u]=(0,_r.useState)(!1),[l,c]=(0,_r.useState)(!1),[d,f]=(0,_r.useState)(t.message),p=(0,_r.useRef)(null),h=(0,_r.useRef)(null),m=(0,_r.useRef)(null),g=(0,_r.useRef)(t.timestamp?.epoch?String(t.timestamp.epoch):`temp-${Date.now()}-${Math.random()}`),y=()=>(window.__copilotToolCallRoots||(window.__copilotToolCallRoots=new Map),window.__copilotToolCallRoots),w=(0,_r.useRef)((()=>{let U=y();return U.has(g.current)||U.set(g.current,new Map),U.get(g.current)})()),S=()=>{if(!navigator.clipboard||!navigator.clipboard.writeText)return;let U=_ee(t.message);navigator.clipboard.writeText(U).then(()=>{u(!0),setTimeout(()=>{u(!1)},2e3)})},C=(0,_r.useCallback)(U=>{let Y=e.workspace.getActiveFile(),ee=Y?Y.path:"",L=(pe,ae,Te,Ae)=>{let ke="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",St="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",Nr="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)",Ir=`<${ae}>`;if(r&&pe.includes(Ir)){let Yr=new RegExp(`<${ae}>([\\s\\S]*?)<\\/${ae}>`,"g");pe=pe.replace(Yr,(Me,Ge)=>`<details style="${ke}">
<summary style="${St}">${Te}</summary>
<div class="tw-text-muted" style="${Nr}">${Ge.trim()}</div>
</details>
`);let Sr=new RegExp(`<${ae}>([\\s\\S]*)$`);return pe=pe.replace(Sr,(Me,Ge)=>`<div style="${ke}">
<div style="${St}">${Ae}</div>
<div class="tw-text-muted" style="${Nr}">${Ge.trim()}</div>
</div>`),pe}let Hn=new RegExp(`<${ae}>([\\s\\S]*?)<\\/${ae}>`,"g");return pe.replace(Hn,(Yr,Sr)=>`<details style="${ke}">
<summary style="${St}">${Te}</summary>
<div class="tw-text-muted" style="${Nr}">${Sr.trim()}</div>
</details>
`)},Q=pe=>L(pe,"think","Thought for a while","Thinking..."),z=pe=>{let ae=ke=>{let St=/```xml\s*([\s\S]*?<writeToFile>[\s\S]*?<\/writeToFile>[\s\S]*?)\s*```/g;return ke.replace(St,(Nr,Ir)=>Ir.trim())},Te=ke=>{if(!r)return ke;let St=/```xml\s*([\s\S]*?<writeToFile>[\s\S]*?)$/g;return ke.replace(St,(Nr,Ir)=>Ir.trim())},Ae=ae(pe);return Ae=Te(Ae),L(Ae,"writeToFile","Generated new content","Generating changes...")},W=(pe,ae,Te)=>pe.split(/(```[\s\S]*?```|`[^`]*`)/g).map((ke,St)=>St%2===0?ke.replace(ae,(Nr,Ir)=>{let Hn=e.metadataCache.getFirstLinkpathDest(Ir,ee);return Hn?Te(Hn):Nr}):ke).join(""),V=U.replace(/\\\[\s*/g,"$$").replace(/\s*\\\]/g,"$$").replace(/\\\(\s*/g,"$").replace(/\s*\\\)/g,"$"),q=W(V,/!\[\[(.*?)]]/g,pe=>`![](${e.vault.getResourcePath(pe)})`),H=Q(q),G=z(H),Z=E(G);return W(Z,/(?<!!)\[\[([^\]]+)]]/g,pe=>`<a href="obsidian://open?file=${encodeURIComponent(pe.path)}">${pe.basename}</a>`)},[e,r]),E=U=>{let Y=U.split(`
#### Sources:
`);if(Y.length!==2)return U;let[ee,L]=Y,Q=L.split(`
`).map(z=>{let W=z.match(/- \[\[(.*?)\]\]/);return W?`<li>[[${W[1]}]]</li>`:z}).join(`
`);return ee+`
<br/>
<details><summary>Sources</summary>
<ul>
`+Q+`
</ul>
</details>`};(0,_r.useEffect)(()=>{let U=!1;if(p.current&&t.sender!==Do){h.current||(h.current=new E$.Component);let Y=C(t.message),ee=bze(Y);if(!U){let L=new Set;p.current.querySelectorAll('[id^="tool-call-"]').forEach(q=>{let H=q.id.replace("tool-call-","");L.add(H)}),p.current.querySelectorAll(".message-segment").forEach(q=>q.remove());let W=0;ee.segments.forEach((q,H)=>{if(q.type==="text"&&q.content.trim()){let G=p.current.children[W],Z=document.createElement("div");Z.className="message-segment",G?p.current.insertBefore(Z,G):p.current.appendChild(Z),E$.MarkdownRenderer.renderMarkdown(q.content,Z,"",h.current),W++}else if(q.type==="toolCall"&&q.toolCall){let G=q.toolCall.id;if(document.getElementById(`tool-call-${G}`)){let de=w.current.get(G);de&&de.render(_r.default.createElement(mWe,{toolName:q.toolCall.toolName,displayName:q.toolCall.displayName,emoji:q.toolCall.emoji,isExecuting:q.toolCall.isExecuting,result:q.toolCall.result||null,confirmationMessage:q.toolCall.confirmationMessage})),W++}else{let de=p.current.children[W],pe=document.createElement("div");pe.className="tool-call-container",pe.id=`tool-call-${G}`,de?p.current.insertBefore(pe,de):p.current.appendChild(pe);let ae=Acr.default.createRoot(pe);w.current.set(G,ae),ae.render(_r.default.createElement(mWe,{toolName:q.toolCall.toolName,displayName:q.toolCall.displayName,emoji:q.toolCall.emoji,isExecuting:q.toolCall.isExecuting,result:q.toolCall.result||null,confirmationMessage:q.toolCall.confirmationMessage})),W++}}});let V=new Set(ee.segments.filter(q=>q.type==="toolCall"&&q.toolCall).map(q=>q.toolCall.id));L.forEach(q=>{if(!V.has(q)){let H=document.getElementById(`tool-call-${q}`);if(H){let G=w.current.get(q);G&&setTimeout(()=>{try{G.unmount()}catch(Z){console.debug("Error unmounting tool call root:",Z)}w.current.delete(q)},0),H.remove()}}})}}return()=>{U=!0}},[t,e,h,r,C]),(0,_r.useEffect)(()=>{let U=h,Y=g.current;return(()=>{let L=y(),Q=Date.now()-60*60*1e3;L.forEach((z,W)=>{let V=parseInt(W);!isNaN(V)&&V<Q&&setTimeout(()=>{z.forEach(q=>{try{q.unmount()}catch{}}),L.delete(W)},0)})})(),()=>{setTimeout(()=>{if(U.current&&(U.current.unload(),U.current=null),Y.startsWith("temp-")){let L=y(),Q=L.get(Y);Q&&(Q.forEach(z=>{try{z.unmount()}catch(W){console.debug("Error unmounting React root during cleanup:",W)}}),L.delete(Y))}},0)}},[]),(0,_r.useEffect)(()=>{l&&m.current&&P(m.current)},[l]),(0,_r.useEffect)(()=>{f(t.message)},[t.message]);let P=U=>{U.style.height="auto",U.style.height=`${U.scrollHeight}px`},T=U=>{f(U.target.value),P(U.target)},I=U=>{U.nativeEvent.isComposing||(U.key==="Enter"&&!U.shiftKey?(U.preventDefault(),D()):U.key==="Escape"&&(U.preventDefault(),N()))},N=()=>{c(!1),f(t.message)},M=()=>{c(!0)},D=()=>{c(!1),o&&o(d)},k=()=>{t.sources&&t.sources.length>0&&new w_e(e,t.sources).open()},F=()=>{let U=e.workspace.getMostRecentLeaf();if((!U||!(U.view instanceof E$.MarkdownView))&&(U=e.workspace.getLeaf(!1),!U||!(U.view instanceof E$.MarkdownView)))return;let ee=U.view.editor.getSelection().length>0,L=_ee(t.message);i8(L,ee)},K=()=>t.content?_r.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3"},t.content.map((U,Y)=>U.type==="text"?_r.default.createElement("div",{key:Y},t.sender===Do&&l?_r.default.createElement("textarea",{ref:m,value:d,onChange:T,onKeyDown:I,autoFocus:!0,className:"edit-textarea"}):t.sender===Do?_r.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):_r.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""})):U.type==="image_url"?_r.default.createElement("div",{key:Y,className:"message-image-content"},_r.default.createElement("img",{src:U.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===Do&&l?_r.default.createElement("textarea",{ref:m,value:d,onChange:T,onKeyDown:I,autoFocus:!0,className:"edit-textarea"}):t.sender===Do?_r.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):_r.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""});return _r.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},_r.default.createElement("div",{className:me("tw-group tw-mx-2 tw-flex tw-gap-2 tw-rounded-md tw-p-2",t.sender===Do&&"tw-border tw-border-solid tw-border-border")},_r.default.createElement("div",{className:"tw-w-6 tw-shrink-0"},t.sender===Do?_r.default.createElement(R5,null):_r.default.createElement(Jj,null)),_r.default.createElement("div",{className:"tw-flex tw-max-w-full tw-grow tw-flex-col tw-gap-2 tw-overflow-hidden"},!l&&_r.default.createElement(t6n,{context:t.context}),_r.default.createElement("div",{className:"message-content"},K()),!r&&_r.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},_r.default.createElement("div",{className:"tw-text-xs tw-text-faint"},t.timestamp?.display),_r.default.createElement(bcr,{message:t,onCopy:S,isCopied:s,onInsertIntoEditor:F,onRegenerate:n,onEdit:M,onDelete:i,onShowSources:k,hasSources:!!(t.sources&&t.sources.length>0)})))))},hWe=r6n;vo();var _Y=j(X());var es=j(X(),1);function qO(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Mcr=j(X(),1);function Icr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function gWe(...t){return e=>{let r=!1,n=t.map(o=>{let i=Icr(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():Icr(t[o],null)}}}}function iv(...t){return Mcr.useCallback(gWe(...t),t)}var Os=j(X(),1);var Rcr=j(X(),1),Ncr=j(Ba(),1);var df=j(X(),1);var dV=j(ut(),1),hY=df.forwardRef((t,e)=>{let{children:r,...n}=t,o=df.Children.toArray(r),i=o.find(o6n);if(i){let a=i.props.children,s=o.map(u=>u===i?df.Children.count(a)>1?df.Children.only(null):df.isValidElement(a)?a.props.children:null:u);return(0,dV.jsx)(yWe,{...n,ref:e,children:df.isValidElement(a)?df.cloneElement(a,void 0,s):null})}return(0,dV.jsx)(yWe,{...n,ref:e,children:r})});hY.displayName="Slot";var yWe=df.forwardRef((t,e)=>{let{children:r,...n}=t;if(df.isValidElement(r)){let o=a6n(r);return df.cloneElement(r,{...i6n(n,r.props),ref:e?gWe(e,o):o})}return df.Children.count(r)>1?df.Children.only(null):null});yWe.displayName="SlotClone";var n6n=({children:t})=>(0,dV.jsx)(dV.Fragment,{children:t});function o6n(t){return df.isValidElement(t)&&t.type===n6n}function i6n(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 a6n(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 jcr=j(ut(),1),s6n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],nm=s6n.reduce((t,e)=>{let r=Rcr.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?hY:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,jcr.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Dcr(t,e){t&&Ncr.flushSync(()=>t.dispatchEvent(e))}var _We=j(ut(),1),u6n="DismissableLayer",bWe="dismissableLayer.update",l6n="dismissableLayer.pointerDownOutside",c6n="dismissableLayer.focusOutside",Lcr,kcr=Os.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),vWe=Os.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Os.useContext(kcr),[c,d]=Os.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Os.useState({}),h=iv(e,P=>d(P)),m=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),_=c?m.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=y,C=p6n(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=m6n(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return q1(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Os.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Lcr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Fcr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Lcr)}},[c,f,r,l]),Os.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Fcr())},[c,l]),Os.useEffect(()=>{let P=()=>p({});return document.addEventListener(bWe,P),()=>document.removeEventListener(bWe,P)},[]),(0,_We.jsx)(nm.div,{...u,ref:h,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:qO(t.onFocusCapture,E.onFocusCapture),onBlurCapture:qO(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:qO(t.onPointerDownCapture,C.onPointerDownCapture)})});vWe.displayName=u6n;var d6n="DismissableLayerBranch",f6n=Os.forwardRef((t,e)=>{let r=Os.useContext(kcr),n=Os.useRef(null),o=iv(e,n);return Os.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,_We.jsx)(nm.div,{...t,ref:o})});f6n.displayName=d6n;function p6n(t,e=globalThis?.document){let r=un(t),n=Os.useRef(!1),o=Os.useRef(()=>{});return Os.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){$cr(l6n,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 m6n(t,e=globalThis?.document){let r=un(t),n=Os.useRef(!1);return Os.useEffect(()=>{let o=i=>{i.target&&!n.current&&$cr(c6n,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 Fcr(){let t=new CustomEvent(bWe);document.dispatchEvent(t)}function $cr(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?Dcr(o,i):o.dispatchEvent(i)}var fb=j(X(),1);var Hcr=j(ut(),1),wWe="focusScope.autoFocusOnMount",xWe="focusScope.autoFocusOnUnmount",Bcr={bubbles:!1,cancelable:!0},h6n="FocusScope",SWe=fb.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=fb.useState(null),l=un(o),c=un(i),d=fb.useRef(null),f=iv(e,m=>u(m)),p=fb.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;fb.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:lN(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||lN(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let T of E)T.removedNodes.length>0&&lN(s)};var m=_,g=w,y=S;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(S);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),fb.useEffect(()=>{if(s){Ucr.add(p);let m=document.activeElement;if(!s.contains(m)){let y=new CustomEvent(wWe,Bcr);s.addEventListener(wWe,l),s.dispatchEvent(y),y.defaultPrevented||(g6n(w6n(Vcr(s)),{select:!0}),document.activeElement===m&&lN(s))}return()=>{s.removeEventListener(wWe,l),setTimeout(()=>{let y=new CustomEvent(xWe,Bcr);s.addEventListener(xWe,c),s.dispatchEvent(y),y.defaultPrevented||lN(m??document.body,{select:!0}),s.removeEventListener(xWe,c),Ucr.remove(p)},0)}}},[s,l,c,p]);let h=fb.useCallback(m=>{if(!r&&!n||p.paused)return;let g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){let _=m.currentTarget,[w,S]=y6n(_);w&&S?!m.shiftKey&&y===S?(m.preventDefault(),r&&lN(w,{select:!0})):m.shiftKey&&y===w&&(m.preventDefault(),r&&lN(S,{select:!0})):y===_&&m.preventDefault()}},[r,n,p.paused]);return(0,Hcr.jsx)(nm.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});SWe.displayName=h6n;function g6n(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(lN(n,{select:e}),document.activeElement!==r)return}function y6n(t){let e=Vcr(t),r=zcr(e,t),n=zcr(e.reverse(),t);return[r,n]}function Vcr(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 zcr(t,e){for(let r of t)if(!b6n(r,{upTo:e}))return r}function b6n(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 _6n(t){return t instanceof HTMLInputElement&&"select"in t}function lN(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&_6n(t)&&e&&t.select()}}var Ucr=v6n();function v6n(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=qcr(t,e),t.unshift(e)},remove(e){t=qcr(t,e),t[0]?.resume()}}}function qcr(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function w6n(t){return t.filter(e=>e.tagName!=="A")}var Cg=j(X(),1);var Wcr=j(X(),1);var CWe=j(ut(),1),x6n="Arrow",Kcr=Wcr.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,CWe.jsx)(nm.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,CWe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Kcr.displayName=x6n;var Gcr=Kcr;var cN=j(ut(),1);var OWe="Popper",[Jcr,EWe]=Xa(OWe),[C6n,Zcr]=Jcr(OWe),Ycr=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Cg.useState(null);return(0,cN.jsx)(C6n,{scope:e,anchor:n,onAnchorChange:o,children:r})};Ycr.displayName=OWe;var Xcr="PopperAnchor",Qcr=Cg.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=Zcr(Xcr,r),a=Cg.useRef(null),s=iv(e,a);return Cg.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,cN.jsx)(nm.div,{...o,ref:s})});Qcr.displayName=Xcr;var PWe="PopperContent",[O6n,E6n]=Jcr(PWe),edr=Cg.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:h,...m}=t,g=Zcr(PWe,r),[y,_]=Cg.useState(null),w=iv(e,Z=>_(Z)),[S,C]=Cg.useState(null),E=L1(S),P=E?.width??0,T=E?.height??0,I=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},M=Array.isArray(l)?l:[l],D=M.length>0,k={padding:N,boundary:M.filter(T6n),altBoundary:D},{refs:F,floatingStyles:K,placement:U,isPositioned:Y,middlewareData:ee}=W1({strategy:"fixed",placement:I,whileElementsMounted:(...Z)=>oA(...Z,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[K1({mainAxis:o+T,alignmentAxis:a}),u&&G1({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?J1():void 0,...k}),u&&Z1({...k}),Y1({...k,apply:({elements:Z,rects:de,availableWidth:pe,availableHeight:ae})=>{let{width:Te,height:Ae}=de.reference,ke=Z.floating.style;ke.setProperty("--radix-popper-available-width",`${pe}px`),ke.setProperty("--radix-popper-available-height",`${ae}px`),ke.setProperty("--radix-popper-anchor-width",`${Te}px`),ke.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),S&&Q1({element:S,padding:s}),A6n({arrowWidth:P,arrowHeight:T}),f&&X1({strategy:"referenceHidden",...k})]}),[L,Q]=ndr(U),z=un(h);yo(()=>{Y&&z?.()},[Y,z]);let W=ee.arrow?.x,V=ee.arrow?.y,q=ee.arrow?.centerOffset!==0,[H,G]=Cg.useState();return yo(()=>{y&&G(window.getComputedStyle(y).zIndex)},[y]),(0,cN.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:Y?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[ee.transformOrigin?.x,ee.transformOrigin?.y].join(" "),...ee.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,cN.jsx)(O6n,{scope:r,placedSide:L,onArrowChange:C,arrowX:W,arrowY:V,shouldHideArrow:q,children:(0,cN.jsx)(nm.div,{"data-side":L,"data-align":Q,...m,ref:w,style:{...m.style,animation:Y?void 0:"none"}})})})});edr.displayName=PWe;var tdr="PopperArrow",P6n={top:"bottom",right:"left",bottom:"top",left:"right"},rdr=Cg.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=E6n(tdr,n),a=P6n[i.placedSide];return(0,cN.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,cN.jsx)(Gcr,{...o,ref:r,style:{...o.style,display:"block"}})})});rdr.displayName=tdr;function T6n(t){return t!==null}var A6n=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]=ndr(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,h="",m="";return l==="bottom"?(h=a?d:`${f}px`,m=`${-u}px`):l==="top"?(h=a?d:`${f}px`,m=`${n.floating.height+u}px`):l==="right"?(h=`${-u}px`,m=a?d:`${p}px`):l==="left"&&(h=`${n.floating.width+u}px`,m=a?d:`${p}px`),{data:{x:h,y:m}}}});function ndr(t){let[e,r="center"]=t.split("-");return[e,r]}var odr=Ycr,TWe=Qcr,idr=edr,adr=rdr;var x_e=j(X(),1),sdr=j(Ba(),1);var udr=j(ut(),1),M6n="Portal",AWe=x_e.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=x_e.useState(!1);yo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?sdr.default.createPortal((0,udr.jsx)(nm.div,{...n,ref:e}),a):null});AWe.displayName=M6n;var O_e=j(X());var lp=j(X());var S_e=m$();var IWe=function(){},gY=lp.forwardRef(function(t,e){var r=lp.useRef(null),n=lp.useState({onScrollCapture:IWe,onWheelCapture:IWe,onTouchMoveCapture:IWe}),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,h=t.inert,m=t.allowPinchZoom,g=t.as,y=g===void 0?"div":g,_=t.gapMode,w=oN(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=p$([r,e]),E=Ni(Ni({},w),o);return lp.createElement(lp.Fragment,null,c&&lp.createElement(S,{sideCar:S_e,removeScrollBar:l,shards:d,noIsolation:p,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:r,gapMode:_}),a?lp.cloneElement(lp.Children.only(s),Ni(Ni({},E),{ref:C})):lp.createElement(y,Ni({},E,{className:u,ref:C}),s))});gY.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gY.classNames={fullWidth:X_,zeroRight:Y_};var ja=j(X());var MWe=!1;if(typeof window<"u")try{yY=Object.defineProperty({},"passive",{get:function(){return MWe=!0,!0}}),window.addEventListener("test",yY,yY),window.removeEventListener("test",yY,yY)}catch{MWe=!1}var yY,P$=MWe?{passive:!1}:!1;var R6n=function(t){return t.tagName==="TEXTAREA"},ldr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!R6n(t)&&r[e]==="visible")},N6n=function(t){return ldr(t,"overflowY")},j6n=function(t){return ldr(t,"overflowX")},RWe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=cdr(t,n);if(o){var i=ddr(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},D6n=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},L6n=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},cdr=function(t,e){return t==="v"?N6n(e):j6n(e)},ddr=function(t,e){return t==="v"?D6n(e):L6n(e)},F6n=function(t,e){return t==="h"&&e==="rtl"?-1:1},fdr=function(t,e,r,n,o){var i=F6n(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=ddr(t,s),h=p[0],m=p[1],g=p[2],y=m-g-i*h;(h||y)&&cdr(t,s)&&(d+=y,f+=h),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 C_e=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},pdr=function(t){return[t.deltaX,t.deltaY]},mdr=function(t){return t&&"current"in t?t.current:t},k6n=function(t,e){return t[0]===e[0]&&t[1]===e[1]},$6n=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},B6n=0,fV=[];function hdr(t){var e=ja.useRef([]),r=ja.useRef([0,0]),n=ja.useRef(),o=ja.useState(B6n++)[0],i=ja.useState(iA)[0],a=ja.useRef(t);ja.useEffect(function(){a.current=t},[t]),ja.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=tV([t.lockRef.current],(t.shards||[]).map(mdr),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=ja.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var y=C_e(m),_=r.current,w="deltaX"in m?m.deltaX:_[0]-y[0],S="deltaY"in m?m.deltaY:_[1]-y[1],C,E=m.target,P=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&P==="h"&&E.type==="range")return!1;var T=RWe(P,E);if(!T)return!0;if(T?C=P:(C=P==="v"?"h":"v",T=RWe(P,E)),!T)return!1;if(!n.current&&"changedTouches"in m&&(w||S)&&(n.current=C),!C)return!0;var I=n.current||C;return fdr(I,g,m,I==="h"?w:S,!0)},[]),u=ja.useCallback(function(m){var g=m;if(!(!fV.length||fV[fV.length-1]!==i)){var y="deltaY"in g?pdr(g):C_e(g),_=e.current.filter(function(C){return C.name===g.type&&(C.target===g.target||g.target===C.shadowParent)&&k6n(C.delta,y)})[0];if(_&&_.should){g.cancelable&&g.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(mdr).filter(Boolean).filter(function(C){return C.contains(g.target)}),S=w.length>0?s(g,w[0]):!a.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),l=ja.useCallback(function(m,g,y,_){var w={name:m,delta:g,target:y,should:_,shadowParent:z6n(y)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),c=ja.useCallback(function(m){r.current=C_e(m),n.current=void 0},[]),d=ja.useCallback(function(m){l(m.type,pdr(m),m.target,s(m,t.lockRef.current))},[]),f=ja.useCallback(function(m){l(m.type,C_e(m),m.target,s(m,t.lockRef.current))},[]);ja.useEffect(function(){return fV.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,P$),document.addEventListener("touchmove",u,P$),document.addEventListener("touchstart",c,P$),function(){fV=fV.filter(function(m){return m!==i}),document.removeEventListener("wheel",u,P$),document.removeEventListener("touchmove",u,P$),document.removeEventListener("touchstart",c,P$)}},[]);var p=t.removeScrollBar,h=t.inert;return ja.createElement(ja.Fragment,null,h?ja.createElement(i,{styles:$6n(o)}):null,p?ja.createElement(g$,{gapMode:t.gapMode}):null)}function z6n(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var gdr=h$(S_e,hdr);var ydr=O_e.forwardRef(function(t,e){return O_e.createElement(gY,Ni({},t,{ref:e,sideCar:gdr}))});ydr.classNames=gY.classNames;var NWe=ydr;var Jl=j(ut(),1),jWe="Popover",[bdr,gWi]=Xa(jWe,[EWe]),bY=EWe(),[U6n,dN]=bdr(jWe),_dr=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=bY(e),u=es.useRef(null),[l,c]=es.useState(!1),[d=!1,f]=Qp({prop:n,defaultProp:o,onChange:i});return(0,Jl.jsx)(odr,{...s,children:(0,Jl.jsx)(U6n,{scope:e,contentId:Wl(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:es.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:es.useCallback(()=>c(!0),[]),onCustomAnchorRemove:es.useCallback(()=>c(!1),[]),modal:a,children:r})})};_dr.displayName=jWe;var vdr="PopoverAnchor",q6n=es.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=dN(vdr,r),i=bY(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return es.useEffect(()=>(a(),()=>s()),[a,s]),(0,Jl.jsx)(TWe,{...i,...n,ref:e})});q6n.displayName=vdr;var wdr="PopoverTrigger",xdr=es.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=dN(wdr,r),i=bY(r),a=iv(e,o.triggerRef),s=(0,Jl.jsx)(nm.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Pdr(o.open),...n,ref:a,onClick:qO(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,Jl.jsx)(TWe,{asChild:!0,...i,children:s})});xdr.displayName=wdr;var DWe="PopoverPortal",[H6n,V6n]=bdr(DWe,{forceMount:void 0}),Sdr=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=dN(DWe,e);return(0,Jl.jsx)(H6n,{scope:e,forceMount:r,children:(0,Jl.jsx)(rf,{present:r||i.open,children:(0,Jl.jsx)(AWe,{asChild:!0,container:o,children:n})})})};Sdr.displayName=DWe;var pV="PopoverContent",Cdr=es.forwardRef((t,e)=>{let r=V6n(pV,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=dN(pV,t.__scopePopover);return(0,Jl.jsx)(rf,{present:n||i.open,children:i.modal?(0,Jl.jsx)(W6n,{...o,ref:e}):(0,Jl.jsx)(K6n,{...o,ref:e})})});Cdr.displayName=pV;var W6n=es.forwardRef((t,e)=>{let r=dN(pV,t.__scopePopover),n=es.useRef(null),o=iv(e,n),i=es.useRef(!1);return es.useEffect(()=>{let a=n.current;if(a)return nN(a)},[]),(0,Jl.jsx)(NWe,{as:hY,allowPinchZoom:!0,children:(0,Jl.jsx)(Odr,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:qO(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:qO(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:qO(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),K6n=es.forwardRef((t,e)=>{let r=dN(pV,t.__scopePopover),n=es.useRef(!1),o=es.useRef(!1);return(0,Jl.jsx)(Odr,{...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()}})}),Odr=es.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=dN(pV,r),p=bY(r);return H1(),(0,Jl.jsx)(SWe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Jl.jsx)(vWe,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,Jl.jsx)(idr,{"data-state":Pdr(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)"}})})})}),Edr="PopoverClose",G6n=es.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=dN(Edr,r);return(0,Jl.jsx)(nm.button,{type:"button",...n,ref:e,onClick:qO(t.onClick,()=>o.onOpenChange(!1))})});G6n.displayName=Edr;var J6n="PopoverArrow",Z6n=es.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=bY(r);return(0,Jl.jsx)(adr,{...o,...n,ref:e})});Z6n.displayName=J6n;function Pdr(t){return t?"open":"closed"}var Tdr=_dr;var Adr=xdr,Idr=Sdr,LWe=Cdr;wn();var Mdr=Tdr,Rdr=Adr;var FWe=_Y.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>_Y.createElement(Idr,{container:n??activeDocument.body},_Y.createElement(LWe,{ref:i,align:e,sideOffset:r,className:me("tw-z-popover tw-w-72 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-4 tw-text-normal tw-shadow-md tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",t),...o})));FWe.displayName=LWe.displayName;nr();var kWe=j(X()),E_e=kWe.createContext(void 0),mV=kWe.createContext(void 0);var hV=j(X());function $We(){let[t,e]=(0,hV.useState)(null),r=(0,hV.useContext)(mV);return(0,hV.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(Kg.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(Kg.ACTIVE_LEAF_CHANGE,n)}},[r]),t}wn();fn();var vY=require("obsidian"),Xe=j(X());function X6n(t){let[e,r]=(0,Xe.useState)([]),n=$We();return(0,Xe.useEffect)(()=>{async function o(){if(n?.path)try{let a=await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().getDb();if(!a){r([]);return}let s=await abe({db:a,filePath:n.path});r(s)}catch(i){console.warn("Failed to fetch relevant notes:",i),r([])}}o()},[n?.path,t]),e}function Q6n(t,e){let[r,n]=(0,Xe.useState)(!0);return(0,Xe.useEffect)(()=>{if(!t)return;async function o(){try{let a=await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().hasIndex(t);n(a)}catch{n(!1)}}o()},[t,e]),r}function e8n({score:t}){let e=ibe(t),r="\u{1F534}";return e===2&&(r="\u{1F7E0}"),e===3&&(r="\u{1F7E2}"),Xe.default.createElement("span",{className:"tw-text-sm"},r)}function t8n({note:t,onAddToChat:e,onNavigateToNote:r}){let[n,o]=(0,Xe.useState)(!1),[i,a]=(0,Xe.useState)(null),s=(0,Xe.useCallback)(async()=>{if(i)return;let u=app.vault.getAbstractFileByPath(t.document.path);if(u instanceof vY.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,Xe.useEffect)(()=>{n&&s()},[n,s]),Xe.default.createElement(nv,{open:n,onOpenChange:o,className:"tw-rounded-md tw-border tw-border-solid tw-border-border"},Xe.default.createElement("div",{className:me("tw-flex tw-items-center tw-justify-between tw-gap-2 tw-p-2")},Xe.default.createElement(he,{variant:"ghost2",size:"icon",className:"tw-shrink-0",asChild:!0},Xe.default.createElement(sA,null,Xe.default.createElement(jm,{className:me("tw-size-4 tw-transition-transform tw-duration-200",{"rotate-90":n})}))),Xe.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-2"},Xe.default.createElement(e8n,{score:t.metadata.similarityScore??0})),Xe.default.createElement("div",{className:"tw-flex-1 tw-overflow-hidden"},Xe.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:"tw-block tw-w-full tw-truncate tw-text-sm tw-font-bold tw-text-normal",title:t.document.title},t.document.title)),Xe.default.createElement(Ot,null,Xe.default.createElement(Et,{asChild:!0},Xe.default.createElement(he,{variant:"ghost2",size:"icon",onClick:e,className:"tw-shrink-0"},Xe.default.createElement(kh,{className:"tw-size-4"}))),Xe.default.createElement(xt,null,"Add to Chat"))),Xe.default.createElement(ov,null,Xe.default.createElement("div",{className:"tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2"},Xe.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-wrap tw-break-all tw-text-xs tw-text-muted tw-opacity-75"},t.document.path),i&&Xe.default.createElement("div",{className:"tw-overflow-hidden tw-whitespace-pre-wrap tw-border-t tw-border-border tw-pb-4 tw-pt-2 tw-text-xs tw-text-normal"},i)),Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4 tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2 tw-text-xs tw-text-muted"},t.metadata.similarityScore!=null&&Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xe.default.createElement("span",null,"Similarity: ",(t.metadata.similarityScore*100).toFixed(1),"%")),t.metadata.hasOutgoingLinks&&Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xe.default.createElement(w5,{className:"tw-size-4"}),Xe.default.createElement("span",null,"Outgoing links")),t.metadata.hasBacklinks&&Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xe.default.createElement(v5,{className:"tw-size-4"}),Xe.default.createElement("span",null,"Backlinks")))))}function r8n({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return Xe.default.createElement(Mdr,{key:t.document.path},Xe.default.createElement(Rdr,{asChild:!0},n),Xe.default.createElement(FWe,{className:"tw-flex tw-w-fit tw-min-w-72 tw-max-w-96 tw-flex-col tw-gap-2 tw-overflow-hidden"},Xe.default.createElement("span",{className:"tw-text-sm tw-text-normal"},t.document.title),Xe.default.createElement("span",{className:"tw-text-xs tw-text-muted"},t.document.path),Xe.default.createElement("div",{className:"tw-flex tw-gap-2"},Xe.default.createElement("button",{onClick:e,className:"tw-inline-flex tw-items-center tw-gap-2 tw-border tw-border-solid tw-border-border !tw-bg-transparent !tw-shadow-none hover:!tw-bg-interactive-hover"},"Add to Chat ",Xe.default.createElement(kh,{className:"tw-size-4"})),Xe.default.createElement("button",{onClick:o=>{let i=o.metaKey||o.ctrlKey;r(i)},className:"tw-inline-flex tw-items-center tw-gap-2 tw-border tw-border-solid tw-border-border !tw-bg-transparent !tw-shadow-none hover:!tw-bg-interactive-hover"},"Navigate to Note ",Xe.default.createElement(c5,{className:"tw-size-4"})))))}var P_e=(0,Xe.memo)(({className:t,onInsertToChat:e,defaultOpen:r=!1})=>{let[n,o]=(0,Xe.useState)(0),[i,a]=(0,Xe.useState)(r),s=X6n(n),u=$We(),l=Q6n(u?.path??"",n),c=(p,h=!1)=>{let m=app.vault.getAbstractFileByPath(p);m instanceof vY.TFile&&app.workspace.getLeaf(h).openFile(m)},d=p=>{e(`[[${p}]]`)},f=async()=>{u&&(await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().reindexFile(u),new vY.Notice(`Refreshed index for ${u.basename}`),o(n+1))};return Xe.default.createElement("div",{className:me("tw-w-full tw-border tw-border-solid tw-border-transparent tw-border-b-border tw-pb-2",t)},Xe.default.createElement(nv,{open:i,onOpenChange:a},Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-pb-2 tw-pl-1"},Xe.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},Xe.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Relevant Notes"),Xe.default.createElement(Ot,null,Xe.default.createElement(Et,{asChild:!0},Xe.default.createElement(zv,{className:"tw-size-4 tw-text-muted"})),Xe.default.createElement(xt,{side:"bottom",className:"tw-w-64"},"Relevance is a combination of semantic similarity and links.")),!l&&Xe.default.createElement(Ot,null,Xe.default.createElement(Et,{asChild:!0},Xe.default.createElement(jp,{className:"tw-size-4 tw-text-warning"})),Xe.default.createElement(xt,{side:"bottom"},"Note has not been indexed"))),Xe.default.createElement("div",{className:"tw-flex tw-items-center"},Xe.default.createElement(Ot,null,Xe.default.createElement(Et,{asChild:!0},Xe.default.createElement(he,{variant:"ghost2",size:"icon",onClick:f},Xe.default.createElement(T5,{className:"tw-size-4"}))),Xe.default.createElement(xt,{side:"bottom"},"Reindex Current Note")),s.length>0&&Xe.default.createElement(sA,{asChild:!0},Xe.default.createElement(he,{variant:"ghost2",size:"icon"},i?Xe.default.createElement(zb,{className:"tw-size-5"}):Xe.default.createElement(Li,{className:"tw-size-5"}))))),s.length===0&&Xe.default.createElement("div",{className:"tw-flex tw-max-h-12 tw-flex-wrap tw-gap-x-2 tw-gap-y-1 tw-overflow-y-hidden tw-px-1"},Xe.default.createElement("span",{className:"tw-text-xs tw-text-muted"},l?"No relevant notes found":"No index available. Click refresh to build index.")),!i&&s.length>0&&Xe.default.createElement("div",{className:"tw-flex tw-max-h-6 tw-flex-wrap tw-gap-x-2 tw-gap-y-1 tw-overflow-y-hidden tw-px-1"},s.map(p=>Xe.default.createElement(r8n,{key:p.document.path,note:p,onAddToChat:()=>d(p.document.title),onNavigateToNote:h=>c(p.document.path,h)},Xe.default.createElement(up,{variant:"outline",key:p.document.path,className:"tw-max-w-40 tw-text-xs tw-text-muted hover:tw-cursor-pointer hover:tw-bg-interactive-hover"},Xe.default.createElement("span",{className:"tw-truncate"},p.document.title))))),Xe.default.createElement(ov,null,Xe.default.createElement("div",{className:"tw-flex tw-max-h-screen tw-flex-col tw-gap-2 tw-overflow-y-auto tw-px-1 tw-py-2"},s.map(p=>Xe.default.createElement(t8n,{note:p,key:p.document.path,onAddToChat:()=>d(p.document.title),onNavigateToNote:h=>c(p.document.path,h)}))))))});P_e.displayName="RelevantNotes";sa();oc();vo();var _h=j(X());wn();var T$=_h.forwardRef(({className:t,...e},r)=>_h.createElement("div",{ref:r,className:me("tw-rounded-xl tw-border tw-border-border tw-bg-primary tw-text-normal tw-shadow",t),...e}));T$.displayName="Card";var A$=_h.forwardRef(({className:t,...e},r)=>_h.createElement("div",{ref:r,className:me("tw-flex tw-flex-col tw-space-y-1.5 tw-p-6",t),...e}));A$.displayName="CardHeader";var wY=_h.forwardRef(({className:t,...e},r)=>_h.createElement("div",{ref:r,className:me("tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));wY.displayName="CardTitle";var n8n=_h.forwardRef(({className:t,...e},r)=>_h.createElement("div",{ref:r,className:me("tw-text-sm tw-text-muted",t),...e}));n8n.displayName="CardDescription";var I$=_h.forwardRef(({className:t,...e},r)=>_h.createElement("div",{ref:r,className:me("tw-p-6 tw-pt-0",t),...e}));I$.displayName="CardContent";var o8n=_h.forwardRef(({className:t,...e},r)=>_h.createElement("div",{ref:r,className:me("tw-flex tw-items-center tw-p-6 tw-pt-0",t),...e}));o8n.displayName="CardFooter";nr();bt();fn();var ha=j(X()),BWe={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>","@websearch 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>]]"]}},Ndr={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"],project:["copilotPlus","copilotPlus","copilotPlus"]};function i8n(t="llm_chain"){let e=Ndr[t]||Ndr.llm_chain,r={};return e.map(n=>(r[n]||(r[n]=[...BWe[n].prompts].sort(()=>Math.random()-.5)),{title:BWe[n].title,text:r[n].pop()||BWe[n].prompts[0]}))}var jdr=({onClick:t})=>{let[e]=Ip(),r=(0,ha.useMemo)(()=>i8n(e),[e]),o=_n().indexVaultToVectorStore;return ha.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},ha.default.createElement(T$,{className:"tw-w-full tw-bg-transparent"},ha.default.createElement(A$,{className:"tw-px-2"},ha.default.createElement(wY,null,"Suggested Prompts")),ha.default.createElement(I$,{className:"tw-p-2 tw-pt-0"},ha.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},r.map((i,a)=>ha.default.createElement("div",{key:a,className:"tw-flex tw-justify-between tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},ha.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},ha.default.createElement("div",{className:"tw-text-muted"},i.title),ha.default.createElement("div",null,i.text)),ha.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},ha.default.createElement(Ot,null,ha.default.createElement(Et,{asChild:!0},ha.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>t(i.text)},ha.default.createElement(kh,{className:"tw-size-4"}))),ha.default.createElement(xt,null,"Add to Chat")))))))),e==="vault_qa"&&ha.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},"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"&&ha.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},ha.default.createElement("div",null,ha.default.createElement(jp,{className:"tw-size-4"})," Your auto-index strategy is set to"," ",ha.default.createElement("b",null,"NEVER"),". Before proceeding, click the"," ",ha.default.createElement("span",{className:"tw-text-accent"},"Refresh Index")," button below or run the"," ",ha.default.createElement("span",{className:"tw-text-accent"},"Copilot command: Index (refresh) vault for QA")," ","to update the index.")))};nr();nr();var om=j(X()),Ddr=({chatHistory:t})=>{let[e,r]=(0,om.useState)(0),n=(0,om.useRef)(null),o=(0,om.useRef)(null),i=(0,om.useCallback)((l,c)=>`message-${l.timestamp?.epoch||c}`,[]),a=(0,om.useCallback)(()=>{if(!n.current)return 0;let l=n.current,c=l.clientHeight,d=t.map((h,m)=>({msg:h,idx:m})).filter(({msg:h})=>h.isVisible&&h.sender===Do).pop()?.idx,f=0;if(d!==void 0){let h=i(t[d],d),m=l.querySelector(`[data-message-key="${h}"]`);if(m)f=m.getBoundingClientRect().height;else{let g=t[d].message.length,y=Math.ceil(g/80);f=Math.max(60,y*24)}}return Math.max(100,c-f)},[t,i]),s=(0,om.useCallback)(l=>{if(l!==n.current&&(o.current&&(o.current.disconnect(),o.current=null),n.current=l,l)){let c=a();r(c);let d=new ResizeObserver(()=>{if(n.current){let f=a();r(f)}});d.observe(l),o.current=d}},[a]);(0,om.useEffect)(()=>{if(n.current&&t.length>0){let l=a();r(l)}},[t,a]),(0,om.useEffect)(()=>()=>{o.current&&o.current.disconnect()},[]);let u=(0,om.useCallback)((l="smooth")=>{n.current&&n.current.scrollTo({top:n.current.scrollHeight,behavior:l})},[]);return(0,om.useEffect)(()=>{u("instant")},[u]),(0,om.useEffect)(()=>{u()},[t.length,u]),{containerMinHeight:e,scrollContainerCallbackRef:s,getMessageKey:i}};bt();var ff=j(X()),Ldr=(0,ff.memo)(({chatHistory:t,currentAiMessage:e,loading:r,loadingMessage:n,app:o,onRegenerate:i,onEdit:a,onDelete:s,onInsertToChat:u,onReplaceChat:l,showHelperComponents:c=!0})=>{let[d,f]=(0,ff.useState)(""),p=_n(),{containerMinHeight:h,scrollContainerCallbackRef:m,getMessageKey:g}=Ddr({chatHistory:t});if((0,ff.useEffect)(()=>{let _;return r?_=setInterval(()=>{f(w=>w.length<6?w+".":"")},200):f(""),()=>clearInterval(_)},[r]),!t.filter(_=>_.isVisible).length&&!e)return ff.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-gap-2 tw-overflow-y-auto"},c&&p.showRelevantNotes&&ff.default.createElement(P_e,{onInsertToChat:u,defaultOpen:!0,key:"relevant-notes-before-chat"}),c&&p.showSuggestedPrompts&&ff.default.createElement(jdr,{onClick:l}));let y=()=>n?`${n} ${d}`:d;return ff.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-1 tw-flex-col tw-overflow-hidden"},c&&p.showRelevantNotes&&ff.default.createElement(P_e,{className:"tw-mb-4",onInsertToChat:u,defaultOpen:!1,key:"relevant-notes-in-chat"}),ff.default.createElement("div",{ref:m,"data-testid":"chat-messages",className:"tw-relative tw-flex tw-w-full tw-flex-1 tw-select-text tw-flex-col tw-items-start tw-justify-start tw-overflow-y-auto tw-scroll-smooth tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)]"},t.map((_,w)=>{let S=t.filter(P=>P.isVisible),E=w===S.length-1&&_.sender!==Do;return _.isVisible&&ff.default.createElement("div",{key:g(_,w),"data-message-key":g(_,w),className:"tw-w-full",style:{minHeight:E?`${h}px`:"auto"}},ff.default.createElement(hWe,{message:_,app:o,isStreaming:!1,onRegenerate:()=>i(w),onEdit:P=>a(w,P),onDelete:()=>s(w),chatHistory:t}))}),(e||r)&&ff.default.createElement("div",{className:"tw-w-full",style:{minHeight:`${h}px`}},ff.default.createElement(hWe,{key:"ai_message_streaming",message:{sender:"AI",message:e||y(),isVisible:!0,timestamp:null},app:o,isStreaming:!0,onDelete:()=>{},chatHistory:t}))))});Ldr.displayName="ChatMessages";var Fdr=Ldr;vo();fr();var T_e=j(X());function A_e(t){let[e,r]=(0,T_e.useState)(null);(0,T_e.useEffect)(()=>{(async()=>{let i=await jet();i.version&&r(i.version)})()},[]);let n=e!==null&&wee(e,t);return{latestVersion:e,hasUpdate:n}}wn();bt();fr();fn();var pb=j(X());function kdr({currentVersion:t}){let{latestVersion:e,hasUpdate:r}=A_e(t),n=_n().lastDismissedVersion,[o,i]=(0,pb.useState)(!0),a=r&&e&&wee(e,t)&&n!==e,s=()=>{e&&(i(!1),setTimeout(()=>{ot("lastDismissedVersion",e)},300))};return a?pb.default.createElement("div",{className:me("tw-min-h-14 tw-overflow-hidden",o?"tw-duration-300 tw-animate-in tw-slide-in-from-top":"tw-duration-300 tw-animate-out tw-slide-out-to-top")},pb.default.createElement("div",{className:"tw-mb-1 tw-flex tw-items-center tw-justify-between tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-pl-3 tw-text-xs"},pb.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},pb.default.createElement("span",{className:"tw-font-medium"},"Update available:"),pb.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"tw-text-normal"},"v",e)),pb.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},pb.default.createElement(he,{size:"fit",variant:"ghost2",className:"tw-text-accent hover:tw-text-accent-hover",onClick:()=>{window.open("obsidian://show-plugin?id=copilot","_blank"),s()}},"Update"),pb.default.createElement(he,{variant:"ghost2",size:"icon",onClick:s},pb.default.createElement(bi,{className:"tw-size-4"}))))):null}sa();var $dr=require("obsidian");th();var gV=class extends $dr.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=ZK(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 zWe=require("obsidian");var xY=class extends uV{constructor({app:e,onFileSelect:r,excludeFilePaths:n,titleOnly:o=!1}){super(e),this.onFileSelect=r,this.availableNotes=this.getOrderedProjectFiles(n),this.titleOnly=o,this.setTitle("Select File")}getOrderedProjectFiles(e=[]){let r=["mp3","mp4","m4a","wav","webm"],n=this.app.workspace.getLastOpenFiles().map(a=>this.app.vault.getAbstractFileByPath(a)).filter(a=>a instanceof zWe.TFile&&!e.includes(a.path)&&a.path!==this.activeNote?.path&&!r.includes(a.extension.toLowerCase())),i=this.app.vault.getFiles().filter(a=>!r.includes(a.extension.toLowerCase())).filter(a=>!n.some(s=>s.path===a.path)&&!e.includes(a.path)&&a.path!==this.activeNote?.path);return[...this.activeNote?[this.activeNote]:[],...n,...i]}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.onFileSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof zWe.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)}}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n&&(o+=` (${n.toUpperCase()})`),o}};fr();var Bdr=require("obsidian"),yV=class extends Bdr.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)Sj(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};var bV=j(X());wn();var I_e=j(X()),a8n=2;function s8n(t,e){return e&&e>1?t.current?t.current.offsetHeight<t.current.scrollHeight:!1:(t.current&&t.current?.offsetWidth+a8n<t.current?.scrollWidth)??!1}function u8n(t){switch(t){case 2:return"tw-line-clamp-2";case 3:return"tw-line-clamp-3";default:return""}}var vh=({children:t,className:e,lineClamp:r,tooltipContent:n,...o})=>{let i=(0,I_e.useRef)(null),[a,s]=(0,I_e.useState)(!1);return bV.default.createElement(No,{delayDuration:0},bV.default.createElement(Ot,{open:a,onOpenChange:l=>{s(l&&s8n(i,r))}},bV.default.createElement(Et,{asChild:!0},bV.default.createElement("div",{...o,ref:i,className:me("tw-max-w-full tw-text-normal",(!r||r<=1)&&"tw-truncate",r&&u8n(r),e),"data-testid":"truncatedText"},t)),bV.default.createElement(xt,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},n??t)))};vo();var PY=j(X());fn();var Jdr=j(X(),1),At=j(X(),1),D_e=(0,At.createContext)(null);D_e.displayName="PanelGroupContext";var Hs={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},GWe=10,R$=At.useLayoutEffect,zdr=Jdr.useId,l8n=typeof zdr=="function"?zdr:()=>null,c8n=0;function JWe(t=null){let e=l8n(),r=(0,At.useRef)(t||e||null);return r.current===null&&(r.current=""+c8n++),t??r.current}function Zdr({children:t,className:e="",collapsedSize:r,collapsible:n,defaultSize:o,forwardedRef:i,id:a,maxSize:s,minSize:u,onCollapse:l,onExpand:c,onResize:d,order:f,style:p,tagName:h="div",...m}){let g=(0,At.useContext)(D_e);if(g===null)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:y,expandPanel:_,getPanelSize:w,getPanelStyle:S,groupId:C,isPanelCollapsed:E,reevaluatePanelConstraints:P,registerPanel:T,resizePanel:I,unregisterPanel:N}=g,M=JWe(a),D=(0,At.useRef)({callbacks:{onCollapse:l,onExpand:c,onResize:d},constraints:{collapsedSize:r,collapsible:n,defaultSize:o,maxSize:s,minSize:u},id:M,idIsFromProps:a!==void 0,order:f});(0,At.useRef)({didLogMissingDefaultSizeWarning:!1}),R$(()=>{let{callbacks:F,constraints:K}=D.current,U={...K};D.current.id=M,D.current.idIsFromProps=a!==void 0,D.current.order=f,F.onCollapse=l,F.onExpand=c,F.onResize=d,K.collapsedSize=r,K.collapsible=n,K.defaultSize=o,K.maxSize=s,K.minSize=u,(U.collapsedSize!==K.collapsedSize||U.collapsible!==K.collapsible||U.maxSize!==K.maxSize||U.minSize!==K.minSize)&&P(D.current,U)}),R$(()=>{let F=D.current;return T(F),()=>{N(F)}},[f,M,T,N]),(0,At.useImperativeHandle)(i,()=>({collapse:()=>{y(D.current)},expand:F=>{_(D.current,F)},getId(){return M},getSize(){return w(D.current)},isCollapsed(){return E(D.current)},isExpanded(){return!E(D.current)},resize:F=>{I(D.current,F)}}),[y,_,w,E,M,I]);let k=S(D.current,o);return(0,At.createElement)(h,{...m,children:t,className:e,id:M,style:{...k,...p},[Hs.groupId]:C,[Hs.panel]:"",[Hs.panelCollapsible]:n||void 0,[Hs.panelId]:M,[Hs.panelSize]:parseFloat(""+k.flexGrow).toFixed(1)})}var ZWe=(0,At.forwardRef)((t,e)=>(0,At.createElement)(Zdr,{...t,forwardedRef:e}));Zdr.displayName="Panel";ZWe.displayName="forwardRef(Panel)";var d8n;function f8n(){return d8n}var KWe=null,p8n=!0,R_e=-1,uA=null;function m8n(t,e){if(e){let r=(e&tfr)!==0,n=(e&rfr)!==0,o=(e&nfr)!==0,i=(e&ofr)!==0;if(r)return o?"se-resize":i?"ne-resize":"e-resize";if(n)return o?"sw-resize":i?"nw-resize":"w-resize";if(o)return"s-resize";if(i)return"n-resize"}switch(t){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function h8n(){uA!==null&&(document.head.removeChild(uA),KWe=null,uA=null,R_e=-1)}function UWe(t,e){var r,n;if(!p8n)return;let o=m8n(t,e);if(KWe!==o){if(KWe=o,uA===null){uA=document.createElement("style");let a=f8n();a&&uA.setAttribute("nonce",a),document.head.appendChild(uA)}if(R_e>=0){var i;(i=uA.sheet)===null||i===void 0||i.removeRule(R_e)}R_e=(r=(n=uA.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${o} !important;}`))!==null&&r!==void 0?r:-1}}function Ydr(t){return t.type==="keydown"}function Xdr(t){return t.type.startsWith("pointer")}function Qdr(t){return t.type.startsWith("mouse")}function L_e(t){if(Xdr(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(Qdr(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function g8n(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function y8n(t,e,r){return r?t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y:t.x<=e.x+e.width&&t.x+t.width>=e.x&&t.y<=e.y+e.height&&t.y+t.height>=e.y}function b8n(t,e){if(t===e)throw new Error("Cannot compare node with itself");let r={a:Hdr(t),b:Hdr(e)},n;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),n=t;Dn(n,"Stacking order can only be calculated for elements with a common ancestor");let o={a:qdr(Udr(r.a)),b:qdr(Udr(r.b))};if(o.a===o.b){let i=n.childNodes,a={a:r.a.at(-1),b:r.b.at(-1)},s=i.length;for(;s--;){let u=i[s];if(u===a.a)return 1;if(u===a.b)return-1}}return Math.sign(o.a-o.b)}var _8n=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function v8n(t){var e;let r=getComputedStyle((e=efr(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function w8n(t){let e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||v8n(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||_8n.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function Udr(t){let e=t.length;for(;e--;){let r=t[e];if(Dn(r,"Missing node"),w8n(r))return r}return null}function qdr(t){return t&&Number(getComputedStyle(t).zIndex)||0}function Hdr(t){let e=[];for(;t;)e.push(t),t=efr(t);return e}function efr(t){let{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}var tfr=1,rfr=2,nfr=4,ofr=8,x8n=g8n()==="coarse",av=[],xV=!1,fN=new Map,F_e=new Map,OY=new Set;function S8n(t,e,r,n,o){var i;let{ownerDocument:a}=e,s={direction:r,element:e,hitAreaMargins:n,setResizeHandlerState:o},u=(i=fN.get(a))!==null&&i!==void 0?i:0;return fN.set(a,u+1),OY.add(s),N_e(),function(){var c;F_e.delete(t),OY.delete(s);let d=(c=fN.get(a))!==null&&c!==void 0?c:1;if(fN.set(a,d-1),N_e(),d===1&&fN.delete(a),av.includes(s)){let f=av.indexOf(s);f>=0&&av.splice(f,1),XWe(),o("up",!0,null)}}}function C8n(t){let{target:e}=t,{x:r,y:n}=L_e(t);xV=!0,YWe({target:e,x:r,y:n}),N_e(),av.length>0&&(j_e("down",t),t.preventDefault(),ifr(e)||t.stopImmediatePropagation())}function qWe(t){let{x:e,y:r}=L_e(t);if(xV&&t.buttons===0&&(xV=!1,j_e("up",t)),!xV){let{target:n}=t;YWe({target:n,x:e,y:r})}j_e("move",t),XWe(),av.length>0&&t.preventDefault()}function HWe(t){let{target:e}=t,{x:r,y:n}=L_e(t);F_e.clear(),xV=!1,av.length>0&&(t.preventDefault(),ifr(e)||t.stopImmediatePropagation()),j_e("up",t),YWe({target:e,x:r,y:n}),XWe(),N_e()}function ifr(t){let e=t;for(;e;){if(e.hasAttribute(Hs.resizeHandle))return!0;e=e.parentElement}return!1}function YWe({target:t,x:e,y:r}){av.splice(0);let n=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(n=t),OY.forEach(o=>{let{element:i,hitAreaMargins:a}=o,s=i.getBoundingClientRect(),{bottom:u,left:l,right:c,top:d}=s,f=x8n?a.coarse:a.fine;if(e>=l-f&&e<=c+f&&r>=d-f&&r<=u+f){if(n!==null&&document.contains(n)&&i!==n&&!i.contains(n)&&!n.contains(i)&&b8n(n,i)>0){let h=n,m=!1;for(;h&&!h.contains(i);){if(y8n(h.getBoundingClientRect(),s,!0)){m=!0;break}h=h.parentElement}if(m)return}av.push(o)}})}function VWe(t,e){F_e.set(t,e)}function XWe(){let t=!1,e=!1;av.forEach(n=>{let{direction:o}=n;o==="horizontal"?t=!0:e=!0});let r=0;F_e.forEach(n=>{r|=n}),t&&e?UWe("intersection",r):t?UWe("horizontal",r):e?UWe("vertical",r):h8n()}var WWe=new AbortController;function N_e(){WWe.abort(),WWe=new AbortController;let t={capture:!0,signal:WWe.signal};OY.size&&(xV?(av.length>0&&fN.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("contextmenu",HWe,t),n.addEventListener("pointerleave",qWe,t),n.addEventListener("pointermove",qWe,t))}),fN.forEach((e,r)=>{let{body:n}=r;n.addEventListener("pointerup",HWe,t),n.addEventListener("pointercancel",HWe,t)})):fN.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("pointerdown",C8n,t),n.addEventListener("pointermove",qWe,t))}))}function j_e(t,e){OY.forEach(r=>{let{setResizeHandlerState:n}=r,o=av.includes(r);n(t,o,e)})}function O8n(){let[t,e]=(0,At.useState)(0);return(0,At.useCallback)(()=>e(r=>r+1),[])}function Dn(t,e){if(!t)throw console.error(e),Error(e)}function N$(t,e,r=GWe){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function lA(t,e,r=GWe){return N$(t,e,r)===0}function Og(t,e,r){return N$(t,e,r)===0}function E8n(t,e,r){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++){let o=t[n],i=e[n];if(!Og(o,i,r))return!1}return!0}function wV({panelConstraints:t,panelIndex:e,size:r}){let n=t[e];Dn(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=n;if(N$(r,s)<0)if(i){let u=(o+s)/2;N$(r,u)<0?r=o:r=s}else r=s;return r=Math.min(a,r),r=parseFloat(r.toFixed(GWe)),r}function SY({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:n,prevLayout:o,trigger:i}){if(Og(t,0))return e;let a=[...e],[s,u]=n;Dn(s!=null,"Invalid first pivot index"),Dn(u!=null,"Invalid second pivot index");let l=0;if(i==="keyboard"){{let d=t<0?u:s,f=r[d];Dn(f,`Panel constraints not found for index ${d}`);let{collapsedSize:p=0,collapsible:h,minSize:m=0}=f;if(h){let g=e[d];if(Dn(g!=null,`Previous layout not found for panel index ${d}`),Og(g,p)){let y=m-g;N$(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}{let d=t<0?s:u,f=r[d];Dn(f,`No panel constraints found for index ${d}`);let{collapsedSize:p=0,collapsible:h,minSize:m=0}=f;if(h){let g=e[d];if(Dn(g!=null,`Previous layout not found for panel index ${d}`),Og(g,m)){let y=g-p;N$(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}}{let d=t<0?1:-1,f=t<0?u:s,p=0;for(;;){let m=e[f];Dn(m!=null,`Previous layout not found for panel index ${f}`);let y=wV({panelConstraints:r,panelIndex:f,size:100})-m;if(p+=y,f+=d,f<0||f>=r.length)break}let h=Math.min(Math.abs(t),Math.abs(p));t=t<0?0-h:h}{let f=t<0?s:u;for(;f>=0&&f<r.length;){let p=Math.abs(t)-Math.abs(l),h=e[f];Dn(h!=null,`Previous layout not found for panel index ${f}`);let m=h-p,g=wV({panelConstraints:r,panelIndex:f,size:m});if(!Og(h,g)&&(l+=h-g,a[f]=g,l.toPrecision(3).localeCompare(Math.abs(t).toPrecision(3),void 0,{numeric:!0})>=0))break;t<0?f--:f++}}if(E8n(o,a))return o;{let d=t<0?u:s,f=e[d];Dn(f!=null,`Previous layout not found for panel index ${d}`);let p=f+l,h=wV({panelConstraints:r,panelIndex:d,size:p});if(a[d]=h,!Og(h,p)){let m=p-h,y=t<0?u:s;for(;y>=0&&y<r.length;){let _=a[y];Dn(_!=null,`Previous layout not found for panel index ${y}`);let w=_+m,S=wV({panelConstraints:r,panelIndex:y,size:w});if(Og(_,S)||(m-=S-_,a[y]=S),Og(m,0))break;t>0?y--:y++}}}let c=a.reduce((d,f)=>f+d,0);return Og(c,100)?a:o}function P8n({layout:t,panelsArray:e,pivotIndices:r}){let n=0,o=100,i=0,a=0,s=r[0];Dn(s!=null,"No pivot index found"),e.forEach((d,f)=>{let{constraints:p}=d,{maxSize:h=100,minSize:m=0}=p;f===s?(n=m,o=h):(i+=m,a+=h)});let u=Math.min(o,100-i),l=Math.max(n,100-a),c=t[s];return{valueMax:u,valueMin:l,valueNow:c}}function EY(t,e=document){return Array.from(e.querySelectorAll(`[${Hs.resizeHandleId}][data-panel-group-id="${t}"]`))}function afr(t,e,r=document){let o=EY(t,r).findIndex(i=>i.getAttribute(Hs.resizeHandleId)===e);return o??null}function sfr(t,e,r){let n=afr(t,e,r);return n!=null?[n,n+1]:[-1,-1]}function T8n(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function ufr(t,e=document){if(T8n(e)&&e.dataset.panelGroupId==t)return e;let r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function k_e(t,e=document){let r=e.querySelector(`[${Hs.resizeHandleId}="${t}"]`);return r||null}function A8n(t,e,r,n=document){var o,i,a,s;let u=k_e(e,n),l=EY(t,n),c=u?l.indexOf(u):-1,d=(o=(i=r[c])===null||i===void 0?void 0:i.id)!==null&&o!==void 0?o:null,f=(a=(s=r[c+1])===null||s===void 0?void 0:s.id)!==null&&a!==void 0?a:null;return[d,f]}function I8n({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:n,panelDataArray:o,panelGroupElement:i,setLayout:a}){(0,At.useRef)({didWarnAboutMissingResizeHandle:!1}),R$(()=>{if(!i)return;let s=EY(r,i);for(let u=0;u<o.length-1;u++){let{valueMax:l,valueMin:c,valueNow:d}=P8n({layout:n,panelsArray:o,pivotIndices:[u,u+1]}),f=s[u];if(f!=null){let p=o[u];Dn(p,`No panel data found for index "${u}"`),f.setAttribute("aria-controls",p.id),f.setAttribute("aria-valuemax",""+Math.round(l)),f.setAttribute("aria-valuemin",""+Math.round(c)),f.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{s.forEach((u,l)=>{u.removeAttribute("aria-controls"),u.removeAttribute("aria-valuemax"),u.removeAttribute("aria-valuemin"),u.removeAttribute("aria-valuenow")})}},[r,n,o,i]),(0,At.useEffect)(()=>{if(!i)return;let s=e.current;Dn(s,"Eager values not found");let{panelDataArray:u}=s,l=ufr(r,i);Dn(l!=null,`No group found for id "${r}"`);let c=EY(r,i);Dn(c,`No resize handles found for group id "${r}"`);let d=c.map(f=>{let p=f.getAttribute(Hs.resizeHandleId);Dn(p,"Resize handle element has no handle id attribute");let[h,m]=A8n(r,p,u,i);if(h==null||m==null)return()=>{};let g=y=>{if(!y.defaultPrevented)switch(y.key){case"Enter":{y.preventDefault();let _=u.findIndex(w=>w.id===h);if(_>=0){let w=u[_];Dn(w,`No panel data found for index ${_}`);let S=n[_],{collapsedSize:C=0,collapsible:E,minSize:P=0}=w.constraints;if(S!=null&&E){let T=SY({delta:Og(S,C)?P-C:C-S,initialLayout:n,panelConstraints:u.map(I=>I.constraints),pivotIndices:sfr(r,p,i),prevLayout:n,trigger:"keyboard"});n!==T&&a(T)}}break}}};return f.addEventListener("keydown",g),()=>{f.removeEventListener("keydown",g)}});return()=>{d.forEach(f=>f())}},[i,t,e,r,n,o,a])}function Vdr(t,e){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 lfr(t,e){let r=t==="horizontal",{x:n,y:o}=L_e(e);return r?n:o}function M8n(t,e,r,n,o){let i=r==="horizontal",a=k_e(e,o);Dn(a,`No resize handle element found for id "${e}"`);let s=a.getAttribute(Hs.groupId);Dn(s,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=n,l=lfr(r,t),c=ufr(s,o);Dn(c,`No group element found for id "${s}"`);let d=c.getBoundingClientRect(),f=i?d.width:d.height;return(l-u)/f*100}function R8n(t,e,r,n,o,i){if(Ydr(t)){let a=r==="horizontal",s=0;t.shiftKey?s=100:o!=null?s=o:s=10;let u=0;switch(t.key){case"ArrowDown":u=a?0:s;break;case"ArrowLeft":u=a?-s:0;break;case"ArrowRight":u=a?s:0;break;case"ArrowUp":u=a?0:-s;break;case"End":u=100;break;case"Home":u=-100;break}return u}else return n==null?0:M8n(t,e,r,n,i)}function N8n({panelDataArray:t}){let e=Array(t.length),r=t.map(i=>i.constraints),n=0,o=100;for(let i=0;i<t.length;i++){let a=r[i];Dn(a,`Panel constraints not found for index ${i}`);let{defaultSize:s}=a;s!=null&&(n++,e[i]=s,o-=s)}for(let i=0;i<t.length;i++){let a=r[i];Dn(a,`Panel constraints not found for index ${i}`);let{defaultSize:s}=a;if(s!=null)continue;let u=t.length-n,l=o/u;n++,e[i]=l,o-=l}return e}function _V(t,e,r){e.forEach((n,o)=>{let i=t[o];Dn(i,`Panel data not found for index ${o}`);let{callbacks:a,constraints:s,id:u}=i,{collapsedSize:l=0,collapsible:c}=s,d=r[u];if(d==null||n!==d){r[u]=n;let{onCollapse:f,onExpand:p,onResize:h}=a;h&&h(n,d),c&&(f||p)&&(p&&(d==null||lA(d,l))&&!lA(n,l)&&p(),f&&(d==null||!lA(d,l))&&lA(n,l)&&f())}})}function M_e(t,e){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 j8n({defaultSize:t,dragState:e,layout:r,panelData:n,panelIndex:o,precision:i=3}){let a=r[o],s;return a==null?s=t!=null?t.toPrecision(i):"1":n.length===1?s="1":s=a.toPrecision(i),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function D8n(t,e=10){let r=null;return(...o)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...o)},e)}}function Wdr(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,r)=>{localStorage.setItem(e,r)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function cfr(t){return`react-resizable-panels:${t}`}function dfr(t){return t.map(e=>{let{constraints:r,id:n,idIsFromProps:o,order:i}=e;return o?n:i?`${i}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((e,r)=>e.localeCompare(r)).join(",")}function ffr(t,e){try{let r=cfr(t),n=e.getItem(r);if(n){let o=JSON.parse(n);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function L8n(t,e,r){var n,o;let i=(n=ffr(t,r))!==null&&n!==void 0?n:{},a=dfr(e);return(o=i[a])!==null&&o!==void 0?o:null}function F8n(t,e,r,n,o){var i;let a=cfr(t),s=dfr(e),u=(i=ffr(t,o))!==null&&i!==void 0?i:{};u[s]={expandToSizes:Object.fromEntries(r.entries()),layout:n};try{o.setItem(a,JSON.stringify(u))}catch(l){console.error(l)}}function Kdr({layout:t,panelConstraints:e}){let r=[...t],n=r.reduce((i,a)=>i+a,0);if(r.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${r.map(i=>`${i}%`).join(", ")}`);if(!Og(n,100)&&r.length>0)for(let i=0;i<e.length;i++){let a=r[i];Dn(a!=null,`No layout data found for index ${i}`);let s=100/n*a;r[i]=s}let o=0;for(let i=0;i<e.length;i++){let a=r[i];Dn(a!=null,`No layout data found for index ${i}`);let s=wV({panelConstraints:e,panelIndex:i,size:a});a!=s&&(o+=a-s,r[i]=s)}if(!Og(o,0))for(let i=0;i<e.length;i++){let a=r[i];Dn(a!=null,`No layout data found for index ${i}`);let s=a+o,u=wV({panelConstraints:e,panelIndex:i,size:s});if(a!==u&&(o-=u-a,r[i]=u,Og(o,0)))break}return r}var k8n=100,CY={getItem:t=>(Wdr(CY),CY.getItem(t)),setItem:(t,e)=>{Wdr(CY),CY.setItem(t,e)}},Gdr={};function pfr({autoSaveId:t=null,children:e,className:r="",direction:n,forwardedRef:o,id:i=null,onLayout:a=null,keyboardResizeBy:s=null,storage:u=CY,style:l,tagName:c="div",...d}){let f=JWe(i),p=(0,At.useRef)(null),[h,m]=(0,At.useState)(null),[g,y]=(0,At.useState)([]),_=O8n(),w=(0,At.useRef)({}),S=(0,At.useRef)(new Map),C=(0,At.useRef)(0),E=(0,At.useRef)({autoSaveId:t,direction:n,dragState:h,id:f,keyboardResizeBy:s,onLayout:a,storage:u}),P=(0,At.useRef)({layout:g,panelDataArray:[],panelDataArrayChanged:!1});(0,At.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,At.useImperativeHandle)(o,()=>({getId:()=>E.current.id,getLayout:()=>{let{layout:V}=P.current;return V},setLayout:V=>{let{onLayout:q}=E.current,{layout:H,panelDataArray:G}=P.current,Z=Kdr({layout:V,panelConstraints:G.map(de=>de.constraints)});Vdr(H,Z)||(y(Z),P.current.layout=Z,q&&q(Z),_V(G,Z,w.current))}}),[]),R$(()=>{E.current.autoSaveId=t,E.current.direction=n,E.current.dragState=h,E.current.id=f,E.current.onLayout=a,E.current.storage=u}),I8n({committedValuesRef:E,eagerValuesRef:P,groupId:f,layout:g,panelDataArray:P.current.panelDataArray,setLayout:y,panelGroupElement:p.current}),(0,At.useEffect)(()=>{let{panelDataArray:V}=P.current;if(t){if(g.length===0||g.length!==V.length)return;let q=Gdr[t];q==null&&(q=D8n(F8n,k8n),Gdr[t]=q);let H=[...V],G=new Map(S.current);q(t,H,G,g,u)}},[t,g,u]),(0,At.useEffect)(()=>{});let T=(0,At.useCallback)(V=>{let{onLayout:q}=E.current,{layout:H,panelDataArray:G}=P.current;if(V.constraints.collapsible){let Z=G.map(Te=>Te.constraints),{collapsedSize:de=0,panelSize:pe,pivotIndices:ae}=M$(G,V,H);if(Dn(pe!=null,`Panel size not found for panel "${V.id}"`),!lA(pe,de)){S.current.set(V.id,pe);let Ae=vV(G,V)===G.length-1?pe-de:de-pe,ke=SY({delta:Ae,initialLayout:H,panelConstraints:Z,pivotIndices:ae,prevLayout:H,trigger:"imperative-api"});M_e(H,ke)||(y(ke),P.current.layout=ke,q&&q(ke),_V(G,ke,w.current))}}},[]),I=(0,At.useCallback)((V,q)=>{let{onLayout:H}=E.current,{layout:G,panelDataArray:Z}=P.current;if(V.constraints.collapsible){let de=Z.map(St=>St.constraints),{collapsedSize:pe=0,panelSize:ae=0,minSize:Te=0,pivotIndices:Ae}=M$(Z,V,G),ke=q??Te;if(lA(ae,pe)){let St=S.current.get(V.id),Nr=St!=null&&St>=ke?St:ke,Hn=vV(Z,V)===Z.length-1?ae-Nr:Nr-ae,Yr=SY({delta:Hn,initialLayout:G,panelConstraints:de,pivotIndices:Ae,prevLayout:G,trigger:"imperative-api"});M_e(G,Yr)||(y(Yr),P.current.layout=Yr,H&&H(Yr),_V(Z,Yr,w.current))}}},[]),N=(0,At.useCallback)(V=>{let{layout:q,panelDataArray:H}=P.current,{panelSize:G}=M$(H,V,q);return Dn(G!=null,`Panel size not found for panel "${V.id}"`),G},[]),M=(0,At.useCallback)((V,q)=>{let{panelDataArray:H}=P.current,G=vV(H,V);return j8n({defaultSize:q,dragState:h,layout:g,panelData:H,panelIndex:G})},[h,g]),D=(0,At.useCallback)(V=>{let{layout:q,panelDataArray:H}=P.current,{collapsedSize:G=0,collapsible:Z,panelSize:de}=M$(H,V,q);return Dn(de!=null,`Panel size not found for panel "${V.id}"`),Z===!0&&lA(de,G)},[]),k=(0,At.useCallback)(V=>{let{layout:q,panelDataArray:H}=P.current,{collapsedSize:G=0,collapsible:Z,panelSize:de}=M$(H,V,q);return Dn(de!=null,`Panel size not found for panel "${V.id}"`),!Z||N$(de,G)>0},[]),F=(0,At.useCallback)(V=>{let{panelDataArray:q}=P.current;q.push(V),q.sort((H,G)=>{let Z=H.order,de=G.order;return Z==null&&de==null?0:Z==null?-1:de==null?1:Z-de}),P.current.panelDataArrayChanged=!0,_()},[_]);R$(()=>{if(P.current.panelDataArrayChanged){P.current.panelDataArrayChanged=!1;let{autoSaveId:V,onLayout:q,storage:H}=E.current,{layout:G,panelDataArray:Z}=P.current,de=null;if(V){let ae=L8n(V,Z,H);ae&&(S.current=new Map(Object.entries(ae.expandToSizes)),de=ae.layout)}de==null&&(de=N8n({panelDataArray:Z}));let pe=Kdr({layout:de,panelConstraints:Z.map(ae=>ae.constraints)});Vdr(G,pe)||(y(pe),P.current.layout=pe,q&&q(pe),_V(Z,pe,w.current))}}),R$(()=>{let V=P.current;return()=>{V.layout=[]}},[]);let K=(0,At.useCallback)(V=>{let q=!1,H=p.current;return H&&window.getComputedStyle(H,null).getPropertyValue("direction")==="rtl"&&(q=!0),function(Z){Z.preventDefault();let de=p.current;if(!de)return()=>null;let{direction:pe,dragState:ae,id:Te,keyboardResizeBy:Ae,onLayout:ke}=E.current,{layout:St,panelDataArray:Nr}=P.current,{initialLayout:Ir}=ae??{},Hn=sfr(Te,V,de),Yr=R8n(Z,V,pe,ae,Ae,de),Sr=pe==="horizontal";Sr&&q&&(Yr=-Yr);let Me=Nr.map(le=>le.constraints),Ge=SY({delta:Yr,initialLayout:Ir??St,panelConstraints:Me,pivotIndices:Hn,prevLayout:St,trigger:Ydr(Z)?"keyboard":"mouse-or-touch"}),je=!M_e(St,Ge);(Xdr(Z)||Qdr(Z))&&C.current!=Yr&&(C.current=Yr,!je&&Yr!==0?Sr?VWe(V,Yr<0?tfr:rfr):VWe(V,Yr<0?nfr:ofr):VWe(V,0)),je&&(y(Ge),P.current.layout=Ge,ke&&ke(Ge),_V(Nr,Ge,w.current))}},[]),U=(0,At.useCallback)((V,q)=>{let{onLayout:H}=E.current,{layout:G,panelDataArray:Z}=P.current,de=Z.map(St=>St.constraints),{panelSize:pe,pivotIndices:ae}=M$(Z,V,G);Dn(pe!=null,`Panel size not found for panel "${V.id}"`);let Ae=vV(Z,V)===Z.length-1?pe-q:q-pe,ke=SY({delta:Ae,initialLayout:G,panelConstraints:de,pivotIndices:ae,prevLayout:G,trigger:"imperative-api"});M_e(G,ke)||(y(ke),P.current.layout=ke,H&&H(ke),_V(Z,ke,w.current))},[]),Y=(0,At.useCallback)((V,q)=>{let{layout:H,panelDataArray:G}=P.current,{collapsedSize:Z=0,collapsible:de}=q,{collapsedSize:pe=0,collapsible:ae,maxSize:Te=100,minSize:Ae=0}=V.constraints,{panelSize:ke}=M$(G,V,H);ke!=null&&(de&&ae&&lA(ke,Z)?lA(Z,pe)||U(V,pe):ke<Ae?U(V,Ae):ke>Te&&U(V,Te))},[U]),ee=(0,At.useCallback)((V,q)=>{let{direction:H}=E.current,{layout:G}=P.current;if(!p.current)return;let Z=k_e(V,p.current);Dn(Z,`Drag handle element not found for id "${V}"`);let de=lfr(H,q);m({dragHandleId:V,dragHandleRect:Z.getBoundingClientRect(),initialCursorPosition:de,initialLayout:G})},[]),L=(0,At.useCallback)(()=>{m(null)},[]),Q=(0,At.useCallback)(V=>{let{panelDataArray:q}=P.current,H=vV(q,V);H>=0&&(q.splice(H,1),delete w.current[V.id],P.current.panelDataArrayChanged=!0,_())},[_]),z=(0,At.useMemo)(()=>({collapsePanel:T,direction:n,dragState:h,expandPanel:I,getPanelSize:N,getPanelStyle:M,groupId:f,isPanelCollapsed:D,isPanelExpanded:k,reevaluatePanelConstraints:Y,registerPanel:F,registerResizeHandle:K,resizePanel:U,startDragging:ee,stopDragging:L,unregisterPanel:Q,panelGroupElement:p.current}),[T,h,n,I,N,M,f,D,k,Y,F,K,U,ee,L,Q]),W={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return(0,At.createElement)(D_e.Provider,{value:z},(0,At.createElement)(c,{...d,children:e,className:r,id:i,ref:p,style:{...W,...l},[Hs.group]:"",[Hs.groupDirection]:n,[Hs.groupId]:f}))}var QWe=(0,At.forwardRef)((t,e)=>(0,At.createElement)(pfr,{...t,forwardedRef:e}));pfr.displayName="PanelGroup";QWe.displayName="forwardRef(PanelGroup)";function vV(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function M$(t,e,r){let n=vV(t,e),i=n===t.length-1?[n-1,n]:[n,n+1],a=r[n];return{...e.constraints,panelSize:a,pivotIndices:i}}function $8n({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:n}){(0,At.useEffect)(()=>{if(t||r==null||n==null)return;let o=k_e(e,n);if(o==null)return;let i=a=>{if(!a.defaultPrevented)switch(a.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{a.preventDefault(),r(a);break}case"F6":{a.preventDefault();let s=o.getAttribute(Hs.groupId);Dn(s,`No group element found for id "${s}"`);let u=EY(s,n),l=afr(s,e,n);Dn(l!==null,`No resize element found for id "${e}"`);let c=a.shiftKey?l>0?l-1:u.length-1:l+1<u.length?l+1:0;u[c].focus();break}}};return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}},[n,t,e,r])}function e9e({children:t=null,className:e="",disabled:r=!1,hitAreaMargins:n,id:o,onBlur:i,onClick:a,onDragging:s,onFocus:u,onPointerDown:l,onPointerUp:c,style:d={},tabIndex:f=0,tagName:p="div",...h}){var m,g;let y=(0,At.useRef)(null),_=(0,At.useRef)({onClick:a,onDragging:s,onPointerDown:l,onPointerUp:c});(0,At.useEffect)(()=>{_.current.onClick=a,_.current.onDragging=s,_.current.onPointerDown=l,_.current.onPointerUp=c});let w=(0,At.useContext)(D_e);if(w===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:S,groupId:C,registerResizeHandle:E,startDragging:P,stopDragging:T,panelGroupElement:I}=w,N=JWe(o),[M,D]=(0,At.useState)("inactive"),[k,F]=(0,At.useState)(!1),[K,U]=(0,At.useState)(null),Y=(0,At.useRef)({state:M});R$(()=>{Y.current.state=M}),(0,At.useEffect)(()=>{if(r)U(null);else{let z=E(N);U(()=>z)}},[r,N,E]);let ee=(m=n?.coarse)!==null&&m!==void 0?m:15,L=(g=n?.fine)!==null&&g!==void 0?g:5;return(0,At.useEffect)(()=>{if(r||K==null)return;let z=y.current;Dn(z,"Element ref not attached");let W=!1;return S8n(N,z,S,{coarse:ee,fine:L},(q,H,G)=>{if(!H){D("inactive");return}switch(q){case"down":{D("drag"),W=!1,Dn(G,'Expected event to be defined for "down" action'),P(N,G);let{onDragging:Z,onPointerDown:de}=_.current;Z?.(!0),de?.();break}case"move":{let{state:Z}=Y.current;W=!0,Z!=="drag"&&D("hover"),Dn(G,'Expected event to be defined for "move" action'),K(G);break}case"up":{D("hover"),T();let{onClick:Z,onDragging:de,onPointerUp:pe}=_.current;de?.(!1),pe?.(),W||Z?.();break}}})},[ee,S,r,L,E,N,K,P,T]),$8n({disabled:r,handleId:N,resizeHandler:K,panelGroupElement:I}),(0,At.createElement)(p,{...h,children:t,className:e,id:o,onBlur:()=>{F(!1),i?.()},onFocus:()=>{F(!0),u?.()},ref:y,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...d},tabIndex:f,[Hs.groupDirection]:S,[Hs.groupId]:C,[Hs.resizeHandle]:"",[Hs.resizeHandleActive]:M==="drag"?"pointer":k?"keyboard":void 0,[Hs.resizeHandleEnabled]:!r,[Hs.resizeHandleId]:N,[Hs.resizeHandleState]:M})}e9e.displayName="PanelResizeHandle";wn();var mfr=({className:t,...e})=>PY.createElement(QWe,{className:me("tw-flex tw-size-full data-[panel-group-direction=vertical]:tw-flex-col",t),...e}),t9e=ZWe,hfr=({withHandle:t,className:e,...r})=>PY.createElement(e9e,{className:me("tw-relative tw-flex tw-w-px tw-items-center tw-justify-center tw-bg-[var(--background-modifier-border)] after:tw-absolute after:tw-inset-y-0 after:tw-left-1/2 after:tw-w-1 after:tw--translate-x-1/2 focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring focus-visible:tw-ring-offset-1 data-[panel-group-direction=vertical]:tw-h-px data-[panel-group-direction=vertical]:tw-w-full data-[panel-group-direction=vertical]:after:tw-left-0 data-[panel-group-direction=vertical]:after:tw-h-1 data-[panel-group-direction=vertical]:after:tw-w-full data-[panel-group-direction=vertical]:after:tw--translate-y-1/2 data-[panel-group-direction=vertical]:after:tw-translate-x-0 [&[data-panel-group-direction=vertical]>div]:tw-rotate-90",e),...r},t&&PY.createElement("div",{className:"tw-z-sidedock tw-flex tw-h-4 tw-w-3 tw-items-center tw-justify-center tw-rounded-sm tw-border tw-border-solid tw-border-border"},PY.createElement(Bv,{className:"tw-size-2.5"})));var VO=j(X());var cr=j(X(),1);var gfr=j(X(),1),z8n=j(Ba(),1);kv();var yfr=j(ut(),1),U8n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],SV=U8n.reduce((t,e)=>{let r=Ff(`Primitive.${e}`),n=gfr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,yfr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var wh=j(X(),1);var _fr=j(X(),1);function bfr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function q8n(...t){return e=>{let r=!1,n=t.map(o=>{let i=bfr(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():bfr(t[o],null)}}}}function cA(...t){return _fr.useCallback(q8n(...t),t)}var vfr=j(X(),1),TY=globalThis?.document?vfr.useLayoutEffect:()=>{};var wfr=j(X(),1);function H8n(t,e){return wfr.useReducer((r,n)=>e[r][n]??r,t)}var CV=t=>{let{present:e,children:r}=t,n=V8n(e),o=typeof r=="function"?r({present:n.isPresent}):wh.Children.only(r),i=cA(n.ref,W8n(o));return typeof r=="function"||n.isPresent?wh.cloneElement(o,{ref:i}):null};CV.displayName="Presence";function V8n(t){let[e,r]=wh.useState(),n=wh.useRef(null),o=wh.useRef(t),i=wh.useRef("none"),a=t?"mounted":"unmounted",[s,u]=H8n(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return wh.useEffect(()=>{let l=$_e(n.current);i.current=s==="mounted"?l:"none"},[s]),TY(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=$_e(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),TY(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let m=$_e(n.current).includes(p.animationName);if(p.target===e&&m&&(u("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=p=>{p.target===e&&(i.current=$_e(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:wh.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function $_e(t){return t?.animationName||"none"}function W8n(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 dA=j(X(),1),xfr=j(ut(),1);function Sfr(t,e=[]){let r=[];function n(i,a){let s=dA.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...h}=d,m=f?.[t]?.[u]||s,g=dA.useMemo(()=>h,Object.values(h));return(0,xfr.jsx)(m.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,h=dA.useContext(p);if(h)return h;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=>dA.createContext(a));return function(s){let u=s?.[t]||i;return dA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,K8n(o,...e)]}function K8n(...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 dA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var OV=j(X(),1);function pN(t){let e=OV.useRef(t);return OV.useEffect(()=>{e.current=t}),OV.useMemo(()=>(...r)=>e.current?.(...r),[])}var B_e=j(X(),1),G8n=j(ut(),1),J8n=B_e.createContext(void 0);function Cfr(t){let e=B_e.useContext(J8n);return t||e||"ltr"}function Ofr(t,[e,r]){return Math.min(r,Math.max(e,t))}function mN(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Pfr=j(X(),1),Pi=j(ut(),1);function Z8n(t,e){return Pfr.useReducer((r,n)=>e[r][n]??r,t)}var r9e="ScrollArea",[Tfr,J9i]=Sfr(r9e),[Y8n,mb]=Tfr(r9e),Afr=cr.forwardRef((t,e)=>{let{__scopeScrollArea:r,type:n="hover",dir:o,scrollHideDelay:i=600,...a}=t,[s,u]=cr.useState(null),[l,c]=cr.useState(null),[d,f]=cr.useState(null),[p,h]=cr.useState(null),[m,g]=cr.useState(null),[y,_]=cr.useState(0),[w,S]=cr.useState(0),[C,E]=cr.useState(!1),[P,T]=cr.useState(!1),I=cA(e,M=>u(M)),N=Cfr(o);return(0,Pi.jsx)(Y8n,{scope:r,type:n,dir:N,scrollHideDelay:i,scrollArea:s,viewport:l,onViewportChange:c,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:h,scrollbarXEnabled:C,onScrollbarXEnabledChange:E,scrollbarY:m,onScrollbarYChange:g,scrollbarYEnabled:P,onScrollbarYEnabledChange:T,onCornerWidthChange:_,onCornerHeightChange:S,children:(0,Pi.jsx)(SV.div,{dir:N,...a,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});Afr.displayName=r9e;var Ifr="ScrollAreaViewport",Mfr=cr.forwardRef((t,e)=>{let{__scopeScrollArea:r,children:n,nonce:o,...i}=t,a=mb(Ifr,r),s=cr.useRef(null),u=cA(e,s,a.onViewportChange);return(0,Pi.jsxs)(Pi.Fragment,{children:[(0,Pi.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),(0,Pi.jsx)(SV.div,{"data-radix-scroll-area-viewport":"",...i,ref:u,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:(0,Pi.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});Mfr.displayName=Ifr;var HO="ScrollAreaScrollbar",q_e=cr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=mb(HO,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,s=t.orientation==="horizontal";return cr.useEffect(()=>(s?i(!0):a(!0),()=>{s?i(!1):a(!1)}),[s,i,a]),o.type==="hover"?(0,Pi.jsx)(X8n,{...n,ref:e,forceMount:r}):o.type==="scroll"?(0,Pi.jsx)(Q8n,{...n,ref:e,forceMount:r}):o.type==="auto"?(0,Pi.jsx)(Rfr,{...n,ref:e,forceMount:r}):o.type==="always"?(0,Pi.jsx)(n9e,{...n,ref:e}):null});q_e.displayName=HO;var X8n=cr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=mb(HO,t.__scopeScrollArea),[i,a]=cr.useState(!1);return cr.useEffect(()=>{let s=o.scrollArea,u=0;if(s){let l=()=>{window.clearTimeout(u),a(!0)},c=()=>{u=window.setTimeout(()=>a(!1),o.scrollHideDelay)};return s.addEventListener("pointerenter",l),s.addEventListener("pointerleave",c),()=>{window.clearTimeout(u),s.removeEventListener("pointerenter",l),s.removeEventListener("pointerleave",c)}}},[o.scrollArea,o.scrollHideDelay]),(0,Pi.jsx)(CV,{present:r||i,children:(0,Pi.jsx)(Rfr,{"data-state":i?"visible":"hidden",...n,ref:e})})}),Q8n=cr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=mb(HO,t.__scopeScrollArea),i=t.orientation==="horizontal",a=V_e(()=>u("SCROLL_END"),100),[s,u]=Z8n("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return cr.useEffect(()=>{if(s==="idle"){let l=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(l)}},[s,o.scrollHideDelay,u]),cr.useEffect(()=>{let l=o.viewport,c=i?"scrollLeft":"scrollTop";if(l){let d=l[c],f=()=>{let p=l[c];d!==p&&(u("SCROLL"),a()),d=p};return l.addEventListener("scroll",f),()=>l.removeEventListener("scroll",f)}},[o.viewport,i,u,a]),(0,Pi.jsx)(CV,{present:r||s!=="hidden",children:(0,Pi.jsx)(n9e,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:mN(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:mN(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),Rfr=cr.forwardRef((t,e)=>{let r=mb(HO,t.__scopeScrollArea),{forceMount:n,...o}=t,[i,a]=cr.useState(!1),s=t.orientation==="horizontal",u=V_e(()=>{if(r.viewport){let l=r.viewport.offsetWidth<r.viewport.scrollWidth,c=r.viewport.offsetHeight<r.viewport.scrollHeight;a(s?l:c)}},10);return EV(r.viewport,u),EV(r.content,u),(0,Pi.jsx)(CV,{present:n||i,children:(0,Pi.jsx)(n9e,{"data-state":i?"visible":"hidden",...o,ref:e})})}),n9e=cr.forwardRef((t,e)=>{let{orientation:r="vertical",...n}=t,o=mb(HO,t.__scopeScrollArea),i=cr.useRef(null),a=cr.useRef(0),[s,u]=cr.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Lfr(s.viewport,s.content),c={...n,sizes:s,onSizesChange:u,hasThumb:l>0&&l<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:f=>a.current=f};function d(f,p){return i5n(f,a.current,s,p)}return r==="horizontal"?(0,Pi.jsx)(e5n,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollLeft,p=Efr(f,s,o.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:f=>{o.viewport&&(o.viewport.scrollLeft=f)},onDragScroll:f=>{o.viewport&&(o.viewport.scrollLeft=d(f,o.dir))}}):r==="vertical"?(0,Pi.jsx)(t5n,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollTop,p=Efr(f,s);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:f=>{o.viewport&&(o.viewport.scrollTop=f)},onDragScroll:f=>{o.viewport&&(o.viewport.scrollTop=d(f))}}):null}),e5n=cr.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=mb(HO,t.__scopeScrollArea),[a,s]=cr.useState(),u=cr.useRef(null),l=cA(e,u,i.onScrollbarXChange);return cr.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Pi.jsx)(jfr,{"data-orientation":"horizontal",...o,ref:l,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":H_e(r)+"px",...t.style},onThumbPointerDown:c=>t.onThumbPointerDown(c.x),onDragScroll:c=>t.onDragScroll(c.x),onWheelScroll:(c,d)=>{if(i.viewport){let f=i.viewport.scrollLeft+c.deltaX;t.onWheelScroll(f),kfr(f,d)&&c.preventDefault()}},onResize:()=>{u.current&&i.viewport&&a&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:U_e(a.paddingLeft),paddingEnd:U_e(a.paddingRight)}})}})}),t5n=cr.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=mb(HO,t.__scopeScrollArea),[a,s]=cr.useState(),u=cr.useRef(null),l=cA(e,u,i.onScrollbarYChange);return cr.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Pi.jsx)(jfr,{"data-orientation":"vertical",...o,ref:l,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":H_e(r)+"px",...t.style},onThumbPointerDown:c=>t.onThumbPointerDown(c.y),onDragScroll:c=>t.onDragScroll(c.y),onWheelScroll:(c,d)=>{if(i.viewport){let f=i.viewport.scrollTop+c.deltaY;t.onWheelScroll(f),kfr(f,d)&&c.preventDefault()}},onResize:()=>{u.current&&i.viewport&&a&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:U_e(a.paddingTop),paddingEnd:U_e(a.paddingBottom)}})}})}),[r5n,Nfr]=Tfr(HO),jfr=cr.forwardRef((t,e)=>{let{__scopeScrollArea:r,sizes:n,hasThumb:o,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:s,onThumbPositionChange:u,onDragScroll:l,onWheelScroll:c,onResize:d,...f}=t,p=mb(HO,r),[h,m]=cr.useState(null),g=cA(e,I=>m(I)),y=cr.useRef(null),_=cr.useRef(""),w=p.viewport,S=n.content-n.viewport,C=pN(c),E=pN(u),P=V_e(d,10);function T(I){if(y.current){let N=I.clientX-y.current.left,M=I.clientY-y.current.top;l({x:N,y:M})}}return cr.useEffect(()=>{let I=N=>{let M=N.target;h?.contains(M)&&C(N,S)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[w,h,S,C]),cr.useEffect(E,[n,E]),EV(h,P),EV(p.content,P),(0,Pi.jsx)(r5n,{scope:r,scrollbar:h,hasThumb:o,onThumbChange:pN(i),onThumbPointerUp:pN(a),onThumbPositionChange:E,onThumbPointerDown:pN(s),children:(0,Pi.jsx)(SV.div,{...f,ref:g,style:{position:"absolute",...f.style},onPointerDown:mN(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),y.current=h.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),T(I))}),onPointerMove:mN(t.onPointerMove,T),onPointerUp:mN(t.onPointerUp,I=>{let N=I.target;N.hasPointerCapture(I.pointerId)&&N.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=_.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),z_e="ScrollAreaThumb",o9e=cr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=Nfr(z_e,t.__scopeScrollArea);return(0,Pi.jsx)(CV,{present:r||o.hasThumb,children:(0,Pi.jsx)(n5n,{ref:e,...n})})}),n5n=cr.forwardRef((t,e)=>{let{__scopeScrollArea:r,style:n,...o}=t,i=mb(z_e,r),a=Nfr(z_e,r),{onThumbPositionChange:s}=a,u=cA(e,d=>a.onThumbChange(d)),l=cr.useRef(void 0),c=V_e(()=>{l.current&&(l.current(),l.current=void 0)},100);return cr.useEffect(()=>{let d=i.viewport;if(d){let f=()=>{if(c(),!l.current){let p=a5n(d,s);l.current=p,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,c,s]),(0,Pi.jsx)(SV.div,{"data-state":a.hasThumb?"visible":"hidden",...o,ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:mN(t.onPointerDownCapture,d=>{let p=d.target.getBoundingClientRect(),h=d.clientX-p.left,m=d.clientY-p.top;a.onThumbPointerDown({x:h,y:m})}),onPointerUp:mN(t.onPointerUp,a.onThumbPointerUp)})});o9e.displayName=z_e;var i9e="ScrollAreaCorner",Dfr=cr.forwardRef((t,e)=>{let r=mb(i9e,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?(0,Pi.jsx)(o5n,{...t,ref:e}):null});Dfr.displayName=i9e;var o5n=cr.forwardRef((t,e)=>{let{__scopeScrollArea:r,...n}=t,o=mb(i9e,r),[i,a]=cr.useState(0),[s,u]=cr.useState(0),l=!!(i&&s);return EV(o.scrollbarX,()=>{let c=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(c),u(c)}),EV(o.scrollbarY,()=>{let c=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(c),a(c)}),l?(0,Pi.jsx)(SV.div,{...n,ref:e,style:{width:i,height:s,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function U_e(t){return t?parseInt(t,10):0}function Lfr(t,e){let r=t/e;return isNaN(r)?0:r}function H_e(t){let e=Lfr(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function i5n(t,e,r,n="ltr"){let o=H_e(r),i=o/2,a=e||i,s=o-a,u=r.scrollbar.paddingStart+a,l=r.scrollbar.size-r.scrollbar.paddingEnd-s,c=r.content-r.viewport,d=n==="ltr"?[0,c]:[c*-1,0];return Ffr([u,l],d)(t)}function Efr(t,e,r="ltr"){let n=H_e(e),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-o,a=e.content-e.viewport,s=i-n,u=r==="ltr"?[0,a]:[a*-1,0],l=Ofr(t,u);return Ffr([0,a],[0,s])(l)}function Ffr(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 kfr(t,e){return t>0&&t<e}var a5n=(t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return function o(){let i={left:t.scrollLeft,top:t.scrollTop},a=r.left!==i.left,s=r.top!==i.top;(a||s)&&e(),r=i,n=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(n)};function V_e(t,e){let r=pN(t),n=cr.useRef(0);return cr.useEffect(()=>()=>window.clearTimeout(n.current),[]),cr.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function EV(t,e){let r=pN(e);TY(()=>{let n=0;if(t){let o=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return o.observe(t),()=>{window.cancelAnimationFrame(n),o.unobserve(t)}}},[t,r])}var a9e=Afr,$fr=Mfr;var Bfr=Dfr;wn();var W_e=VO.forwardRef(({className:t,children:e,...r},n)=>VO.createElement(a9e,{ref:n,className:me("tw-relative tw-overflow-hidden",t),...r},VO.createElement($fr,{className:"tw-size-full tw-rounded-[inherit] [&>div:first-child]:!tw-block"},e),VO.createElement(zfr,null),VO.createElement(Bfr,null)));W_e.displayName=a9e.displayName;var zfr=VO.forwardRef(({className:t,orientation:e="vertical",...r},n)=>VO.createElement(q_e,{ref:n,orientation:e,className:me("tw-flex tw-touch-none tw-select-none tw-transition-colors",e==="vertical"&&"tw-h-full tw-w-2.5 tw-border-l tw-border-l-transparent tw-p-px",e==="horizontal"&&"tw-h-2.5 tw-flex-col tw-border-t tw-border-t-transparent tw-p-px",t),...r},VO.createElement(o9e,{className:"tw-relative tw-flex-1 tw-rounded-full tw-bg-[var(--background-modifier-border)]"})));zfr.displayName=q_e.displayName;var PV=j(X());vo();fn();var K_e=({value:t,onChange:e,placeholder:r="Search..."})=>PV.default.createElement("div",{className:"tw-relative"},PV.default.createElement(mi,{type:"text",placeholder:r,value:t,onChange:n=>e(n.target.value),className:"tw-pr-10"}),t&&PV.default.createElement(he,{variant:"secondary",onClick:()=>e(""),className:"tw-absolute tw-right-8 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-rounded-full tw-p-0 tw-transition-colors","aria-label":"Clear search"},PV.default.createElement(OI,{className:"tw-size-4 tw-text-muted/60 hover:tw-text-accent-hover"})),PV.default.createElement(Qj,{className:"tw-absolute tw-right-3 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-text-muted"}));wn();th();fr();fn();var J_e=require("obsidian"),Ne=j(X()),Hfr=j(Lc());function u5n({extension:t,size:e="tw-size-4"}){let r=t.toLowerCase().replace("*.","");return["jpg","jpeg","png","gif","svg"].includes(r)?Ne.default.createElement(_5,{className:`tw-text-context-manager-blue ${e}`}):["mp3","wav","ogg"].includes(r)?Ne.default.createElement(b5,{className:`tw-text-context-manager-purple ${e}`}):["mp4","mov","avi"].includes(r)?Ne.default.createElement(x5,{className:`tw-text-context-manager-orange ${e}`}):["md","txt","mdx","markdown"].includes(r)?Ne.default.createElement(Dm,{className:`${e}`}):Ne.default.createElement(Dm,{className:`tw-text-faint ${e}`})}var s9e=({IconComponent:t,title:e,iconColorClassName:r,onAddClick:n,tooltip:o})=>Ne.default.createElement("div",{className:"tw-mb-3 tw-flex tw-items-center tw-justify-between"},Ne.default.createElement("div",{className:"tw-flex tw-items-center"},Ne.default.createElement(t,{className:`tw-mr-2 tw-size-4 ${r}`}),Ne.default.createElement("h3",{className:`tw-text-sm tw-font-semibold ${r}`},e),o&&Ne.default.createElement(No,{delayDuration:0},Ne.default.createElement(Ot,null,Ne.default.createElement(Et,{asChild:!0},Ne.default.createElement(Fi,{className:"tw-ml-2 tw-size-4 tw-text-muted"})),Ne.default.createElement(xt,null,Ne.default.createElement("div",{className:"tw-max-w-80"},o))))),Ne.default.createElement(he,{variant:"ghost",size:"fit",className:"tw-text-muted hover:tw-bg-secondary",title:`Add new ${e.toLowerCase()}`,onClick:n},Ne.default.createElement(kh,{className:`tw-size-4 ${r}`}))),Ufr=({title:t,IconComponent:e,iconColorClassName:r,items:n,activeItem:o,activeSection:i,sectionType:a,renderIcon:s,onItemClick:u,onAddClick:l,onDeleteItem:c,tooltip:d})=>Ne.default.createElement("div",null,Ne.default.createElement(s9e,{IconComponent:e,title:t,iconColorClassName:r,onAddClick:l,tooltip:d}),Ne.default.createElement("div",{className:"tw-space-y-1"},n.map(f=>Ne.default.createElement("div",{key:f.id,className:me("tw-group tw-flex tw-cursor-pointer tw-items-center tw-justify-between tw-rounded-md tw-p-2 hover:tw-bg-secondary/50",i===a&&o===f.id&&"tw-bg-secondary tw-text-normal"),onClick:()=>u(f.id,f.name)},Ne.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-items-center"},s?s(f):Ne.default.createElement(e,{className:`tw-mr-2 tw-size-4 ${r}`}),Ne.default.createElement(vh,{className:"tw-flex-1 tw-text-sm"},f.name)),Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement("span",{className:"tw-text-xs tw-text-muted group-hover:tw-hidden"},f.count||0),Ne.default.createElement(bi,{className:"tw-hidden tw-size-4 tw-shrink-0 tw-text-muted hover:tw-text-warning group-hover:tw-block group-hover:tw-flex-none",onClick:p=>c(p,f)}))))));function l5n({item:t,viewMode:e,onDelete:r}){let n=t.id.split(".").pop()||"",o=t.isIgnored?Bh:bi;return Ne.default.createElement("div",{className:"tw-group tw-flex tw-cursor-pointer tw-items-center tw-rounded-lg tw-border tw-border-solid tw-border-border tw-p-2 tw-transition-shadow hover:tw-shadow-md"},Ne.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},Ne.default.createElement(u5n,{extension:n,size:"tw-size-8"})),Ne.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},Ne.default.createElement(vh,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.isIgnored&&Ne.default.createElement("span",{className:"tw-text-sm tw-text-error"}," (Ignored files)"),t.name),t.id&&Ne.default.createElement(vh,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.id)),Ne.default.createElement("div",{className:"tw-ml-auto tw-flex tw-min-w-[24px] tw-items-center tw-justify-end tw-gap-2"},Ne.default.createElement(o,{className:"tw-hidden tw-size-4 tw-shrink-0 tw-text-muted hover:tw-text-warning group-hover:tw-block group-hover:tw-flex-none",onClick:i=>r(i,t)})))}function c5n({item:t,onClick:e}){let r,n;switch(t.type){case"tag":r=TI,n="tw-text-context-manager-orange";break;case"folder":r=ny,n="tw-text-context-manager-yellow";break;case"files":r=Dm,n="tw-text-context-manager-blue";break;case"ignoreFiles":r=bi,n="tw-text-context-manager-red";break}return Ne.default.createElement("div",{className:"tw-group tw-flex tw-cursor-pointer tw-items-center tw-rounded-lg tw-border tw-border-solid tw-border-border tw-p-2 tw-transition-shadow hover:tw-shadow-md",onClick:()=>e(t)},Ne.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},Ne.default.createElement(r,{className:`tw-size-6 ${n}`})),Ne.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},Ne.default.createElement(vh,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.type==="tag"&&Ne.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),t.name),Ne.default.createElement(vh,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.count," ",t.count===1?"item":"items")))}function qfr(t){return"type"in t}function d5n({initialProject:t,onSave:e,onCancel:r,app:n}){let{inclusions:o,exclusions:i}=(0,Ne.useMemo)(()=>bc({inclusions:t?.contextSource.inclusions,exclusions:t?.contextSource.exclusions,isProject:!0}),[t.contextSource]),a=(0,Ne.useMemo)(()=>n.vault.getFiles(),[n.vault]),s=(0,Ne.useCallback)((z,W,V)=>{let q=z.filter(ae=>ys(ae,W,V,!0)),H=(ae,Te,Ae,ke)=>{Te&&Te.forEach(St=>{let Nr={[Ae]:[St]};ys(ae,Nr,null,!0)&&!ke[St].some(Ir=>Ir.id===ae.path)&&ke[St].push({id:ae.path,name:ae.basename})})},G={},Z={},de={},pe=[];return(W?.tagPatterns??[]).forEach(ae=>{G[ae]=[]}),(W?.folderPatterns??[]).forEach(ae=>{Z[ae]=[]}),(W?.extensionPatterns??[]).forEach(ae=>{de[ae]=[]}),q.forEach(ae=>{H(ae,W?.tagPatterns,"tagPatterns",G),H(ae,W?.folderPatterns,"folderPatterns",Z),H(ae,W?.extensionPatterns,"extensionPatterns",de),W?.notePatterns&&ys(ae,{notePatterns:W.notePatterns},null,!0)&&!pe.some(Te=>Te.id===ae.path)&&pe.push({id:ae.path,name:ae.basename})}),{tags:G,folders:Z,extensions:de,notes:pe}},[]),[u,l]=(0,Ne.useState)(()=>s(a,o,i)),[c,d]=(0,Ne.useState)(()=>{let z=a.filter(W=>i&&ys(W,i,null,!0));return{files:new Set(z)}}),f=(0,Ne.useRef)(u),p=(0,Ne.useRef)(c),[h,m]=(0,Ne.useState)(""),[g,y]=(0,Ne.useState)(null),[_,w]=(0,Ne.useState)(null),S=(0,Ne.useCallback)((z,W)=>{let V=Object.keys(z.tags),q=Object.keys(z.folders),H=Object.keys(z.extensions),G=z.notes.map(Z=>{let de=W.find(pe=>pe.path===Z.id);if(de)return a4(de)}).filter(Boolean);return i4({tagPatterns:V,folderPatterns:q,extensionPatterns:H,notePatterns:G})},[]),C=(0,Ne.useCallback)(z=>{let W=new Array(...z.files).map(V=>a4(V));return i4({notePatterns:W})||""},[]);(0,Ne.useEffect)(()=>{f.current=u,p.current=c},[u,c]);let E=(0,Ne.useMemo)(()=>{let z=[],W=(q,H)=>{H.forEach(G=>{q.some(Z=>Z.id===G.id)||q.push({id:G.id,name:G.name})})};return[u.tags,u.folders,u.extensions,{notes:u.notes}].forEach(q=>{Object.values(q).forEach(H=>{W(z,H)})}),z},[u]),P=(0,Ne.useCallback)(z=>{let W=[],V=[],q=[];return z.split(",").map(G=>G.trim()).filter(G=>G).forEach(G=>{G.startsWith("#")?W.push(G.substring(1)):G.startsWith(".")||G.startsWith("*.")?q.push(G.replace("*","")):V.push(G)}),{tags:W,titles:V,extensions:q}},[]),T=(0,Ne.useCallback)(z=>[...z].sort((W,V)=>W.name.toLowerCase().localeCompare(V.name.toLowerCase())),[]),I=(0,Ne.useMemo)(()=>{if(h){let z=P(h);return E.filter(W=>{let V=a.find(pe=>pe.path===W.id);if(!V)return!1;let q=V.extension==="md",H=z.tags.length>0&&q&&z.tags.some(pe=>Sj(V).some(Te=>(Te.startsWith("#")?Te.substring(1):Te).toLowerCase().includes(pe.toLowerCase()))),G=z.titles.length>0&&z.titles.some(pe=>V.basename.toLowerCase().includes(pe.toLowerCase())),Z=z.extensions.length>0&&z.extensions.some(pe=>`.${V.extension}`.toLowerCase()===pe.toLowerCase());return z.tags.length>0||z.titles.length>0||z.extensions.length>0?H||G||Z:!1}).map(W=>({id:W.id,name:W.name}))}if(g==="tags"&&_){let z=u.tags[_];return z||[]}if(g==="folders"&&_){let z=u.folders[_];return z||[]}if(g==="files")return u.notes;if(g==="extensions"&&_){let z=u.extensions[_];return z||[]}if(g==="ignoreFiles")return Array.from(c.files).map(z=>({id:z.path,name:z.basename}));if(!g){let z=T(Object.entries(u.tags).map(([H,G])=>({id:`tag:${H}`,name:H.slice(1),type:"tag",originalId:H,count:G.length}))),W=T(Object.entries(u.folders).map(([H,G])=>({id:`folder:${H}`,name:H,type:"folder",originalId:H,count:G.length}))),V=u.notes.length>0?[{id:"files:all",name:"Files",type:"files",count:u.notes.length}]:[],q=c.files.size>0?[{id:"ignoreFiles:all",name:"Ignore Files",type:"ignoreFiles",count:c.files.size}]:[];return[...z,...W,...V,...q]}return[]},[h,g,_,P,E,a,u.tags,u.folders,u.notes,u.extensions,c.files,T]),N=(0,Ne.useCallback)((z,W)=>Object.entries(z).sort(([V],[q])=>V.localeCompare(q)).map(([V,q])=>({id:V,name:W?W(V):V,count:q.length})),[]),M=(0,Ne.useCallback)((z,W,V)=>{let q=Z=>a.filter(de=>ys(de,Z,null,!0)).map(de=>({id:de.path,name:de.basename})),H=[...p.current.files],G=q(V).map(Z=>({...Z,isIgnored:H.some(de=>de.path===Z.id)}));l(Z=>({...Z,[z]:{...Z[z],[W]:G}}))},[a]),D=(0,Ne.useCallback)((z,W)=>{let V={tags:{...z.tags},folders:{...z.folders},extensions:{...z.extensions},notes:[...z.notes]},q=H=>{Object.keys(H).forEach(G=>{H[G]=H[G].filter(Z=>Z.id!==W)})};return q(V.tags),q(V.folders),q(V.extensions),V.notes=V.notes.filter(H=>H.id!==W),V},[]),k=(0,Ne.useCallback)((z,W=null,V=!0)=>{y(z),w(W),V&&m("")},[]),F=(0,Ne.useMemo)(()=>{let z=W=>(V,q)=>{V.stopPropagation(),l(H=>{let G={...H[W]};return delete G[q.id],{...H,[W]:G}})};return{delete:{tag:z("tags"),folder:z("folders"),extension:z("extensions")},add:{tag:()=>{new yV(n,W=>{let V=YK(W);M("tags",V,{tagPatterns:[V]})}).open()},folder:()=>{new gV(n,W=>{M("folders",W,{folderPatterns:[W]})}).open()},file:()=>{new xY({app:n,onFileSelect:W=>{u.notes.find(q=>q.id===W.path)||(d(q=>{let H=new Set(q.files);return H.delete(W),{...q,files:H}}),l(q=>({...q,notes:[...q.notes,{id:W.path,name:W.basename}]})))},excludeFilePaths:[],titleOnly:!1}).open()},extension:()=>{new J_e.Notice("Adding extension is temporarily not supported.")},ignoreFile:()=>{new xY({app:n,onFileSelect:W=>{c.files.has(W)||(d(q=>{let H=new Set(q.files);return H.add(W),{...q,files:H}}),l(q=>D(q,W.path)))},excludeFilePaths:[],titleOnly:!1}).open()}},click:{tag:W=>{k("tags",W)},folder:W=>{k("folders",W)},extension:W=>{k("extensions",W)},files:()=>{k("files")},ignoreFiles:()=>{k("ignoreFiles")}}}},[n,u.notes,c.files,M,D,k]),K=(0,Ne.useCallback)(z=>{z.type==="tag"&&z.originalId?F.click.tag(z.originalId):z.type==="folder"&&z.originalId?F.click.folder(z.originalId):z.type==="files"?F.click.files():z.type==="ignoreFiles"&&F.click.ignoreFiles()},[F]),U=()=>h?`Search Results for: "${h}"`:g==="tags"&&_?`Tag: ${_}`:g==="folders"&&_?`Folder: ${_}`:g==="files"?"Files":g==="extensions"&&_?`Extension: ${_}`:g==="ignoreFiles"?"Ignore Files":"All Categories",Y=(z,W)=>{z.stopPropagation();let V=a.find(q=>q.path===W.id);V&&(d(q=>{let H=new Set(q.files);return H.add(V),{...q,files:H}}),l(q=>D(q,W.id)))},ee=(0,Ne.useCallback)(()=>{let z=S(f.current,a),W=C(p.current),{inclusions:V,exclusions:q}=bc({inclusions:z,exclusions:W,isProject:!0}),H=s(a,V,q);l(H)},[a,C,S,s]),L=(z,W)=>{z.stopPropagation();let V=a.find(q=>q.path===W.id);V&&(d(q=>{let H=new Set(q.files);return H.delete(V),{...q,files:H}}),ee())},Q=()=>{let z=S(u,a),W=C(c);e({...t,contextSource:{...t.contextSource,inclusions:z,exclusions:W}})};return Ne.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ne.default.createElement(mfr,{direction:"horizontal",className:"tw-flex-1"},Ne.default.createElement(t9e,{defaultSize:30,minSize:20,maxSize:40},Ne.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ne.default.createElement("div",{className:"tw-border-b tw-p-4"},Ne.default.createElement("h2",{className:"tw-text-lg tw-font-semibold"},"File Context")),Ne.default.createElement(W_e,{className:"tw-max-h-[500px] tw-flex-1"},Ne.default.createElement("div",{className:"tw-space-y-6 tw-p-4"},Ne.default.createElement(Ufr,{title:"Tags",IconComponent:TI,iconColorClassName:"tw-text-context-manager-orange",items:N(u.tags,z=>z.slice(1)),activeItem:_,activeSection:g,sectionType:"tags",renderIcon:z=>Ne.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),onItemClick:F.click.tag,onAddClick:F.add.tag,onDeleteItem:(z,W)=>F.delete.tag(z,W),tooltip:"must be in note property"}),Ne.default.createElement(C$,null),Ne.default.createElement(Ufr,{title:"Folders",IconComponent:ny,iconColorClassName:"tw-text-context-manager-yellow",items:N(u.folders),activeItem:_,activeSection:g,sectionType:"folders",onItemClick:F.click.folder,onAddClick:F.add.folder,onDeleteItem:(z,W)=>F.delete.folder(z,W)}),Ne.default.createElement(C$,null),Ne.default.createElement("div",null,Ne.default.createElement(s9e,{IconComponent:Dm,title:"Files",iconColorClassName:"tw-text-context-manager-blue",onAddClick:F.add.file}),Ne.default.createElement("div",{className:me("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",g==="files"&&"tw-bg-secondary tw-text-normal"),onClick:F.click.files},"Files (",u.notes.length,")")),Ne.default.createElement(C$,null),Ne.default.createElement("div",null,Ne.default.createElement(s9e,{IconComponent:bi,title:"Ignore Files",iconColorClassName:"tw-text-context-manager-red",onAddClick:F.add.ignoreFile}),Ne.default.createElement("div",{className:me("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",g==="ignoreFiles"&&"tw-bg-secondary tw-text-normal"),onClick:F.click.ignoreFiles},"Ignore Files (",c.files.size,")")))))),Ne.default.createElement(hfr,{withHandle:!0}),Ne.default.createElement(t9e,{defaultSize:70},Ne.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ne.default.createElement("div",{className:"tw-border-b tw-p-4"},Ne.default.createElement(K_e,{placeholder:"Custom search: title, #tag1, .jpg",value:h,onChange:z=>{m(z),z&&k("search",null,!1)}})),Ne.default.createElement("div",{className:"tw-p-4"},Ne.default.createElement("h3",{className:"tw-text-lg tw-font-medium tw-text-muted"},U())),Ne.default.createElement(W_e,{className:"tw-max-h-[400px] tw-flex-1 tw-p-4 tw-pt-0"},I.length===0?Ne.default.createElement("div",{className:"tw-mt-10 tw-text-center tw-text-muted"},g?"No items found.":"No categories found. Add tags, folders, or files using the sidebar."):Ne.default.createElement("div",{className:"tw-space-y-2",style:{display:"block"}},g||h?T(I).map(z=>qfr(z)?null:Ne.default.createElement(l5n,{key:z.id,item:z,viewMode:"list",onDelete:g==="ignoreFiles"||z.isIgnored?L:Y})).filter(Boolean):I.map(z=>qfr(z)?Ne.default.createElement(c5n,{key:z.id,item:z,onClick:K}):null).filter(Boolean)))))),Ne.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2 tw-border-t tw-p-1"},Ne.default.createElement(he,{variant:"ghost",onClick:r},"Cancel"),Ne.default.createElement(he,{onClick:Q},"Save")))}var G_e=class extends J_e.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r,modalEl:n}=this;this.root=(0,Hfr.createRoot)(r),n.style.minWidth="50vw";let o=a=>{this.onSave(a),this.close()},i=()=>{this.close()};this.root.render(Ne.default.createElement(d5n,{initialProject:this.initialProject,onSave:o,onCancel:i,app:this.app}))}onClose(){this.root&&this.root.unmount()}};vo();var TV=j(X());var Jn=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>TV.default.createElement("div",{className:"tw-space-y-2"},t&&TV.default.createElement(Xp,{className:r?"tw-text-error":""},t," ",e&&TV.default.createElement("span",{className:"tw-text-error"},"*")),n&&TV.default.createElement("p",{className:"tw-text-sm tw-text-muted"},n),i,r&&TV.default.createElement("p",{className:"tw-text-xs tw-text-error"},o));var j$=j(X());wn();fn();function Z_e({options:t,placeholder:e,containerClassName:r,className:n,...o}){return j$.default.createElement("div",{className:me("tw-group tw-relative tw-w-full",r)},j$.default.createElement("select",{className:me("tw-w-full tw-appearance-none","tw-flex tw-h-9 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-dropdown tw-px-3 tw-py-1 tw-pr-8","tw-text-sm tw-shadow tw-transition-colors","focus:tw-outline-none focus:tw-ring-1 focus:tw-ring-ring","disabled:tw-cursor-not-allowed disabled:tw-opacity-50","hover:tw-bg-interactive-hover hover:tw-text-normal",n),...o},e&&j$.default.createElement("option",{value:"",disabled:!0},e),t.map(i=>j$.default.createElement("option",{key:i.value,value:i.value},i.label))),j$.default.createElement("div",{className:me("tw-pointer-events-none tw-absolute tw-inset-y-0 tw-right-0 tw-flex tw-items-center tw-pr-2","tw-transition-colors group-hover:[&>svg]:tw-text-normal",o.disabled&&"tw-opacity-50")},j$.default.createElement(Li,{className:"tw-size-4"})))}var gN=j(X());wn();var L$=j(X());var ea=j(X(),1);function u9e(t,[e,r]){return Math.min(r,Math.max(e,t))}function D$(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Wfr=j(X(),1);function Vfr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function f5n(...t){return e=>{let r=!1,n=t.map(o=>{let i=Vfr(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():Vfr(t[o],null)}}}}function WO(...t){return Wfr.useCallback(f5n(...t),t)}var fA=j(X(),1),Kfr=j(ut(),1);function Y_e(t,e=[]){let r=[];function n(i,a){let s=fA.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...h}=d,m=f?.[t]?.[u]||s,g=fA.useMemo(()=>h,Object.values(h));return(0,Kfr.jsx)(m.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,h=fA.useContext(p);if(h)return h;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=>fA.createContext(a));return function(s){let u=s?.[t]||i;return fA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,p5n(o,...e)]}function p5n(...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 fA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var hb=j(X(),1);var Gfr=j(X(),1),X_e=globalThis?.document?Gfr.useLayoutEffect:()=>{};var Q_e=j(X(),1);var m5n=hb[" useInsertionEffect ".trim().toString()]||X_e;function Jfr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=h5n({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=hb.useRef(t!==void 0);hb.useEffect(()=>{let d=c.current;d!==s&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}let l=hb.useCallback(c=>{if(s){let d=g5n(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function h5n({defaultProp:t,onChange:e}){let[r,n]=hb.useState(t),o=hb.useRef(r),i=hb.useRef(e);return m5n(()=>{i.current=e},[e]),hb.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function g5n(t){return typeof t=="function"}var RKi=Symbol("RADIX:SYNC_STATE");var eve=j(X(),1),y5n=j(ut(),1),b5n=eve.createContext(void 0);function Zfr(t){let e=eve.useContext(b5n);return t||e||"ltr"}var tve=j(X(),1);function Yfr(t){let e=tve.useRef({value:t,previous:t});return tve.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Xfr=j(X(),1);function Qfr(t){let[e,r]=Xfr.useState(void 0);return X_e(()=>{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 epr=j(X(),1),_5n=j(Ba(),1);kv();var tpr=j(ut(),1),v5n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],AV=v5n.reduce((t,e)=>{let r=Ff(`Primitive.${e}`),n=epr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,tpr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var hN=j(X(),1);kv();var rve=j(ut(),1),w5n=j(X(),1);var x5n=j(ut(),1);function rpr(t){let e=t+"CollectionProvider",[r,n]=Y_e(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=m=>{let{scope:g,children:y}=m,_=hN.default.useRef(null),w=hN.default.useRef(new Map).current;return(0,rve.jsx)(o,{scope:g,itemMap:w,collectionRef:_,children:y})};a.displayName=e;let s=t+"CollectionSlot",u=Ff(s),l=hN.default.forwardRef((m,g)=>{let{scope:y,children:_}=m,w=i(s,y),S=WO(g,w.collectionRef);return(0,rve.jsx)(u,{ref:S,children:_})});l.displayName=s;let c=t+"CollectionItemSlot",d="data-radix-collection-item",f=Ff(c),p=hN.default.forwardRef((m,g)=>{let{scope:y,children:_,...w}=m,S=hN.default.useRef(null),C=WO(g,S),E=i(c,y);return hN.default.useEffect(()=>(E.itemMap.set(S,{ref:S,...w}),()=>void E.itemMap.delete(S))),(0,rve.jsx)(f,{[d]:"",ref:C,children:_})});p.displayName=c;function h(m){let g=i(t+"CollectionConsumer",m);return hN.default.useCallback(()=>{let _=g.collectionRef.current;if(!_)return[];let w=Array.from(_.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((E,P)=>w.indexOf(E.ref.current)-w.indexOf(P.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:a,Slot:l,ItemSlot:p},h,n]}var Tc=j(ut(),1),npr=["PageUp","PageDown"],opr=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ipr={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},IV="Slider",[l9e,S5n,C5n]=rpr(IV),[apr,nGi]=Y_e(IV,[C5n]),[O5n,nve]=apr(IV),spr=ea.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:h,...m}=t,g=ea.useRef(new Set),y=ea.useRef(0),w=a==="horizontal"?E5n:P5n,[S=[],C]=Jfr({prop:c,defaultProp:l,onChange:M=>{[...g.current][y.current]?.focus(),d(M)}}),E=ea.useRef(S);function P(M){let D=R5n(S,M);N(M,D)}function T(M){N(M,y.current)}function I(){let M=E.current[y.current];S[y.current]!==M&&f(S)}function N(M,D,{commit:k}={commit:!1}){let F=L5n(i),K=F5n(Math.round((M-n)/i)*i+n,F),U=u9e(K,[n,o]);C((Y=[])=>{let ee=I5n(Y,U,D);if(D5n(ee,u*i)){y.current=ee.indexOf(U);let L=String(ee)!==String(Y);return L&&k&&f(ee),L?ee:Y}else return Y})}return(0,Tc.jsx)(O5n,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:y,thumbs:g.current,values:S,orientation:a,form:h,children:(0,Tc.jsx)(l9e.Provider,{scope:t.__scopeSlider,children:(0,Tc.jsx)(l9e.Slot,{scope:t.__scopeSlider,children:(0,Tc.jsx)(w,{"aria-disabled":s,"data-disabled":s?"":void 0,...m,ref:e,onPointerDown:D$(m.onPointerDown,()=>{s||(E.current=S)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:P,onSlideMove:s?void 0:T,onSlideEnd:s?void 0:I,onHomeKeyDown:()=>!s&&N(n,0,{commit:!0}),onEndKeyDown:()=>!s&&N(o,S.length-1,{commit:!0}),onStepKeyDown:({event:M,direction:D})=>{if(!s){let K=npr.includes(M.key)||M.shiftKey&&opr.includes(M.key)?10:1,U=y.current,Y=S[U],ee=i*K*D;N(Y+ee,U,{commit:!0})}}})})})})});spr.displayName=IV;var[upr,lpr]=apr(IV,{startEdge:"left",endEdge:"right",size:"width",direction:1}),E5n=ea.forwardRef((t,e)=>{let{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:u,onStepKeyDown:l,...c}=t,[d,f]=ea.useState(null),p=WO(e,w=>f(w)),h=ea.useRef(void 0),m=Zfr(o),g=m==="ltr",y=g&&!i||!g&&i;function _(w){let S=h.current||d.getBoundingClientRect(),C=[0,S.width],P=f9e(C,y?[r,n]:[n,r]);return h.current=S,P(w-S.left)}return(0,Tc.jsx)(upr,{scope:t.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:(0,Tc.jsx)(cpr,{dir:m,"data-orientation":"horizontal",...c,ref:p,style:{...c.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{let S=_(w.clientX);a?.(S)},onSlideMove:w=>{let S=_(w.clientX);s?.(S)},onSlideEnd:()=>{h.current=void 0,u?.()},onStepKeyDown:w=>{let C=ipr[y?"from-left":"from-right"].includes(w.key);l?.({event:w,direction:C?-1:1})}})})}),P5n=ea.forwardRef((t,e)=>{let{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:u,...l}=t,c=ea.useRef(null),d=WO(e,c),f=ea.useRef(void 0),p=!o;function h(m){let g=f.current||c.current.getBoundingClientRect(),y=[0,g.height],w=f9e(y,p?[n,r]:[r,n]);return f.current=g,w(m-g.top)}return(0,Tc.jsx)(upr,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,Tc.jsx)(cpr,{"data-orientation":"vertical",...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{let g=h(m.clientY);i?.(g)},onSlideMove:m=>{let g=h(m.clientY);a?.(g)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:m=>{let y=ipr[p?"from-bottom":"from-top"].includes(m.key);u?.({event:m,direction:y?-1:1})}})})}),cpr=ea.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=nve(IV,r);return(0,Tc.jsx)(AV.span,{...l,ref:e,onKeyDown:D$(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):npr.concat(opr).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:D$(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:D$(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:D$(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),dpr="SliderTrack",fpr=ea.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=nve(dpr,r);return(0,Tc.jsx)(AV.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});fpr.displayName=dpr;var c9e="SliderRange",ppr=ea.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=nve(c9e,r),i=lpr(c9e,r),a=ea.useRef(null),s=WO(e,a),u=o.values.length,l=o.values.map(f=>gpr(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,Tc.jsx)(AV.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});ppr.displayName=c9e;var d9e="SliderThumb",mpr=ea.forwardRef((t,e)=>{let r=S5n(t.__scopeSlider),[n,o]=ea.useState(null),i=WO(e,s=>o(s)),a=ea.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,Tc.jsx)(T5n,{...t,ref:i,index:a})}),T5n=ea.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=nve(d9e,r),s=lpr(d9e,r),[u,l]=ea.useState(null),c=WO(e,_=>l(_)),d=u?a.form||!!u.closest("form"):!0,f=Qfr(u),p=a.values[n],h=p===void 0?0:gpr(p,a.min,a.max),m=M5n(n,a.values.length),g=f?.[s.size],y=g?N5n(g,h,s.direction):0;return ea.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,Tc.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${h}% + ${y}px)`},children:[(0,Tc.jsx)(l9e.ItemSlot,{scope:t.__scopeSlider,children:(0,Tc.jsx)(AV.span,{role:"slider","aria-label":t["aria-label"]||m,"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:D$(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,Tc.jsx)(hpr,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});mpr.displayName=d9e;var A5n="RadioBubbleInput",hpr=ea.forwardRef(({__scopeSlider:t,value:e,...r},n)=>{let o=ea.useRef(null),i=WO(o,n),a=Yfr(e);return ea.useEffect(()=>{let s=o.current;if(!s)return;let u=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==e&&c){let d=new Event("input",{bubbles:!0});c.call(s,e),s.dispatchEvent(d)}},[a,e]),(0,Tc.jsx)(AV.input,{style:{display:"none"},...r,ref:i,defaultValue:e})});hpr.displayName=A5n;function I5n(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function gpr(t,e,r){let i=100/(r-e)*(t-e);return u9e(i,[0,100])}function M5n(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function R5n(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 N5n(t,e,r){let n=t/2,i=f9e([0,50],[0,n]);return(n-i(e)*r)*r}function j5n(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function D5n(t,e){if(e>0){let r=j5n(t);return Math.min(...r)>=e}return!0}function f9e(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 L5n(t){return(String(t).split(".")[1]||"").length}function F5n(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var p9e=spr,ypr=fpr,bpr=ppr,_pr=mpr;wn();var AY=L$.forwardRef(({className:t,...e},r)=>L$.createElement(p9e,{ref:r,className:me("tw-relative tw-flex tw-w-full tw-touch-none tw-select-none tw-items-center",t),...e},L$.createElement(ypr,{className:"tw-relative tw-h-1.5 tw-w-full tw-grow tw-overflow-hidden tw-rounded-full tw-border tw-border-solid tw-bg-interactive-accent/20 tw-border-interactive-accent/30"},L$.createElement(bpr,{className:"tw-absolute tw-h-full tw-bg-interactive-accent"})),L$.createElement(_pr,{className:"tw-block tw-size-4 tw-rounded-full tw-border tw-bg-toggle-thumb tw-shadow tw-transition-colors focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring disabled:tw-pointer-events-none disabled:tw-opacity-50"})));AY.displayName=p9e.displayName;function IY({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a,suffix:s}){let[u,l]=(0,gN.useState)(t);return(0,gN.useEffect)(()=>{l(t)},[t]),gN.default.createElement("div",{className:me("tw-flex tw-items-center tw-gap-4",a)},gN.default.createElement(AY,{value:[u],onValueChange:([c])=>l(c),onValueCommit:([c])=>e?.(c),min:r,max:n,step:o,disabled:i,className:"tw-flex-1"}),gN.default.createElement("div",{className:"tw-min-w-[40px] tw-text-right tw-text-sm"},u,s))}nr();th();bt();fr();fn();var MV=require("obsidian"),tr=j(X()),vpr=j(Lc());function $5n({initialProject:t,onSave:e,onCancel:r}){let n=_n(),[o,i]=(0,tr.useState)(!1),[a,s]=(0,tr.useState)({name:!1,systemPrompt:!1,projectModelKey:!1,inclusions:!1}),[u,l]=(0,tr.useState)(t||{id:Det(),name:"",description:"",systemPrompt:"",projectModelKey:"",modelConfigs:{temperature:Mf.TEMPERATURE,maxTokens:Mf.MAX_TOKENS},contextSource:{inclusions:"",exclusions:"",webUrls:"",youtubeUrls:""},created:Date.now(),UsageTimestamps:Date.now()}),c=eh(u.contextSource.inclusions||u.contextSource.exclusions||"nothing").reverse().join(","),d=m=>{new G_e(app,async y=>{l(y)},m).open()},f=()=>u.name&&u.projectModelKey,p=(m,g)=>{l(y=>{if(typeof g=="string"&&m==="projectModelKey"&&(g=g.trim()),Array.isArray(g)&&g.every(_=>typeof _=="string")&&(g=g.map(_=>_.trim()).filter(Boolean)),m.includes(".")){let[_,w]=m.split("."),C=y[_];if(typeof C=="object"&&C!==null)return{...y,[_]:{...C,[w]:g}}}return{...y,[m]:g}})},h=async()=>{u.name&&(u.name=u.name.trim());let g=["name","projectModelKey"].filter(y=>!u[y]);if(g.length>0){s(y=>({...y,...Object.fromEntries(g.map(_=>[_,!0]))})),new MV.Notice("Please fill in all required fields");return}try{i(!0),await e(u)}catch(y){new MV.Notice(Xn(y)),s(_=>({..._,name:!0}))}finally{i(!1)}};return tr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-p-4"},tr.default.createElement("div",{className:"tw-mb-2 tw-text-xl tw-font-bold tw-text-normal"},t?"Edit Project":"New Project"),tr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},tr.default.createElement(Jn,{label:"Project Name",required:!0,error:a.name&&!u.name,errorMessage:"Project name is required"},tr.default.createElement(mi,{type:"text",value:u.name,onChange:m=>p("name",m.target.value),onBlur:()=>s(m=>({...m,name:!0})),className:"tw-w-full"})),tr.default.createElement(Jn,{label:"Description",description:"Briefly describe the purpose and goals of the project"},tr.default.createElement(mi,{type:"text",value:u.description,onChange:m=>p("description",m.target.value),className:"tw-w-full"})),tr.default.createElement(Jn,{label:"Project System Prompt",description:"Custom instructions for how the AI should behave in this project context"},tr.default.createElement(W_,{value:u.systemPrompt,onChange:m=>p("systemPrompt",m.target.value),onBlur:()=>s(m=>({...m,systemPrompt:!0})),className:"tw-min-h-32"})),tr.default.createElement(Jn,{label:"Default Model",required:!0,error:a.projectModelKey&&!u.projectModelKey,errorMessage:"Default model is required"},tr.default.createElement(Z_e,{value:u.projectModelKey,onChange:m=>{let g=m.target.value,y=n.activeModels.find(S=>S.enabled&&en(S)===g);if(!y)return;let{hasApiKey:_,errorNotice:w}=QB(y,n);if(!_&&w){new MV.Notice(w);return}p("projectModelKey",g)},onBlur:()=>s(m=>({...m,projectModelKey:!0})),placeholder:"Select a model",options:n.activeModels.filter(m=>m.enabled&&m.projectEnabled).map(m=>({label:BH(m),value:en(m)}))})),tr.default.createElement("div",{className:"tw-space-y-4"},tr.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Model Configuration"),tr.default.createElement("div",{className:"tw-grid tw-grid-cols-1 tw-gap-4"},tr.default.createElement(Jn,{label:"Temperature"},tr.default.createElement(IY,{value:u.modelConfigs?.temperature??Mf.TEMPERATURE,onChange:m=>p("modelConfigs.temperature",m),min:0,max:2,step:.01,className:"tw-w-full"})),tr.default.createElement(Jn,{label:"Token Limit"},tr.default.createElement(IY,{value:u.modelConfigs?.maxTokens??Mf.MAX_TOKENS,onChange:m=>p("modelConfigs.maxTokens",m),min:1,max:65e3,step:1,className:"tw-w-full"})))),tr.default.createElement("div",{className:"tw-space-y-4"},tr.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Context Sources"),tr.default.createElement(Jn,{label:tr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},tr.default.createElement("span",null,"File Context"),tr.default.createElement(No,{delayDuration:0},tr.default.createElement(Ot,null,tr.default.createElement(Et,{asChild:!0},tr.default.createElement(Fi,{className:"tw-size-4 tw-text-muted"})),tr.default.createElement(xt,null,tr.default.createElement("div",{className:"tw-max-w-80"},tr.default.createElement("strong",null,"Supported File Types:"),tr.default.createElement("br",null),tr.default.createElement("strong",null,"\u2022 Documents:")," pdf, doc, docx, ppt, pptx, epub, txt, rtf and many more",tr.default.createElement("br",null),tr.default.createElement("strong",null,"\u2022 Images:")," jpg, png, svg, gif, bmp, webp, tiff",tr.default.createElement("br",null),tr.default.createElement("strong",null,"\u2022 Spreadsheets:")," xlsx, xls, csv, numbers",tr.default.createElement("br",null),tr.default.createElement("br",null),"Non-markdown files are converted to markdown in the background.",tr.default.createElement("br",null),tr.default.createElement("strong",null,"Rate limit:")," 50 files or 100MB per 3 hours, whichever is reached first."))))),description:"Define patterns to include specific files, folders or tags (specified in the note property) in the project context."},tr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},tr.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-row"},tr.default.createElement(vh,{className:"tw-max-w-[100px] tw-text-sm tw-text-accent"},c)),tr.default.createElement(he,{variant:"secondary",onClick:()=>{d(u)}},"Manage Context"))),tr.default.createElement(Jn,{label:"Web URLs"},tr.default.createElement(W_,{value:u.contextSource?.webUrls,onChange:m=>{let y=m.target.value.split(`
`).map(_=>{if(!_.trim())return _;try{return new URL(_.trim()),_}catch{return _}});p("contextSource.webUrls",y.join(`
`))},placeholder:"Enter web URLs, one per line",className:"tw-min-h-20 tw-w-full"})),tr.default.createElement(Jn,{label:"YouTube URLs"},tr.default.createElement(W_,{value:u.contextSource?.youtubeUrls,onChange:m=>{let y=m.target.value.split(`
`).map(_=>{if(!_.trim())return _;try{let w=new URL(_.trim());return w.hostname.includes("youtube.com")||w.hostname.includes("youtu.be"),_}catch{return _}});p("contextSource.youtubeUrls",y.join(`
`))},placeholder:"Enter YouTube URLs, one per line",className:"tw-min-h-20 tw-w-full"})))),tr.default.createElement("div",{className:"tw-mt-4 tw-flex tw-items-center tw-justify-end tw-gap-2"},tr.default.createElement(he,{variant:"ghost",onClick:r,disabled:o},"Cancel"),tr.default.createElement(he,{onClick:h,disabled:o||!f()},o?"Saving...":"Save")))}var MY=class extends MV.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r}=this;this.root=(0,vpr.createRoot)(r);let n=async i=>{await this.onSave(i),this.close()},o=()=>{this.close()};this.root.render(tr.default.createElement($5n,{initialProject:this.initialProject,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};vo();var ta=j(X());var pt=j(X(),1),k9e=j(Ba(),1);function m9e(t,[e,r]){return Math.min(r,Math.max(e,t))}function Vs(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var yN=j(X(),1);var pA=j(X(),1),wpr=j(ut(),1);function xpr(t,e=[]){let r=[];function n(i,a){let s=pA.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...h}=d,m=f?.[t][u]||s,g=pA.useMemo(()=>h,Object.values(h));return(0,wpr.jsx)(m.Provider,{value:g,children:p})}function c(d,f){let p=f?.[t][u]||s,h=pA.useContext(p);if(h)return h;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=>pA.createContext(a));return function(s){let u=s?.[t]||i;return pA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,B5n(o,...e)]}function B5n(...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 pA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var pf=j(X(),1);var RV=j(ut(),1),ove=pf.forwardRef((t,e)=>{let{children:r,...n}=t,o=pf.Children.toArray(r),i=o.find(U5n);if(i){let a=i.props.children,s=o.map(u=>u===i?pf.Children.count(a)>1?pf.Children.only(null):pf.isValidElement(a)?a.props.children:null:u);return(0,RV.jsx)(h9e,{...n,ref:e,children:pf.isValidElement(a)?pf.cloneElement(a,void 0,s):null})}return(0,RV.jsx)(h9e,{...n,ref:e,children:r})});ove.displayName="Slot";var h9e=pf.forwardRef((t,e)=>{let{children:r,...n}=t;if(pf.isValidElement(r)){let o=H5n(r);return pf.cloneElement(r,{...q5n(n,r.props),ref:e?Xk(e,o):o})}return pf.Children.count(r)>1?pf.Children.only(null):null});h9e.displayName="SlotClone";var z5n=({children:t})=>(0,RV.jsx)(RV.Fragment,{children:t});function U5n(t){return pf.isValidElement(t)&&t.type===z5n}function q5n(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 H5n(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 ive=j(ut(),1);function Spr(t){let e=t+"CollectionProvider",[r,n]=xpr(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:h,children:m}=p,g=yN.default.useRef(null),y=yN.default.useRef(new Map).current;return(0,ive.jsx)(o,{scope:h,itemMap:y,collectionRef:g,children:m})};a.displayName=e;let s=t+"CollectionSlot",u=yN.default.forwardRef((p,h)=>{let{scope:m,children:g}=p,y=i(s,m),_=qs(h,y.collectionRef);return(0,ive.jsx)(ove,{ref:_,children:g})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=yN.default.forwardRef((p,h)=>{let{scope:m,children:g,...y}=p,_=yN.default.useRef(null),w=qs(h,_),S=i(l,m);return yN.default.useEffect(()=>(S.itemMap.set(_,{ref:_,...y}),()=>void S.itemMap.delete(_))),(0,ive.jsx)(ove,{[c]:"",ref:w,children:g})});d.displayName=l;function f(p){let h=i(t+"CollectionConsumer",p);return yN.default.useCallback(()=>{let g=h.collectionRef.current;if(!g)return[];let y=Array.from(g.querySelectorAll(`[${c}]`));return Array.from(h.itemMap.values()).sort((S,C)=>y.indexOf(S.ref.current)-y.indexOf(C.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var Es=j(X(),1);var y9e=j(ut(),1),V5n="DismissableLayer",g9e="dismissableLayer.update",W5n="dismissableLayer.pointerDownOutside",K5n="dismissableLayer.focusOutside",Cpr,Epr=Es.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),b9e=Es.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Es.useContext(Epr),[c,d]=Es.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Es.useState({}),h=qs(e,P=>d(P)),m=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),_=c?m.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=y,C=Z5n(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=Y5n(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return q1(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Es.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Cpr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Opr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Cpr)}},[c,f,r,l]),Es.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Opr())},[c,l]),Es.useEffect(()=>{let P=()=>p({});return document.addEventListener(g9e,P),()=>document.removeEventListener(g9e,P)},[]),(0,y9e.jsx)(zi.div,{...u,ref:h,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Vs(t.onFocusCapture,E.onFocusCapture),onBlurCapture:Vs(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Vs(t.onPointerDownCapture,C.onPointerDownCapture)})});b9e.displayName=V5n;var G5n="DismissableLayerBranch",J5n=Es.forwardRef((t,e)=>{let r=Es.useContext(Epr),n=Es.useRef(null),o=qs(e,n);return Es.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,y9e.jsx)(zi.div,{...t,ref:o})});J5n.displayName=G5n;function Z5n(t,e=globalThis?.document){let r=un(t),n=Es.useRef(!1),o=Es.useRef(()=>{});return Es.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Ppr(W5n,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 Y5n(t,e=globalThis?.document){let r=un(t),n=Es.useRef(!1);return Es.useEffect(()=>{let o=i=>{i.target&&!n.current&&Ppr(K5n,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 Opr(){let t=new CustomEvent(g9e);document.dispatchEvent(t)}function Ppr(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?$or(o,i):o.dispatchEvent(i)}var gb=j(X(),1);var Rpr=j(ut(),1),_9e="focusScope.autoFocusOnMount",v9e="focusScope.autoFocusOnUnmount",Tpr={bubbles:!1,cancelable:!0},X5n="FocusScope",w9e=gb.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=gb.useState(null),l=un(o),c=un(i),d=gb.useRef(null),f=qs(e,m=>u(m)),p=gb.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;gb.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:bN(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||bN(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let T of E)T.removedNodes.length>0&&bN(s)};var m=_,g=w,y=S;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(S);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),gb.useEffect(()=>{if(s){Ipr.add(p);let m=document.activeElement;if(!s.contains(m)){let y=new CustomEvent(_9e,Tpr);s.addEventListener(_9e,l),s.dispatchEvent(y),y.defaultPrevented||(Q5n(oWn(Npr(s)),{select:!0}),document.activeElement===m&&bN(s))}return()=>{s.removeEventListener(_9e,l),setTimeout(()=>{let y=new CustomEvent(v9e,Tpr);s.addEventListener(v9e,c),s.dispatchEvent(y),y.defaultPrevented||bN(m??document.body,{select:!0}),s.removeEventListener(v9e,c),Ipr.remove(p)},0)}}},[s,l,c,p]);let h=gb.useCallback(m=>{if(!r&&!n||p.paused)return;let g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){let _=m.currentTarget,[w,S]=eWn(_);w&&S?!m.shiftKey&&y===S?(m.preventDefault(),r&&bN(w,{select:!0})):m.shiftKey&&y===w&&(m.preventDefault(),r&&bN(S,{select:!0})):y===_&&m.preventDefault()}},[r,n,p.paused]);return(0,Rpr.jsx)(zi.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});w9e.displayName=X5n;function Q5n(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(bN(n,{select:e}),document.activeElement!==r)return}function eWn(t){let e=Npr(t),r=Apr(e,t),n=Apr(e.reverse(),t);return[r,n]}function Npr(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 Apr(t,e){for(let r of t)if(!tWn(r,{upTo:e}))return r}function tWn(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 rWn(t){return t instanceof HTMLInputElement&&"select"in t}function bN(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&rWn(t)&&e&&t.select()}}var Ipr=nWn();function nWn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=Mpr(t,e),t.unshift(e)},remove(e){t=Mpr(t,e),t[0]?.resume()}}}function Mpr(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function oWn(t){return t.filter(e=>e.tagName!=="A")}var Eg=j(X(),1);var jpr=j(X(),1);var x9e=j(ut(),1),iWn="Arrow",Dpr=jpr.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,x9e.jsx)(zi.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,x9e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Dpr.displayName=iWn;var Lpr=Dpr;var mA=j(X(),1),Fpr=j(ut(),1);function kpr(t,e=[]){let r=[];function n(i,a){let s=mA.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...h}=d,m=f?.[t][u]||s,g=mA.useMemo(()=>h,Object.values(h));return(0,Fpr.jsx)(m.Provider,{value:g,children:p})}function c(d,f){let p=f?.[t][u]||s,h=mA.useContext(p);if(h)return h;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=>mA.createContext(a));return function(s){let u=s?.[t]||i;return mA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,sWn(o,...e)]}function sWn(...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 mA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var _N=j(ut(),1);var S9e="Popper",[$pr,C9e]=kpr(S9e),[uWn,Bpr]=$pr(S9e),zpr=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Eg.useState(null);return(0,_N.jsx)(uWn,{scope:e,anchor:n,onAnchorChange:o,children:r})};zpr.displayName=S9e;var Upr="PopperAnchor",qpr=Eg.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=Bpr(Upr,r),a=Eg.useRef(null),s=qs(e,a);return Eg.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,_N.jsx)(zi.div,{...o,ref:s})});qpr.displayName=Upr;var O9e="PopperContent",[lWn,cWn]=$pr(O9e),Hpr=Eg.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:h,...m}=t,g=Bpr(O9e,r),[y,_]=Eg.useState(null),w=qs(e,Z=>_(Z)),[S,C]=Eg.useState(null),E=L1(S),P=E?.width??0,T=E?.height??0,I=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},M=Array.isArray(l)?l:[l],D=M.length>0,k={padding:N,boundary:M.filter(fWn),altBoundary:D},{refs:F,floatingStyles:K,placement:U,isPositioned:Y,middlewareData:ee}=W1({strategy:"fixed",placement:I,whileElementsMounted:(...Z)=>oA(...Z,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[K1({mainAxis:o+T,alignmentAxis:a}),u&&G1({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?J1():void 0,...k}),u&&Z1({...k}),Y1({...k,apply:({elements:Z,rects:de,availableWidth:pe,availableHeight:ae})=>{let{width:Te,height:Ae}=de.reference,ke=Z.floating.style;ke.setProperty("--radix-popper-available-width",`${pe}px`),ke.setProperty("--radix-popper-available-height",`${ae}px`),ke.setProperty("--radix-popper-anchor-width",`${Te}px`),ke.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),S&&Q1({element:S,padding:s}),pWn({arrowWidth:P,arrowHeight:T}),f&&X1({strategy:"referenceHidden",...k})]}),[L,Q]=Kpr(U),z=un(h);yo(()=>{Y&&z?.()},[Y,z]);let W=ee.arrow?.x,V=ee.arrow?.y,q=ee.arrow?.centerOffset!==0,[H,G]=Eg.useState();return yo(()=>{y&&G(window.getComputedStyle(y).zIndex)},[y]),(0,_N.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:Y?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[ee.transformOrigin?.x,ee.transformOrigin?.y].join(" "),...ee.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,_N.jsx)(lWn,{scope:r,placedSide:L,onArrowChange:C,arrowX:W,arrowY:V,shouldHideArrow:q,children:(0,_N.jsx)(zi.div,{"data-side":L,"data-align":Q,...m,ref:w,style:{...m.style,animation:Y?void 0:"none"}})})})});Hpr.displayName=O9e;var Vpr="PopperArrow",dWn={top:"bottom",right:"left",bottom:"top",left:"right"},Wpr=Eg.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=cWn(Vpr,n),a=dWn[i.placedSide];return(0,_N.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,_N.jsx)(Lpr,{...o,ref:r,style:{...o.style,display:"block"}})})});Wpr.displayName=Vpr;function fWn(t){return t!==null}var pWn=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]=Kpr(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,h="",m="";return l==="bottom"?(h=a?d:`${f}px`,m=`${-u}px`):l==="top"?(h=a?d:`${f}px`,m=`${n.floating.height+u}px`):l==="right"?(h=`${-u}px`,m=a?d:`${p}px`):l==="left"&&(h=`${n.floating.width+u}px`,m=a?d:`${p}px`),{data:{x:h,y:m}}}});function Kpr(t){let[e,r="center"]=t.split("-");return[e,r]}var Gpr=zpr,Jpr=qpr,Zpr=Hpr,Ypr=Wpr;var ave=j(X(),1),Xpr=j(Ba(),1);var Qpr=j(ut(),1),hWn="Portal",E9e=ave.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=ave.useState(!1);yo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Xpr.default.createPortal((0,Qpr.jsx)(zi.div,{...n,ref:e}),a):null});E9e.displayName=hWn;var mf=j(X(),1);var NV=j(ut(),1),T9e=mf.forwardRef((t,e)=>{let{children:r,...n}=t,o=mf.Children.toArray(r),i=o.find(yWn);if(i){let a=i.props.children,s=o.map(u=>u===i?mf.Children.count(a)>1?mf.Children.only(null):mf.isValidElement(a)?a.props.children:null:u);return(0,NV.jsx)(P9e,{...n,ref:e,children:mf.isValidElement(a)?mf.cloneElement(a,void 0,s):null})}return(0,NV.jsx)(P9e,{...n,ref:e,children:r})});T9e.displayName="Slot";var P9e=mf.forwardRef((t,e)=>{let{children:r,...n}=t;if(mf.isValidElement(r)){let o=_Wn(r);return mf.cloneElement(r,{...bWn(n,r.props),ref:e?Xk(e,o):o})}return mf.Children.count(r)>1?mf.Children.only(null):null});P9e.displayName="SlotClone";var gWn=({children:t})=>(0,NV.jsx)(NV.Fragment,{children:t});function yWn(t){return mf.isValidElement(t)&&t.type===gWn}function bWn(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 _Wn(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 emr=j(X(),1);var tmr=j(ut(),1),vWn="VisuallyHidden",A9e=emr.forwardRef((t,e)=>(0,tmr.jsx)(zi.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}}));A9e.displayName=vWn;var lve=j(X());var cp=j(X());var sve=m$();var I9e=function(){},RY=cp.forwardRef(function(t,e){var r=cp.useRef(null),n=cp.useState({onScrollCapture:I9e,onWheelCapture:I9e,onTouchMoveCapture:I9e}),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,h=t.inert,m=t.allowPinchZoom,g=t.as,y=g===void 0?"div":g,_=t.gapMode,w=oN(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=p$([r,e]),E=Ni(Ni({},w),o);return cp.createElement(cp.Fragment,null,c&&cp.createElement(S,{sideCar:sve,removeScrollBar:l,shards:d,noIsolation:p,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:r,gapMode:_}),a?cp.cloneElement(cp.Children.only(s),Ni(Ni({},E),{ref:C})):cp.createElement(y,Ni({},E,{className:u,ref:C}),s))});RY.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};RY.classNames={fullWidth:X_,zeroRight:Y_};var Da=j(X());var M9e=!1;if(typeof window<"u")try{NY=Object.defineProperty({},"passive",{get:function(){return M9e=!0,!0}}),window.addEventListener("test",NY,NY),window.removeEventListener("test",NY,NY)}catch{M9e=!1}var NY,F$=M9e?{passive:!1}:!1;var wWn=function(t){return t.tagName==="TEXTAREA"},rmr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!wWn(t)&&r[e]==="visible")},xWn=function(t){return rmr(t,"overflowY")},SWn=function(t){return rmr(t,"overflowX")},R9e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=nmr(t,n);if(o){var i=omr(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},CWn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},OWn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},nmr=function(t,e){return t==="v"?xWn(e):SWn(e)},omr=function(t,e){return t==="v"?CWn(e):OWn(e)},EWn=function(t,e){return t==="h"&&e==="rtl"?-1:1},imr=function(t,e,r,n,o){var i=EWn(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=omr(t,s),h=p[0],m=p[1],g=p[2],y=m-g-i*h;(h||y)&&nmr(t,s)&&(d+=y,f+=h),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 uve=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},amr=function(t){return[t.deltaX,t.deltaY]},smr=function(t){return t&&"current"in t?t.current:t},PWn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},TWn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},AWn=0,jV=[];function umr(t){var e=Da.useRef([]),r=Da.useRef([0,0]),n=Da.useRef(),o=Da.useState(AWn++)[0],i=Da.useState(iA)[0],a=Da.useRef(t);Da.useEffect(function(){a.current=t},[t]),Da.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=tV([t.lockRef.current],(t.shards||[]).map(smr),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Da.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var y=uve(m),_=r.current,w="deltaX"in m?m.deltaX:_[0]-y[0],S="deltaY"in m?m.deltaY:_[1]-y[1],C,E=m.target,P=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&P==="h"&&E.type==="range")return!1;var T=R9e(P,E);if(!T)return!0;if(T?C=P:(C=P==="v"?"h":"v",T=R9e(P,E)),!T)return!1;if(!n.current&&"changedTouches"in m&&(w||S)&&(n.current=C),!C)return!0;var I=n.current||C;return imr(I,g,m,I==="h"?w:S,!0)},[]),u=Da.useCallback(function(m){var g=m;if(!(!jV.length||jV[jV.length-1]!==i)){var y="deltaY"in g?amr(g):uve(g),_=e.current.filter(function(C){return C.name===g.type&&(C.target===g.target||g.target===C.shadowParent)&&PWn(C.delta,y)})[0];if(_&&_.should){g.cancelable&&g.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(smr).filter(Boolean).filter(function(C){return C.contains(g.target)}),S=w.length>0?s(g,w[0]):!a.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),l=Da.useCallback(function(m,g,y,_){var w={name:m,delta:g,target:y,should:_,shadowParent:IWn(y)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),c=Da.useCallback(function(m){r.current=uve(m),n.current=void 0},[]),d=Da.useCallback(function(m){l(m.type,amr(m),m.target,s(m,t.lockRef.current))},[]),f=Da.useCallback(function(m){l(m.type,uve(m),m.target,s(m,t.lockRef.current))},[]);Da.useEffect(function(){return jV.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,F$),document.addEventListener("touchmove",u,F$),document.addEventListener("touchstart",c,F$),function(){jV=jV.filter(function(m){return m!==i}),document.removeEventListener("wheel",u,F$),document.removeEventListener("touchmove",u,F$),document.removeEventListener("touchstart",c,F$)}},[]);var p=t.removeScrollBar,h=t.inert;return Da.createElement(Da.Fragment,null,h?Da.createElement(i,{styles:TWn(o)}):null,p?Da.createElement(g$,{gapMode:t.gapMode}):null)}function IWn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var lmr=h$(sve,umr);var cmr=lve.forwardRef(function(t,e){return lve.createElement(RY,Ni({},t,{ref:e,sideCar:lmr}))});cmr.classNames=RY.classNames;var jY=cmr;var vr=j(ut(),1),MWn=[" ","Enter","ArrowUp","ArrowDown"],RWn=[" ","Enter"],LY="Select",[dve,fve,NWn]=Spr(LY),[DV,e7i]=Xa(LY,[NWn,C9e]),pve=C9e(),[jWn,vN]=DV(LY),[DWn,LWn]=DV(LY),dmr=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:h}=t,m=pve(e),[g,y]=pt.useState(null),[_,w]=pt.useState(null),[S,C]=pt.useState(!1),E=GH(l),[P=!1,T]=Qp({prop:n,defaultProp:o,onChange:i}),[I,N]=Qp({prop:a,defaultProp:s,onChange:u}),M=pt.useRef(null),D=g?h||!!g.closest("form"):!0,[k,F]=pt.useState(new Set),K=Array.from(k).map(U=>U.props.value).join(";");return(0,vr.jsx)(Gpr,{...m,children:(0,vr.jsxs)(jWn,{required:p,scope:e,trigger:g,onTriggerChange:y,valueNode:_,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Wl(),value:I,onValueChange:N,open:P,onOpenChange:T,dir:E,triggerPointerDownPosRef:M,disabled:f,children:[(0,vr.jsx)(dve.Provider,{scope:e,children:(0,vr.jsx)(DWn,{scope:t.__scopeSelect,onNativeOptionAdd:pt.useCallback(U=>{F(Y=>new Set(Y).add(U))},[]),onNativeOptionRemove:pt.useCallback(U=>{F(Y=>{let ee=new Set(Y);return ee.delete(U),ee})},[]),children:r})}),D?(0,vr.jsxs)(Lmr,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:I,onChange:U=>N(U.target.value),disabled:f,form:h,children:[I===void 0?(0,vr.jsx)("option",{value:""}):null,Array.from(k)]},K):null]})})};dmr.displayName=LY;var fmr="SelectTrigger",pmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=pve(r),a=vN(fmr,r),s=a.disabled||n,u=qs(e,a.onTriggerChange),l=fve(r),c=pt.useRef("touch"),[d,f,p]=Fmr(m=>{let g=l().filter(w=>!w.disabled),y=g.find(w=>w.value===a.value),_=kmr(g,m,y);_!==void 0&&a.onValueChange(_.value)}),h=m=>{s||(a.onOpenChange(!0),p()),m&&(a.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return(0,vr.jsx)(Jpr,{asChild:!0,...i,children:(0,vr.jsx)(zi.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":Dmr(a.value)?"":void 0,...o,ref:u,onClick:Vs(o.onClick,m=>{m.currentTarget.focus(),c.current!=="mouse"&&h(m)}),onPointerDown:Vs(o.onPointerDown,m=>{c.current=m.pointerType;let g=m.target;g.hasPointerCapture(m.pointerId)&&g.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(h(m),m.preventDefault())}),onKeyDown:Vs(o.onKeyDown,m=>{let g=d.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&f(m.key),!(g&&m.key===" ")&&MWn.includes(m.key)&&(h(),m.preventDefault())})})})});pmr.displayName=fmr;var mmr="SelectValue",hmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=vN(mmr,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=qs(e,u.onValueNodeChange);return yo(()=>{l(c)},[l,c]),(0,vr.jsx)(zi.span,{...s,ref:d,style:{pointerEvents:"none"},children:Dmr(u.value)?(0,vr.jsx)(vr.Fragment,{children:a}):i})});hmr.displayName=mmr;var FWn="SelectIcon",gmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,vr.jsx)(zi.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});gmr.displayName=FWn;var kWn="SelectPortal",ymr=t=>(0,vr.jsx)(E9e,{asChild:!0,...t});ymr.displayName=kWn;var k$="SelectContent",bmr=pt.forwardRef((t,e)=>{let r=vN(k$,t.__scopeSelect),[n,o]=pt.useState();if(yo(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?k9e.createPortal((0,vr.jsx)(_mr,{scope:t.__scopeSelect,children:(0,vr.jsx)(dve.Slot,{scope:t.__scopeSelect,children:(0,vr.jsx)("div",{children:t.children})})}),i):null}return(0,vr.jsx)(vmr,{...t,ref:e})});bmr.displayName=k$;var sv=10,[_mr,wN]=DV(k$),$Wn="SelectContentImpl",vmr=pt.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:h,hideWhenDetached:m,avoidCollisions:g,...y}=t,_=vN(k$,r),[w,S]=pt.useState(null),[C,E]=pt.useState(null),P=qs(e,Z=>S(Z)),[T,I]=pt.useState(null),[N,M]=pt.useState(null),D=fve(r),[k,F]=pt.useState(!1),K=pt.useRef(!1);pt.useEffect(()=>{if(w)return nN(w)},[w]),H1();let U=pt.useCallback(Z=>{let[de,...pe]=D().map(Ae=>Ae.ref.current),[ae]=pe.slice(-1),Te=document.activeElement;for(let Ae of Z)if(Ae===Te||(Ae?.scrollIntoView({block:"nearest"}),Ae===de&&C&&(C.scrollTop=0),Ae===ae&&C&&(C.scrollTop=C.scrollHeight),Ae?.focus(),document.activeElement!==Te))return},[D,C]),Y=pt.useCallback(()=>U([T,w]),[U,T,w]);pt.useEffect(()=>{k&&Y()},[k,Y]);let{onOpenChange:ee,triggerPointerDownPosRef:L}=_;pt.useEffect(()=>{if(w){let Z={x:0,y:0},de=ae=>{Z={x:Math.abs(Math.round(ae.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(ae.pageY)-(L.current?.y??0))}},pe=ae=>{Z.x<=10&&Z.y<=10?ae.preventDefault():w.contains(ae.target)||ee(!1),document.removeEventListener("pointermove",de),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",pe,{capture:!0})}}},[w,ee,L]),pt.useEffect(()=>{let Z=()=>ee(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[ee]);let[Q,z]=Fmr(Z=>{let de=D().filter(Te=>!Te.disabled),pe=de.find(Te=>Te.ref.current===document.activeElement),ae=kmr(de,Z,pe);ae&&setTimeout(()=>ae.ref.current.focus())}),W=pt.useCallback((Z,de,pe)=>{let ae=!K.current&&!pe;(_.value!==void 0&&_.value===de||ae)&&(I(Z),ae&&(K.current=!0))},[_.value]),V=pt.useCallback(()=>w?.focus(),[w]),q=pt.useCallback((Z,de,pe)=>{let ae=!K.current&&!pe;(_.value!==void 0&&_.value===de||ae)&&M(Z)},[_.value]),H=n==="popper"?N9e:wmr,G=H===N9e?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:m,avoidCollisions:g}:{};return(0,vr.jsx)(_mr,{scope:r,content:w,viewport:C,onViewportChange:E,itemRefCallback:W,selectedItem:T,onItemLeave:V,itemTextRefCallback:q,focusSelectedItem:Y,selectedItemText:N,position:n,isPositioned:k,searchRef:Q,children:(0,vr.jsx)(jY,{as:T9e,allowPinchZoom:!0,children:(0,vr.jsx)(w9e,{asChild:!0,trapped:_.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:Vs(o,Z=>{_.trigger?.focus({preventScroll:!0}),Z.preventDefault()}),children:(0,vr.jsx)(b9e,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:(0,vr.jsx)(H,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:Z=>Z.preventDefault(),...y,...G,onPlaced:()=>F(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Vs(y.onKeyDown,Z=>{let de=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!de&&Z.key.length===1&&z(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let ae=D().filter(Te=>!Te.disabled).map(Te=>Te.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){let Te=Z.target,Ae=ae.indexOf(Te);ae=ae.slice(Ae+1)}setTimeout(()=>U(ae)),Z.preventDefault()}})})})})})})});vmr.displayName=$Wn;var BWn="SelectItemAlignedPosition",wmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=vN(k$,r),a=wN(k$,r),[s,u]=pt.useState(null),[l,c]=pt.useState(null),d=qs(e,P=>c(P)),f=fve(r),p=pt.useRef(!1),h=pt.useRef(!0),{viewport:m,selectedItem:g,selectedItemText:y,focusSelectedItem:_}=a,w=pt.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&m&&g&&y){let P=i.trigger.getBoundingClientRect(),T=l.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),N=y.getBoundingClientRect();if(i.dir!=="rtl"){let Te=N.left-T.left,Ae=I.left-Te,ke=P.left-Ae,St=P.width+ke,Nr=Math.max(St,T.width),Ir=window.innerWidth-sv,Hn=m9e(Ae,[sv,Math.max(sv,Ir-Nr)]);s.style.minWidth=St+"px",s.style.left=Hn+"px"}else{let Te=T.right-N.right,Ae=window.innerWidth-I.right-Te,ke=window.innerWidth-P.right-Ae,St=P.width+ke,Nr=Math.max(St,T.width),Ir=window.innerWidth-sv,Hn=m9e(Ae,[sv,Math.max(sv,Ir-Nr)]);s.style.minWidth=St+"px",s.style.right=Hn+"px"}let M=f(),D=window.innerHeight-sv*2,k=m.scrollHeight,F=window.getComputedStyle(l),K=parseInt(F.borderTopWidth,10),U=parseInt(F.paddingTop,10),Y=parseInt(F.borderBottomWidth,10),ee=parseInt(F.paddingBottom,10),L=K+U+k+ee+Y,Q=Math.min(g.offsetHeight*5,L),z=window.getComputedStyle(m),W=parseInt(z.paddingTop,10),V=parseInt(z.paddingBottom,10),q=P.top+P.height/2-sv,H=D-q,G=g.offsetHeight/2,Z=g.offsetTop+G,de=K+U+Z,pe=L-de;if(de<=q){let Te=M.length>0&&g===M[M.length-1].ref.current;s.style.bottom="0px";let Ae=l.clientHeight-m.offsetTop-m.offsetHeight,ke=Math.max(H,G+(Te?V:0)+Ae+Y),St=de+ke;s.style.height=St+"px"}else{let Te=M.length>0&&g===M[0].ref.current;s.style.top="0px";let ke=Math.max(q,K+m.offsetTop+(Te?W:0)+G)+pe;s.style.height=ke+"px",m.scrollTop=de-q+m.offsetTop}s.style.margin=`${sv}px 0`,s.style.minHeight=Q+"px",s.style.maxHeight=D+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,m,g,y,i.dir,n]);yo(()=>w(),[w]);let[S,C]=pt.useState();yo(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]);let E=pt.useCallback(P=>{P&&h.current===!0&&(w(),_?.(),h.current=!1)},[w,_]);return(0,vr.jsx)(UWn,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:E,children:(0,vr.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:(0,vr.jsx)(zi.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});wmr.displayName=BWn;var zWn="SelectPopperPosition",N9e=pt.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=sv,...i}=t,a=pve(r);return(0,vr.jsx)(Zpr,{...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)"}})});N9e.displayName=zWn;var[UWn,$9e]=DV(k$,{}),j9e="SelectViewport",xmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=wN(j9e,r),a=$9e(j9e,r),s=qs(e,i.onViewportChange),u=pt.useRef(0);return(0,vr.jsxs)(vr.Fragment,{children:[(0,vr.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,vr.jsx)(dve.Slot,{scope:r,children:(0,vr.jsx)(zi.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Vs(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 h=window.innerHeight-sv*2,m=parseFloat(d.style.minHeight),g=parseFloat(d.style.height),y=Math.max(m,g);if(y<h){let _=y+p,w=Math.min(h,_),S=_-w;d.style.height=w+"px",d.style.bottom==="0px"&&(c.scrollTop=S>0?S:0,d.style.justifyContent="flex-end")}}}u.current=c.scrollTop})})})]})});xmr.displayName=j9e;var Smr="SelectGroup",[qWn,HWn]=DV(Smr),VWn=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=Wl();return(0,vr.jsx)(qWn,{scope:r,id:o,children:(0,vr.jsx)(zi.div,{role:"group","aria-labelledby":o,...n,ref:e})})});VWn.displayName=Smr;var Cmr="SelectLabel",Omr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=HWn(Cmr,r);return(0,vr.jsx)(zi.div,{id:o.id,...n,ref:e})});Omr.displayName=Cmr;var cve="SelectItem",[WWn,Emr]=DV(cve),Pmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=vN(cve,r),u=wN(cve,r),l=s.value===n,[c,d]=pt.useState(i??""),[f,p]=pt.useState(!1),h=qs(e,_=>u.itemRefCallback?.(_,n,o)),m=Wl(),g=pt.useRef("touch"),y=()=>{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,vr.jsx)(WWn,{scope:r,value:n,disabled:o,textId:m,isSelected:l,onItemTextChange:pt.useCallback(_=>{d(w=>w||(_?.textContent??"").trim())},[]),children:(0,vr.jsx)(dve.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,vr.jsx)(zi.div,{role:"option","aria-labelledby":m,"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:h,onFocus:Vs(a.onFocus,()=>p(!0)),onBlur:Vs(a.onBlur,()=>p(!1)),onClick:Vs(a.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:Vs(a.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:Vs(a.onPointerDown,_=>{g.current=_.pointerType}),onPointerMove:Vs(a.onPointerMove,_=>{g.current=_.pointerType,o?u.onItemLeave?.():g.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Vs(a.onPointerLeave,_=>{_.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Vs(a.onKeyDown,_=>{u.searchRef?.current!==""&&_.key===" "||(RWn.includes(_.key)&&y(),_.key===" "&&_.preventDefault())})})})})});Pmr.displayName=cve;var DY="SelectItemText",Tmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=vN(DY,r),s=wN(DY,r),u=Emr(DY,r),l=LWn(DY,r),[c,d]=pt.useState(null),f=qs(e,y=>d(y),u.onItemTextChange,y=>s.itemTextRefCallback?.(y,u.value,u.disabled)),p=c?.textContent,h=pt.useMemo(()=>(0,vr.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:g}=l;return yo(()=>(m(h),()=>g(h)),[m,g,h]),(0,vr.jsxs)(vr.Fragment,{children:[(0,vr.jsx)(zi.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?k9e.createPortal(i.children,a.valueNode):null]})});Tmr.displayName=DY;var Amr="SelectItemIndicator",Imr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return Emr(Amr,r).isSelected?(0,vr.jsx)(zi.span,{"aria-hidden":!0,...n,ref:e}):null});Imr.displayName=Amr;var D9e="SelectScrollUpButton",Mmr=pt.forwardRef((t,e)=>{let r=wN(D9e,t.__scopeSelect),n=$9e(D9e,t.__scopeSelect),[o,i]=pt.useState(!1),a=qs(e,n.onScrollButtonChange);return yo(()=>{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,vr.jsx)(Nmr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});Mmr.displayName=D9e;var L9e="SelectScrollDownButton",Rmr=pt.forwardRef((t,e)=>{let r=wN(L9e,t.__scopeSelect),n=$9e(L9e,t.__scopeSelect),[o,i]=pt.useState(!1),a=qs(e,n.onScrollButtonChange);return yo(()=>{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,vr.jsx)(Nmr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});Rmr.displayName=L9e;var Nmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=wN("SelectScrollButton",r),a=pt.useRef(null),s=fve(r),u=pt.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return pt.useEffect(()=>()=>u(),[u]),yo(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,vr.jsx)(zi.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:Vs(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:Vs(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:Vs(o.onPointerLeave,()=>{u()})})}),KWn="SelectSeparator",jmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,vr.jsx)(zi.div,{"aria-hidden":!0,...n,ref:e})});jmr.displayName=KWn;var F9e="SelectArrow",GWn=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=pve(r),i=vN(F9e,r),a=wN(F9e,r);return i.open&&a.position==="popper"?(0,vr.jsx)(Ypr,{...o,...n,ref:e}):null});GWn.displayName=F9e;function Dmr(t){return t===""||t===void 0}var Lmr=pt.forwardRef((t,e)=>{let{value:r,...n}=t,o=pt.useRef(null),i=qs(e,o),a=pbe(r);return pt.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,vr.jsx)(A9e,{asChild:!0,children:(0,vr.jsx)("select",{...n,ref:i,defaultValue:r})})});Lmr.displayName="BubbleSelect";function Fmr(t){let e=un(t),r=pt.useRef(""),n=pt.useRef(0),o=pt.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=pt.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return pt.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function kmr(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=JWn(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 JWn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var $mr=dmr,B9e=pmr,Bmr=hmr,zmr=gmr,Umr=ymr,z9e=bmr,qmr=xmr;var U9e=Omr,q9e=Pmr,Hmr=Tmr,Vmr=Imr,H9e=Mmr,V9e=Rmr,W9e=jmr;fn();wn();var xN=$mr;var SN=Bmr,hA=ta.forwardRef(({className:t,children:e,...r},n)=>ta.createElement(B9e,{ref:n,className:me("tw-border-solid !tw-bg-dropdown !tw-shadow-sm tw-transition-colors","focus-visible:tw-shadow-sm focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring","hover:data-[state=closed]:!tw-bg-interactive-accent hover:data-[state=closed]:!tw-text-on-accent","tw-flex tw-h-9 tw-w-full tw-items-center tw-justify-between tw-whitespace-nowrap tw-rounded-md tw-border tw-border-border tw-px-3 tw-py-1 tw-text-sm tw-ring-offset-ring placeholder:tw-text-muted focus:tw-outline-none focus:tw-ring-1 focus:tw-ring-ring disabled:tw-cursor-not-allowed disabled:tw-opacity-50 [&>span]:tw-line-clamp-1",t),...r},e,ta.createElement(zmr,{asChild:!0},ta.createElement(Li,{className:"tw-size-4"}))));hA.displayName=B9e.displayName;var Wmr=ta.forwardRef(({className:t,...e},r)=>ta.createElement(H9e,{ref:r,className:me("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},ta.createElement(zb,{className:"tw-size-4"})));Wmr.displayName=H9e.displayName;var Kmr=ta.forwardRef(({className:t,...e},r)=>ta.createElement(V9e,{ref:r,className:me("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},ta.createElement(Li,{className:"tw-size-4"})));Kmr.displayName=V9e.displayName;var gA=ta.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>ta.createElement(Umr,{container:n},ta.createElement(z9e,{ref:i,className:me("tw-relative tw-z-modal tw-max-h-96 tw-min-w-32 tw-overflow-hidden tw-rounded-md tw-border tw-bg-primary tw-text-normal tw-shadow-md data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:tw-translate-y-1 data-[side=left]:-tw-translate-x-1 data-[side=right]:tw-translate-x-1 data-[side=top]:-tw-translate-y-1",t),position:r,...o},ta.createElement(Wmr,null),ta.createElement(qmr,{className:me("tw-p-1",r==="popper"&&"tw-h-[var(--radix-select-trigger-height)] tw-w-full tw-min-w-[var(--radix-select-trigger-width)]")},e),ta.createElement(Kmr,null))));gA.displayName=z9e.displayName;var YWn=ta.forwardRef(({className:t,...e},r)=>ta.createElement(U9e,{ref:r,className:me("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",t),...e}));YWn.displayName=U9e.displayName;var yA=ta.forwardRef(({className:t,children:e,...r},n)=>ta.createElement(q9e,{ref:n,className:me("tw-relative tw-flex tw-w-full tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-py-1.5 tw-pl-2 tw-pr-8 tw-text-sm tw-outline-none focus:tw-bg-interactive-accent focus:tw-text-on-accent data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t),...r},ta.createElement("span",{className:"tw-absolute tw-right-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},ta.createElement(Vmr,null,ta.createElement(Fc,{className:"tw-size-4"}))),ta.createElement(Hmr,null,e)));yA.displayName=q9e.displayName;var XWn=ta.forwardRef(({className:t,...e},r)=>ta.createElement(W9e,{ref:r,className:me("-tw-mx-1 tw-my-1 tw-h-px tw-bg-primary-alt",t),...e}));XWn.displayName=W9e.displayName;wn();Kt();bt();fn();var Jmr=require("obsidian"),$e=j(X());function QWn(t,e,r={}){let{caseSensitive:n=!1,searchInName:o=!0,searchInDescription:i=!0}=r;if(!e.trim())return!0;let a=n?e:e.toLowerCase();return!!(o&&(n?t.name:t.name.toLowerCase()).includes(a)||i&&t.description&&(n?t.description:t.description.toLowerCase()).includes(a))}function Gmr(t,e,r={}){return!t||t.length===0?[]:e.trim()?t.filter(n=>QWn(n,e,r)):t}function e9n({project:t,loadContext:e,onEdit:r,onDelete:n}){return $e.default.createElement("div",{className:"tw-group tw-flex tw-cursor-pointer tw-items-center tw-justify-between tw-gap-2 tw-rounded-lg tw-border tw-border-solid tw-border-border tw-p-3 tw-transition-all tw-duration-200 tw-bg-secondary/40 hover:tw-border-interactive-accent hover:tw-text-accent hover:tw-shadow-[0_2px_12px_rgba(0,0,0,0.1)] active:tw-scale-[0.98]",onClick:()=>e(t)},$e.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2 tw-overflow-hidden"},$e.default.createElement("div",{className:"tw-text-accent"},$e.default.createElement(ny,{className:"tw-size-4"})),$e.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-col tw-gap-1.5 tw-overflow-hidden"},$e.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[13px] tw-font-medium tw-text-normal"},t.name),t.description&&$e.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[12px] tw-text-muted/80"},t.description))),$e.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-1 tw-opacity-100 tw-transition-opacity tw-duration-200"},$e.default.createElement(Ot,null,$e.default.createElement(Et,{asChild:!0},$e.default.createElement(he,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),r(t)}},$e.default.createElement(qb,{className:"tw-size-4"}))),$e.default.createElement(xt,{side:"bottom"},"Edit Project")),$e.default.createElement(Ot,null,$e.default.createElement(Et,{asChild:!0},$e.default.createElement(he,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),e(t)}},$e.default.createElement(qz,{className:"tw-size-4"}))),$e.default.createElement(xt,{side:"bottom"},"Start Chat")),$e.default.createElement(Ot,null,$e.default.createElement(Et,{asChild:!0},$e.default.createElement(he,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),new Ec(app,()=>n(t),`Are you sure you want to delete project "${t.name}"?`,"Delete Project").open()}},$e.default.createElement(zh,{className:"tw-size-4"}))),$e.default.createElement(xt,{side:"bottom"},"Delete Project"))))}var K9e=(0,$e.memo)(({className:t,projects:e,defaultOpen:r=!1,app:n,onProjectAdded:o,onEditProject:i,hasMessages:a=!1,showChatUI:s,onClose:u,inputRef:l,onProjectClose:c})=>{let[d,f]=(0,$e.useState)(r),[p,h]=(0,$e.useState)(!1),[m,g]=(0,$e.useState)(null),[y,_]=(0,$e.useState)("");(0,$e.useEffect)(()=>{a&&f(!1)},[a]);let w=(0,$e.useMemo)(()=>Gmr(e,y),[e,y]),S=()=>{new MY(n,async N=>{o(N)}).open()},C=I=>{new MY(n,async M=>{i(I,M),m&&m.name===I.name&&g(M)},I).open()},E=I=>{let M=(e||[]).filter(D=>D.name!==I.name);m?.name===I.name&&P(!1),ot("projectList",M),new Jmr.Notice(`Project "${I.name}" deleted successfully`)},P=(I,N)=>{if(I){if(!N){ie("Must be exist one project.");return}g(N),h(!0),f(!1)}else{g(null),h(!1),f(!0),s(!1),Mj(null);return}},T=I=>{g(I),h(!0),f(!1),s(!0),Mj(I),setTimeout(()=>{l.current&&l.current.focus()},0)};return $e.default.createElement("div",{className:me("tw-flex tw-flex-col",t)},$e.default.createElement("div",{className:"tw-overflow-y-auto"},$e.default.createElement("div",{className:"tw-flex tw-flex-col"},p&&m?$e.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-2 tw-py-3"},$e.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),$e.default.createElement(xN,{value:m.name,onValueChange:I=>{let N=e.find(M=>M.name===I);N&&T(N)}},$e.default.createElement(hA,{className:"tw-w-[200px]"},$e.default.createElement(SN,null,$e.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement(ny,{className:"tw-size-4 tw-text-accent/70"}),$e.default.createElement("span",null,m.name)))),$e.default.createElement(gA,null,e.map(I=>$e.default.createElement(yA,{key:I.name,value:I.name,className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement(ny,{className:"tw-size-4"}),I.name)))))),$e.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement(he,{variant:"secondary",onClick:()=>C(m),className:"hover:tw-text-on-accent hover:tw-bg-accent/50"},$e.default.createElement(qb,{className:"tw-mr-1 tw-size-4"}),"Edit"),$e.default.createElement(Ot,null,$e.default.createElement(Et,{asChild:!0},$e.default.createElement(he,{variant:"ghost2",size:"icon",onClick:()=>{P(!1),c()},"aria-label":"Close Current Project"},$e.default.createElement(bi,{className:"tw-size-4"}))),$e.default.createElement(xt,{side:"bottom"},"Close Current Project")))):$e.default.createElement(nv,{open:d,onOpenChange:f,className:"tw-transition-all tw-duration-200 tw-ease-in-out"},$e.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-4 tw-py-3"},$e.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},$e.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),$e.default.createElement(Ot,null,$e.default.createElement(Et,{asChild:!0},$e.default.createElement(zv,{className:"tw-size-4 tw-text-muted"})),$e.default.createElement(xt,{side:"bottom",className:"tw-w-64"},"Manage your projects with different contexts and configurations."))),$e.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement(he,{className:"tw-px-2",variant:"secondary",onClick:S},"Create",$e.default.createElement(Bh,{className:"tw-size-3"})),e.length>0&&$e.default.createElement(sA,{asChild:!0},$e.default.createElement(he,{variant:"ghost2",size:"icon"},d?$e.default.createElement(zb,{className:"tw-size-5"}):$e.default.createElement(Li,{className:"tw-size-5"}))),$e.default.createElement(Ot,null,$e.default.createElement(Et,{asChild:!0},$e.default.createElement(he,{variant:"ghost2",size:"icon",onClick:()=>u(),"aria-label":"close project mode"},$e.default.createElement(bi,{className:"tw-size-4"}))),$e.default.createElement(xt,{side:"bottom"},"Close Project Mode")))),e.length===0&&$e.default.createElement("div",{className:"tw-px-4 tw-py-2 tw-text-xs tw-text-muted tw-bg-secondary/30"},"No projects available"),$e.default.createElement(ov,{className:"tw-transition-all tw-duration-200 tw-ease-in-out"},$e.default.createElement("div",{className:"tw-relative tw-bg-secondary/30"},e.length>0&&$e.default.createElement("div",{className:"tw-px-4 tw-pb-2 tw-pt-3"},$e.default.createElement("div",{className:"tw-relative"},$e.default.createElement(K_e,{value:y,onChange:_,placeholder:"Search projects..."}))),$e.default.createElement("div",{className:"tw-max-h-[calc(3*5.7rem)] tw-overflow-y-auto tw-px-4 tw-pb-6 tw-pt-3"},$e.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 @2xl:tw-grid @2xl:tw-grid-cols-2 @4xl:tw-grid-cols-3"},w.map(I=>$e.default.createElement(e9n,{key:I.name,project:I,loadContext:T,onEdit:C,onDelete:E}))),y.trim()&&w.length===0&&$e.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-py-8 tw-text-muted"},$e.default.createElement(Qj,{className:"tw-mb-3 tw-size-12 tw-text-muted/50"}),$e.default.createElement("p",{className:"tw-text-base tw-font-medium"},"No matching projects found"),$e.default.createElement("p",{className:"tw-mt-1 tw-text-sm"},"Try searching with different keywords"))),e.length>0&&$e.default.createElement("div",{className:"tw-pointer-events-none tw-absolute tw-inset-x-0 tw-bottom-0 tw-h-8 tw-bg-[linear-gradient(to_top,var(--background-primary)_0%,var(--background-primary)_30%,transparent_100%)]"}))))),!p&&$e.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-4 tw-p-8 tw-text-muted tw-bg-secondary/30"},$e.default.createElement("div",{className:"tw-max-w-[600px] tw-space-y-4"},$e.default.createElement("p",{className:"tw-text-center tw-text-base"},"Create your project-based AI assistants with custom instructions, context, and model configurations."),$e.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 tw-text-sm"},$e.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement(qz,{className:"tw-size-4"}),$e.default.createElement("span",null,"Click a project card to start chatting")))))))});K9e.displayName="ProjectList";var zr=j(X()),eKe=j(X());var FY=j(X());var J9e=j(X(),1);var bA=j(X(),1),Zmr=j(ut(),1);function Ymr(t,e=[]){let r=[];function n(i,a){let s=bA.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...h}=d,m=f?.[t]?.[u]||s,g=bA.useMemo(()=>h,Object.values(h));return(0,Zmr.jsx)(m.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,h=bA.useContext(p);if(h)return h;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=>bA.createContext(a));return function(s){let u=s?.[t]||i;return bA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,t9n(o,...e)]}function t9n(...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 bA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Xmr=j(X(),1),r9n=j(Ba(),1);kv();var Qmr=j(ut(),1),n9n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],G9e=n9n.reduce((t,e)=>{let r=Ff(`Primitive.${e}`),n=Xmr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Qmr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var mve=j(ut(),1),Z9e="Progress",Y9e=100,[o9n,P7i]=Ymr(Z9e),[i9n,a9n]=o9n(Z9e),rhr=J9e.forwardRef((t,e)=>{let{__scopeProgress:r,value:n=null,max:o,getValueLabel:i=s9n,...a}=t;(o||o===0)&&!ehr(o)&&console.error(u9n(`${o}`,"Progress"));let s=ehr(o)?o:Y9e;n!==null&&!thr(n,s)&&console.error(l9n(`${n}`,"Progress"));let u=thr(n,s)?n:null,l=hve(u)?i(u,s):void 0;return(0,mve.jsx)(i9n,{scope:r,value:u,max:s,children:(0,mve.jsx)(G9e.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":hve(u)?u:void 0,"aria-valuetext":l,role:"progressbar","data-state":ihr(u,s),"data-value":u??void 0,"data-max":s,...a,ref:e})})});rhr.displayName=Z9e;var nhr="ProgressIndicator",ohr=J9e.forwardRef((t,e)=>{let{__scopeProgress:r,...n}=t,o=a9n(nhr,r);return(0,mve.jsx)(G9e.div,{"data-state":ihr(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...n,ref:e})});ohr.displayName=nhr;function s9n(t,e){return`${Math.round(t/e*100)}%`}function ihr(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function hve(t){return typeof t=="number"}function ehr(t){return hve(t)&&!isNaN(t)&&t>0}function thr(t,e){return hve(t)&&!isNaN(t)&&t<=e&&t>=0}function u9n(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Y9e}\`.`}function l9n(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
- a positive number
- less than the value passed to \`max\` (or ${Y9e} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`}var X9e=rhr,ahr=ohr;wn();var Q9e=FY.forwardRef(({className:t,value:e,...r},n)=>FY.createElement(X9e,{ref:n,className:me("tw-relative tw-h-2 tw-w-full tw-overflow-hidden tw-rounded-full tw-bg-interactive-accent/20 tw-border-interactive-accent/30",t),...r},FY.createElement(ahr,{className:"tw-size-full tw-flex-1 tw-bg-interactive-accent tw-transition-all",style:{transform:`translateX(-${100-Math.min(Math.max(e||0,0),100)}%)`}})));Q9e.displayName=X9e.displayName;fn();sa();vo();Kt();function tKe({plugin:t,setHiddenCard:e}){let[r]=Dee(),n=r.total,o=r.success,i=r.failed,a=r.processingFiles,[s,u]=(0,eKe.useState)(!1),[l,c]=(0,eKe.useState)(!1),d=o.length+i.length,f=n.length>0?Math.round(d/n.length*100):0,p=m=>m.path,h=async m=>{if(!t?.projectManager){ie("ProjectManager not available");return}try{await t.projectManager.retryFailedItem(m)}catch(g){ie(`Error retrying failed item: ${g}`)}};return zr.createElement(T$,{className:"tw-w-full tw-border tw-border-solid tw-border-border tw-bg-transparent tw-shadow-none"},zr.createElement(A$,null,zr.createElement(wY,{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},zr.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},zr.createElement(Dm,{className:"tw-size-5"}),"Context Loading"),zr.createElement(he,{size:"sm",variant:"ghost2",className:"tw-size-6 tw-p-0 tw-text-muted",title:"Close Progress Bar",onClick:()=>e(!0)},zr.createElement(bi,{className:"tw-size-4"})))),zr.createElement(I$,{className:"tw-space-y-6"},zr.createElement("div",{className:"tw-space-y-2"},zr.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-text-sm"},zr.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},zr.createElement("span",{className:"tw-text-muted"},"Total progress"),zr.createElement("span",{className:"tw-text-xs tw-text-muted"},"(Success:"," ",zr.createElement("span",{className:"tw-font-medium tw-text-success"},o.length),", Failed: ",zr.createElement("span",{className:"tw-font-medium tw-text-error"},i.length),")")),zr.createElement("span",{className:"tw-font-medium"},d,"/",n.length," (",f,"%)")),zr.createElement(Q9e,{value:f,className:"tw-h-2"})),a.length>0&&zr.createElement("div",{className:"tw-space-y-3"},zr.createElement("div",{className:"tw--m-1 tw-flex tw-cursor-pointer tw-items-center tw-gap-2 tw-rounded-md tw-p-1 tw-transition-colors hover:tw-bg-muted/10",onClick:()=>u(!s)},zr.createElement(tu,{className:"tw-size-4 tw-animate-spin tw-text-accent"}),zr.createElement("span",{className:"tw-text-sm tw-font-medium"},"Processing"),s?zr.createElement(Li,{className:"tw-ml-auto tw-size-4"}):zr.createElement(jm,{className:"tw-ml-auto tw-size-4"})),s&&zr.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},a.map((m,g)=>zr.createElement("div",{key:g,className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2 tw-text-sm tw-bg-faint/10"},zr.createElement("div",{className:"tw-size-2 tw-animate-pulse tw-rounded-full tw-bg-interactive-accent"}),zr.createElement(vh,{className:"tw-flex-1",title:m},m))))),i.length>0&&zr.createElement("div",{className:"tw-space-y-3"},zr.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},zr.createElement("div",{className:"-tw-m-1 tw-flex tw-flex-1 tw-cursor-pointer tw-items-center tw-gap-2 tw-rounded-md tw-p-1 tw-transition-colors hover:tw-bg-muted/10",onClick:()=>c(!l)},zr.createElement($v,{className:"tw-size-4 tw-text-error"}),zr.createElement("span",{className:"tw-text-sm tw-font-medium"},"Failed"),zr.createElement(up,{variant:"destructive",className:"tw-text-xs"},i.length," files"),l?zr.createElement(Li,{className:"tw-ml-auto tw-size-4"}):zr.createElement(jm,{className:"tw-ml-auto tw-size-4"}))),l&&zr.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},i.map((m,g)=>zr.createElement("div",{key:g,className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2 tw-text-sm tw-bg-faint/10"},zr.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col tw-gap-1"},zr.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},zr.createElement("div",{className:"tw-size-2 tw-rounded-full tw-bg-error/80"}),zr.createElement(vh,{className:"tw-flex-1 tw-font-bold",title:m.path},p(m))),zr.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},zr.createElement("div",{className:"tw-size-2 tw-rounded-full"}),m.error&&zr.createElement(vh,{className:"tw-flex-1 tw-text-xs tw-text-error/80",title:m.error},zr.createElement("span",{className:"tw-text-sm tw-text-error"},"Loading Error: "),m.error))),zr.createElement(he,{size:"sm",variant:"ghost",className:"tw-size-5 tw-p-0",title:`Retry ${m.type} item`,onClick:async y=>{y.stopPropagation(),await h(m)}},zr.createElement(A5,{className:"tw-size-3"}))))))))}nr();var fd=j(X());function shr(t){let[e,r]=(0,fd.useState)([]);(0,fd.useEffect)(()=>(r([...t.getMessages()]),t.subscribe(()=>{r([...t.getMessages()])})),[t]);let n=(0,fd.useCallback)(async(g,y,_,w=!1)=>await t.sendMessage(g,y,_,w),[t]),o=(0,fd.useCallback)(async(g,y,_,w=!1)=>await t.editMessage(g,y,_,w),[t]),i=(0,fd.useCallback)(async(g,y,_)=>await t.regenerateMessage(g,y,_),[t]),a=(0,fd.useCallback)(async g=>await t.deleteMessage(g),[t]),s=(0,fd.useCallback)((g,y,_)=>t.addDisplayMessage(g,y,_),[t]),u=(0,fd.useCallback)(g=>t.addFullMessage(g),[t]),l=(0,fd.useCallback)(()=>{t.clearMessages()},[t]),c=(0,fd.useCallback)(async g=>{await t.truncateAfterMessageId(g)},[t]),d=(0,fd.useCallback)(g=>{t.addMessage(g)},[t]),f=(0,fd.useCallback)(g=>{t.loadMessages(g)},[t]),p=(0,fd.useCallback)(g=>t.getMessage(g),[t]),h=(0,fd.useCallback)(()=>t.getLLMMessages(),[t]),m=(0,fd.useCallback)(()=>t.getDebugInfo(),[t]);return{messages:e,sendMessage:n,editMessage:o,regenerateMessage:i,deleteMessage:a,addDisplayMessage:s,addFullMessage:u,clearMessages:l,truncateAfterMessageId:c,addMessage:d,loadMessages:f,getMessage:p,getLLMMessages:h,getDebugInfo:m}}nr();fr();Kt();LN();var rKe=async(t,e,r,n,o,i={})=>{let a=new AbortController;o(a);try{await e.runChain(t,a,n,r,i)}catch(s){ie("Model request failed:",s);let u="Model request failed: "+Xn(s);r({id:lm(),sender:Vg,isErrorMessage:!0,message:`Error: ${u}`,isVisible:!0,timestamp:Qs(new Date)})}};Ade();oy();bt();fr();var uhr=j(Tm()),Zl=require("obsidian"),rr=j(X()),d9n=({chainManager:t,onSaveChat:e,updateUserMessageHistory:r,fileParserManager:n,plugin:o,chatUIState:i})=>{let a=_n(),s=(0,rr.useContext)(mV),{messages:u,addMessage:l}=shr(i),[c]=QA(),[d]=Ip(),[f,p]=(0,rr.useState)(""),[h,m]=(0,rr.useState)(""),g=(0,rr.useRef)(null),y=(0,rr.useCallback)(le=>{g.current=le},[]),[_,w]=(0,rr.useState)(!1),[S,C]=(0,rr.useState)(Tv.DEFAULT),[E,P]=(0,rr.useState)([]),[T,I]=(0,rr.useState)(!1),[N,M]=(0,rr.useState)([]),[D,k]=(0,rr.useState)(!1),[F,K]=(0,rr.useState)(null),U=(0,rr.useRef)(!1),Y=(0,rr.useMemo)(()=>({setCurrentAiMessage:le=>U.current&&p(le),setLoadingMessage:le=>U.current&&C(le),setLoading:le=>U.current&&w(le)}),[]),[ee]=_tt(),L=Cbe(),Q=()=>V!=="project"?!1:F!==null?F:L==="loading"||L==="error";(0,rr.useEffect)(()=>{K(null)},[L]);let[z,W]=(0,rr.useState)(null),[V,q]=Ip(),H=l4(),G=sR.getInstance(),Z=(0,rr.useRef)(null);(0,rr.useEffect)(()=>{let le=()=>{Z.current&&Z.current.focus()};return s?.addEventListener(Kg.CHAT_IS_VISIBLE,le),()=>{s?.removeEventListener(Kg.CHAT_IS_VISIBLE,le)}},[s]);let de=(0,rr.useContext)(E_e),pe=o.app||de,ae=async({toolCalls:le,urls:ne,contextNotes:fe}={})=>{if(!h&&N.length===0)return;let be=ne&&ne.length>0,ye=h&&G.extractAllUrls(h).length>0;(be||ye)&&!Rb(d)&&new Zl.Notice(nz.URL_PROCESSING_RESTRICTED);try{let ze=[];h&&ze.push({type:"text",text:h});for(let md of N){let hd=await md.arrayBuffer(),bf=uhr.Buffer.from(hd).toString("base64");ze.push({type:"image_url",image_url:{url:`data:${md.type};base64,${bf}`}})}let Ti=[...fe||[],...E].filter((md,hd,bf)=>bf.findIndex(Vn=>Vn.path===md.path)===hd),yi=h;le&&(yi+=" "+le.join(`
`));let yf={notes:Ti,urls:Rb(d)?ne||[]:[],selectedTextContexts:ee};m(""),M([]),Y.setLoading(!0),Y.setLoadingMessage(Tv.DEFAULT);let fp=await i.sendMessage(yi,yf,d,T,ze.length>0?ze:void 0);h&&r(h),a.autosaveChat&&Te();let qi=i.getLLMMessage(fp);qi&&await rKe(qi,t,l,Y.setCurrentAiMessage,y,{debug:a.debug,updateLoadingMessage:Y.setLoadingMessage}),a.autosaveChat&&Te()}catch(ze){console.error("Error sending message:",ze),new Zl.Notice("Failed to send message. Please try again.")}finally{Y.setLoading(!1),Y.setLoadingMessage(Tv.DEFAULT)}},Te=(0,rr.useCallback)(async()=>{if(!pe){console.error("App instance is not available.");return}try{await i.saveChat(c)}catch(le){console.error("Error saving chat as note:",Xn(le)),new Zl.Notice("Failed to save chat as note. Check console for details.")}},[pe,i,c]),Ae=(0,rr.useCallback)(le=>{g.current&&(B(`stopping generation..., reason: ${le}`),g.current.abort(le),Y.setLoading(!1),Y.setLoadingMessage(Tv.DEFAULT))},[Y]);(0,rr.useEffect)(()=>(U.current=!0,()=>{U.current=!1,g.current&&g.current.abort("component-unmount")}),[]);let ke=(0,rr.useCallback)(async le=>{if(le<=0){new Zl.Notice("Cannot regenerate the first message.");return}let ne=u[le];if(!ne){new Zl.Notice("Message not found.");return}Y.setCurrentAiMessage(""),Y.setLoading(!0);try{await i.regenerateMessage(ne.id,Y.setCurrentAiMessage,l)?a.debug&&console.log("Message regenerated successfully"):new Zl.Notice("Failed to regenerate message. Please try again."),a.autosaveChat&&Te()}catch(fe){console.error("Error regenerating message:",fe),new Zl.Notice("Failed to regenerate message. Please try again.")}finally{Y.setLoading(!1)}},[u,i,a.debug,a.autosaveChat,Te,l,Y]),St=(0,rr.useCallback)(async(le,ne)=>{let fe=u[le];if(!(!fe||fe.message===ne))try{if(!await i.editMessage(fe.id,ne,d,T)){new Zl.Notice("Failed to edit message. Please try again.");return}if(fe.sender===Do){let ye=le<u.length-1;if(await i.truncateAfterMessageId(fe.id),ye){Y.setLoading(!0);try{let ze=i.getLLMMessage(fe.id);ze&&await rKe(ze,t,l,Y.setCurrentAiMessage,y,{debug:a.debug,updateLoadingMessage:Y.setLoadingMessage})}catch(ze){console.error("Error regenerating AI response:",ze),new Zl.Notice("Failed to regenerate AI response. Please try again.")}finally{Y.setLoading(!1)}}}a.autosaveChat&&Te()}catch(be){console.error("Error editing message:",be),new Zl.Notice("Failed to edit message. Please try again.")}},[u,i,d,T,l,t,a.debug,a.autosaveChat,Te,Y,y]);(0,rr.useEffect)(()=>{e&&e(Te)},[e,Te]);let Nr=(0,rr.useCallback)(le=>{let ne=a.projectList||[];if(ne.findIndex(ze=>ze.name===le.name)>=0)throw new Error(`Project "${le.name}" already exists, please use a different name`);let be=[...ne,le];return ot("projectList",be),bu()?.id===le.id?l_e().then(()=>{new Zl.Notice(`${le.name} added and context loaded`)}).catch(ze=>{console.error("Error loading project context:",ze),new Zl.Notice(`${le.name} added but context loading failed`)}):new Zl.Notice(`${le.name} added successfully`),!0},[a.projectList]),Ir=(0,rr.useCallback)((le,ne)=>{let fe=a.projectList||[];if(!fe.find(mr=>mr.name===le.name))throw new Error(`Project "${le.name}" does not exist`);let ye=fe.map(mr=>mr.name===le.name?ne:mr);return ot("projectList",ye),bu()?.id===le.id?(Mj(ne),l_e().then(()=>{new Zl.Notice(`${le.name} updated and context reloaded`)}).catch(mr=>{console.error("Error reloading project context:",mr),new Zl.Notice(`${le.name} updated but context reload failed`)})):new Zl.Notice(`${le.name} updated successfully`),!0},[a.projectList]),Hn=(0,rr.useCallback)(le=>{m(ne=>`${ne} ${le} `)},[]),Yr=(0,rr.useCallback)(le=>{ytt(le)},[]),Sr=(0,rr.useCallback)(async le=>{let ne=u[le];if(!ne){new Zl.Notice("Message not found.");return}try{await i.deleteMessage(ne.id)||new Zl.Notice("Failed to delete message. Please try again.")}catch(fe){console.error("Error deleting message:",fe),new Zl.Notice("Failed to delete message. Please try again.")}},[u,i]),Me=(0,rr.useCallback)(async()=>{Ae("new-chat"),a.autosaveChat&&await Te(),i.clearMessages(),Y.setCurrentAiMessage(""),P([]),btt(),V!=="copilot_plus"?I(!1):I(a.includeActiveNoteAsContext)},[Ae,i,a.autosaveChat,a.includeActiveNoteAsContext,V,Te,Y]),Ge=(0,rr.useCallback)(()=>{o.loadCopilotChatHistory()},[o]);(0,rr.useEffect)(()=>{let le=ne=>{let fe=ne.detail?.reason||"new-chat";Ae(fe)};return s?.addEventListener(Kg.ABORT_STREAM,le),()=>{s?.removeEventListener(Kg.ABORT_STREAM,le)}},[s,Ae]),(0,rr.useEffect)(()=>{a.includeActiveNoteAsContext!==void 0&&(V==="copilot_plus"?I(a.includeActiveNoteAsContext):I(!1))},[a.includeActiveNoteAsContext,V]);let je=()=>rr.default.createElement(rr.default.Fragment,null,rr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},rr.default.createElement(kdr,{currentVersion:o.manifest.version}),rr.default.createElement(Fdr,{chatHistory:u,currentAiMessage:f,loading:_,loadingMessage:S,app:pe,onRegenerate:ke,onEdit:St,onDelete:Sr,onInsertToChat:Hn,onReplaceChat:m,showHelperComponents:V!=="project"}),Q()?rr.default.createElement("div",{className:"tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-rounded-xl"},rr.default.createElement(tKe,{plugin:o,setHiddenCard:()=>{K(!1)}})):rr.default.createElement(rr.default.Fragment,null,rr.default.createElement(wlr,{onNewChat:Me,onSaveAsNote:()=>Te(),onLoadHistory:Ge,onModeChange:le=>{W(V),le==="project"&&k(!1)}}),rr.default.createElement(gcr,{ref:Z,inputMessage:h,setInputMessage:m,handleSendMessage:ae,isGenerating:_,onStopGenerating:()=>Ae("user-stopped"),app:pe,contextNotes:E,setContextNotes:P,includeActiveNote:T,setIncludeActiveNote:I,mention:G,selectedImages:N,onAddImage:le=>M(ne=>[...ne,...le]),setSelectedImages:M,disableModelSwitch:V==="project",selectedTextContexts:ee,onRemoveSelectedText:Yr,showProgressCard:()=>{K(!0)}}))));return rr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},rr.default.createElement("div",{className:"tw-h-full"},rr.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},V==="project"&&rr.default.createElement("div",{className:`${V==="project"?"tw-z-modal":""}`},rr.default.createElement(K9e,{projects:a.projectList||[],defaultOpen:!0,app:pe,hasMessages:!1,onProjectAdded:Nr,onEditProject:Ir,inputRef:Z,onClose:()=>{z?(q(z),W(null)):q(H?"copilot_plus":"llm_chain")},showChatUI:le=>k(le),onProjectClose:()=>{K(null)}})),(V!=="project"||V==="project"&&D)&&je())))},lhr=d9n;nr();var chr=require("obsidian"),CN=j(X()),dhr=j(Lc()),ON=class extends chr.ItemView{constructor(r,n){super(r);this.plugin=n;this.root=null;this.handleSaveAsNote=null;this.app=n.app,this.fileParserManager=n.fileParserManager,this.eventTarget=new EventTarget,this.plugin=n}get chainManager(){return this.plugin.projectManager.getCurrentChainManager()}getViewType(){return Ms}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){this.root=(0,dhr.createRoot)(this.containerEl.children[1]);let r=o=>{this.handleSaveAsNote=o},n=o=>{this.plugin.updateUserMessageHistory(o)};this.renderView(r,n)}renderView(r,n){this.root&&this.root.render(CN.createElement(E_e.Provider,{value:this.app},CN.createElement(mV.Provider,{value:this.eventTarget},CN.createElement(CN.StrictMode,null,CN.createElement(u_e,{delayDuration:0},CN.createElement(lhr,{chainManager:this.chainManager,updateUserMessageHistory:n,fileParserManager:this.fileParserManager,plugin:this.plugin,onSaveChat:r,chatUIState:this.plugin.chatUIState}))))))}async saveChat(){this.handleSaveAsNote&&await this.handleSaveAsNote()}updateView(){let r=o=>{this.handleSaveAsNote=o},n=o=>{this.plugin.updateUserMessageHistory(o)};this.renderView(r,n)}async onClose(){this.root&&(this.root.unmount(),this.root=null)}};aVe();fr();var fhr=require("obsidian"),gve=class extends fhr.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=this.app.metadataCache.getFileCache(r)?.frontmatter,o;n?.topic&&typeof n.topic=="string"&&n.topic.trim()?o=n.topic.trim():o=r.basename.replace(/^[a-zA-Z0-9-]+__/,"").replace(/\{\$date}|\d{8}/g,"").replace(/\{\$time}|\d{6}/g,"").replace(/[@_]/g," ").replace(/\s+/g," ").trim();let i;return n&&n.epoch?i=Qs(new Date(n.epoch)):i=Qs(new Date(r.stat.ctime)),`${o} - ${i.display}`}onChooseItem(r,n){this.onChooseFile(r)}};nr();function phr(t){t.addItem(e=>{e.setTitle("Copilot"),e.setSubmenu();let r=e.submenu;if(!r)return;r.addItem(i=>{i.setTitle("Add selection to chat context").onClick(()=>{app.commands.executeCommandById(`copilot:${dn.ADD_SELECTION_TO_CHAT_CONTEXT}`)})}),r.addItem(i=>{i.setTitle("Trigger quick command").onClick(()=>{app.commands.executeCommandById(`copilot:${dn.TRIGGER_QUICK_COMMAND}`)})});let o=ap().filter(i=>i.showInContextMenu);o.length>0&&r.addSeparator(),zZ(o).forEach(i=>{r.addItem(a=>{a.setTitle(i.title).onClick(()=>{app.commands.executeCommandById(`copilot:${qH(i.title)}`)})})})})}var mhr=j(fze());Kt();var yve=class{constructor(e,r){this.handleFileModify=(0,mhr.default)(async e=>{if(!VH(e)||kZ(e.path))return;let r=await BZ(e);this.registerCommand(r),n$(r,r.title)},1e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(!(!VH(e)||kZ(e.path)))try{let r=await BZ(e);if(!lir(e)){let n=vbe();r={...r,order:n}}await w8e(e,r),n$(r,r.title),this.registerCommand(r)}catch(r){ie(`Error processing custom command creation: ${e.path}`,r)}};this.handleFileDeletion=async e=>{if(!VH(e)||kZ(e.path))return;let r=qH(e.basename);this.plugin.removeCommand(r),$Z(e.basename)};this.handleFileRename=async(e,r)=>{if(kZ(e.path))return;let n=r.split("/").pop()?.replace(/\.md$/,"");if(n){let o=qH(n);this.plugin.removeCommand(o),$Z(n)}if(VH(e)){let o=await BZ(e);this.registerCommand(o),n$(o,o.title),await w8e(e,o)}};this.plugin=e,this.vault=r,this.initializeEventListeners()}async initialize(){await bbe(),this.registerCommands()}async registerCommands(){ap().forEach(r=>{this.registerCommand(r)})}cleanup(){this.vault.off("create",this.handleFileCreation),this.vault.off("delete",this.handleFileDeletion),this.vault.off("rename",this.handleFileRename),this.vault.off("modify",this.handleFileModify)}initializeEventListeners(){this.vault.on("create",this.handleFileCreation),this.vault.on("delete",this.handleFileDeletion),this.vault.on("rename",this.handleFileRename),this.vault.on("modify",this.handleFileModify)}registerCommand(e){let r=qH(e.title);this.plugin.removeCommand(r),this.plugin.addCommand({id:r,name:e.title,editorCallback:n=>{new B1(this.plugin.app,{selectedText:n.getSelection(),command:e}).open(),Oc.getInstance().recordUsage(e)}})}};bt();function f9n(t){let r=`${$1()}/unsupported`;return app.vault.getAbstractFileByPath(r)||app.vault.createFolder(r),Promise.all(t.map(async o=>{let i=`${r}/${o.title}.md`,a=await app.vault.create(i,o.content);await app.fileManager.processFrontMatter(a,s=>{s[XT]=o.showInContextMenu,s[QT]=o.showInSlashMenu,s[$O]=o.order,s[eA]=o.modelKey,s[tA]=0})}))}async function hhr(){let t=oe().inlineEditCommands;if(!t||t.length===0)return;let e=[],r=[],n=ap(),o=t.map((a,s)=>({title:a.name,content:a.prompt,showInContextMenu:a.showInContextMenu,showInSlashMenu:!1,order:s*10,modelKey:a.modelKey??"",lastUsedMs:0}));for(let a of o){let s=ybe(a.title,n);s?r.push({...a,title:encodeURIComponent(a.title),content:`> ${s}
Original name: ${a.title}
${a.content}`}):e.push(a)}await Oc.getInstance().updateCommands([...n.map(a=>({...a,showInSlashMenu:!0})),...e]);let i=`We have upgraded your commands to the new format. They are now also stored as notes in ${$1()}.`;r.length>0&&(await f9n(r),i+=`
We found ${r.length} unsupported commands. They are saved in ${$1()}/unsupported. To fix them, please resolve the errors and move the note file out of the unsupported folder.`),ot("inlineEditCommands",[]),new Ec(app,()=>{},i,"\u{1F680} New Copilot Custom Commands","OK","").open()}async function nKe(){let t=ap(),e=sir.filter(n=>!t.some(o=>o.title===n.title)),r=[...t,...e];Oc.getInstance().updateCommands(r)}async function ghr(){if(oe().suggestedDefaultCommands)return;ap().length===0&&(new Ec(app,()=>{nKe()},"Would you like to add Copilot recommended commands in your custom prompts folder? These commands will be available through the right-click context menu and slash commands in chat.","Welcome to Copilot","Confirm","Skip").open(),ot("suggestedDefaultCommands",!0))}var ts=j(X()),kY=require("obsidian"),yhr=j(Lc());vo();sa();function p9n({plugin:t,onRemove:e}){let[r,n]=(0,ts.useState)(""),[o,i]=(0,ts.useState)(!0),[a,s]=(0,ts.useState)(""),[u]=QA(),[l,c]=(0,ts.useState)(u),d=(0,ts.useRef)(null);(0,ts.useEffect)(()=>{let m=t.app.workspace.getActiveViewOfType(kY.MarkdownView);if(m&&m.editor){let g=m.editor.getSelection();s(g)}},[t.app]),(0,ts.useEffect)(()=>{d.current&&d.current.focus()},[]);let f=async()=>{if(!r.trim()){new kY.Notice("Please enter a prompt");return}let m=`
You are an AI assistant designed to execute user instructions with precision. Your responses should be:
- Direct and focused: Address only what is explicitly requested
- Concise: Avoid unnecessary elaboration unless the user asks for details
- Context-aware: When text is selected or highlighted, treat it as the primary target for any requested action
- Action-oriented: Prioritize completing the task over explaining the process
Key principles:
- Follow instructions literally and completely
- Assume selected/highlighted text is the focus unless told otherwise
- Use all provided context: Consider any additional information, examples, or constraints the user provides to better complete the task
- Add explanations only when explicitly requested or when clarification is essential
- Maintain the user's preferred format and style
Response format: Match the format implied by the user's request (e.g., if they ask for a list, provide a list; if they ask for a rewrite, provide only the rewritten text).
`,g=r;if(o){let w=g.includes("{}"),S=/\{activenote\}/i.test(g),C=[];w||C.push("{}"),S||C.push("{activeNote}"),C.length>0&&(g+=`
${C.join(`
`)}`)}let y={title:"Quick Command",content:g,showInContextMenu:!1,showInSlashMenu:!1,order:0,modelKey:l,lastUsedMs:Date.now()};new B1(t.app,{selectedText:a,command:y,systemPrompt:m}).open(),e()},p=()=>{e()};return ts.default.createElement("div",{className:"tw-rounded-lg tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-4",onKeyDown:m=>{m.key==="Escape"?(m.preventDefault(),p()):m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),f())}},ts.default.createElement("div",{className:"tw-space-y-4"},ts.default.createElement(W_,{ref:d,value:r,onChange:m=>n(m.target.value),placeholder:"Ask me anything...",className:"tw-min-h-24 tw-resize-none",rows:3}),ts.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-4"},ts.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},ts.default.createElement(p_e,{size:"sm",variant:"ghost",value:l,onChange:c}),ts.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ts.default.createElement(Cc,{id:"includeActiveNote",checked:o,onCheckedChange:m=>i(!!m)}),ts.default.createElement("label",{htmlFor:"includeActiveNote",className:"tw-cursor-pointer tw-text-sm tw-text-muted"},"Include note context"))),ts.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ts.default.createElement(he,{variant:"secondary",onClick:p,size:"sm"},"Cancel"),ts.default.createElement(he,{onClick:f,size:"sm"},"Submit")))))}function bhr({plugin:t,element:e}){let r=document.createElement("div");e.appendChild(r);let n=(0,yhr.createRoot)(r),o=()=>{let i=t.app.workspace.getActiveViewOfType(kY.MarkdownView);i&&i.editor&&wbe(i.editor),n.unmount(),r.remove()};return n.render(ts.default.createElement(p9n,{plugin:t,onRemove:o})),{root:n,container:r}}nr();bt();Kt();sa();oc();Kt();Ade();fr();var bve=class t{constructor(){this.contextProcessor=lV.getInstance(),this.mention=sR.getInstance()}static getInstance(){return t.instance||(t.instance=new t),t.instance}async processMessageContext(e,r,n,o,i,a){try{B(`[ContextManager] Processing context for message ${e.id}`);let s=e.originalMessage||e.message,{processedPrompt:u,includedFiles:l}=await v8e(s,"",n,a),c=o==="copilot_plus"?await this.mention.processUrls(s):{urlContext:"",imageUrls:[]},d=new Set(l.map(y=>y.path)),p=[...e.context?.notes||[]];i&&o!=="project"&&a&&!p.some(y=>y.path===a.path)&&p.push(a);let h=await this.contextProcessor.processContextNotes(d,r,n,p,i,a,o),m=this.contextProcessor.processSelectedTextContexts(),g=u+c.urlContext+h+m;return B(`[ContextManager] Successfully processed context for message ${e.id}`),g}catch(s){return B(`[ContextManager] Error processing context for message ${e.id}:`,s),e.originalMessage||e.message}}async reprocessMessageContext(e,r,n,o,i,a,s){let u=r.getMessage(e);if(!u||u.sender!=="user"||!u.id)return;B(`[ContextManager] Reprocessing context for message ${e}`);let l=await this.processMessageContext(u,n,o,i,a,s);r.updateProcessedText(u.id,l),B(`[ContextManager] Completed context reprocessing for message ${e}`)}createMessageContext(e,r,n=Nj()){return{notes:e,urls:r,selectedTextContexts:n}}async extractContextNotes(e,r,n=[]){return[...await Hg(e,r),...n].filter((s,u,l)=>l.findIndex(c=>c.path===s.path)===u)}needsContextReprocessing(e){return e.needsContextReprocessing===!0}getSelectedTextContexts(){return Nj()}};fr();Kt();var LV=class{constructor(){this.messages=[]}generateId(){return`msg-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}addMessage(e,r,n,o,i){let a=this.generateId(),s=Qs(new Date),u={id:a,displayText:e,processedText:r,sender:n,timestamp:s,context:o,isVisible:!0,isErrorMessage:!1,content:i};return this.messages.push(u),B(`[MessageRepository] Added message with ID: ${a}`),a}addDisplayOnlyMessage(e,r,n){if(n){let o=Qs(new Date),i={id:n,displayText:e,processedText:e,sender:r,timestamp:o,isVisible:!0,isErrorMessage:!1};return this.messages.push(i),B(`[MessageRepository] Added display-only message with ID: ${n}`),n}return this.addMessage(e,e,r)}addFullMessage(e){let r=e.id||this.generateId(),n=e.timestamp||Qs(new Date),o={id:r,displayText:e.message,processedText:e.originalMessage||e.message,sender:e.sender,timestamp:n,context:e.context,isVisible:e.isVisible!==!1,isErrorMessage:e.isErrorMessage,sources:e.sources,content:e.content};return this.messages.push(o),B(`[MessageRepository] Added full message with ID: ${r}`),r}editMessage(e,r){let n=this.messages.find(o=>o.id===e);return n?n.displayText===r?(B(`[MessageRepository] No changes needed for message: ${e}`),!0):(n.displayText=r,n.sender==="user"||n.sender==="USER"?B(`[MessageRepository] Edited user message ${e}, needs context reprocessing`):(n.processedText=r,B(`[MessageRepository] Edited AI message ${e}`)),!0):(B(`[MessageRepository] Message not found for edit: ${e}`),!1)}updateProcessedText(e,r){let n=this.messages.find(o=>o.id===e);return n?(n.processedText=r,B(`[MessageRepository] Updated processed text for message ${e}`),!0):(B(`[MessageRepository] Message not found for processed text update: ${e}`),!1)}deleteMessage(e){let r=this.messages.findIndex(n=>n.id===e);return r===-1?(B(`[MessageRepository] Message not found for deletion: ${e}`),!1):(this.messages.splice(r,1),B(`[MessageRepository] Deleted message ${e}`),!0)}clear(){this.messages=[],B("[MessageRepository] Cleared all messages")}truncateAfter(e){this.messages=this.messages.slice(0,e+1),B(`[MessageRepository] Truncated messages after index ${e}`)}truncateAfterMessageId(e){let r=this.messages.findIndex(n=>n.id===e);r!==-1&&(this.messages=this.messages.slice(0,r+1),B(`[MessageRepository] Truncated messages after message ${e}`))}getDisplayMessages(){return this.messages.filter(e=>e.isVisible).map(e=>({id:e.id,message:e.displayText,originalMessage:e.displayText,sender:e.sender,timestamp:e.timestamp,isVisible:!0,context:e.context,isErrorMessage:e.isErrorMessage,sources:e.sources,content:e.content}))}getLLMMessage(e){let r=this.messages.find(n=>n.id===e);if(r)return{id:r.id,message:r.processedText,originalMessage:r.displayText,sender:r.sender,timestamp:r.timestamp,isVisible:!1,context:r.context,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content}}getLLMMessages(){return this.messages.map(e=>({id:e.id,message:e.processedText,originalMessage:e.displayText,sender:e.sender,timestamp:e.timestamp,isVisible:!1,context:e.context,isErrorMessage:e.isErrorMessage,sources:e.sources,content:e.content}))}getMessage(e){let r=this.messages.find(n=>n.id===e);if(r)return{id:r.id,message:r.displayText,originalMessage:r.displayText,sender:r.sender,timestamp:r.timestamp,isVisible:r.isVisible,context:r.context,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content}}loadMessages(e){this.clear(),e.forEach(r=>{this.messages.push({id:r.id||this.generateId(),displayText:r.message,processedText:r.originalMessage||r.message,sender:r.sender,timestamp:r.timestamp||Qs(new Date),context:r.context,isVisible:r.isVisible!==!1,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content})}),B(`[MessageRepository] Loaded ${e.length} messages`)}getDebugInfo(){return{totalMessages:this.messages.length,visibleMessages:this.messages.filter(e=>e.isVisible).length,userMessages:this.messages.filter(e=>e.sender==="user"||e.sender==="USER").length,aiMessages:this.messages.filter(e=>e.sender==="AI"||e.sender==="assistant").length}}};var $$=require("obsidian");Kt();fr();nr();bt();sa();var $Y=class{constructor(e,r,n){this.app=e;this.messageRepo=r;this.chainManager=n}async saveChat(e){try{let r=this.messageRepo.getDisplayMessages();if(r.length===0){new $$.Notice("No messages to save.");return}let n=oe(),o=this.formatChatContent(r),i=r[0].timestamp?.epoch||Date.now();this.app.vault.getAbstractFileByPath(n.defaultSaveFolder)||await this.app.vault.createFolder(n.defaultSaveFolder);let s=await this.findFileByEpoch(i),u;s?u=this.app.metadataCache.getFileCache(s)?.frontmatter?.topic:u=await this.generateAITopic(r);let l=this.generateFileName(r,i,u),c=this.generateNoteContent(o,i,e,u);s?(await this.app.vault.modify(s,c),B(`[ChatPersistenceManager] Updated existing chat file: ${s.path}`)):(await this.app.vault.create(l,c),new $$.Notice(`Chat saved as note: ${l}`),B(`[ChatPersistenceManager] Created new chat file: ${l}`))}catch(r){ie("[ChatPersistenceManager] Error saving chat:",r),new $$.Notice("Failed to save chat as note. Check console for details.")}}async loadChat(e){try{let r=await this.app.vault.read(e),n=this.parseChatContent(r);return B(`[ChatPersistenceManager] Loaded ${n.length} messages from ${e.path}`),n}catch(r){return ie("[ChatPersistenceManager] Error loading chat:",r),new $$.Notice("Failed to load chat history. Check console for details."),[]}}async getChatHistoryFiles(){let e=oe(),r=this.app.vault.getAbstractFileByPath(e.defaultSaveFolder);if(!(r instanceof $$.TFolder))return[];let o=this.app.vault.getMarkdownFiles().filter(a=>a.path.startsWith(r.path)),i=bu();return o.filter(a=>i?a.basename.startsWith(`${i.id}__`):!a.basename.includes("__")||!a.basename.split("__")[0])}formatChatContent(e){return e.map(r=>{let n=r.timestamp?r.timestamp.display:"Unknown time";return`**${r.sender}**: ${r.message}
[Timestamp: ${n}]`}).join(`
`)}parseChatContent(e){let r=[],n=e.match(/^---\n([\s\S]*?)\n---/),o=e;n&&(o=e.slice(n[0].length).trim());let i=/\*\*(user|ai)\*\*: ([\s\S]*?)(?=(?:\n\*\*(?:user|ai)\*\*: )|$)/g,a;for(;(a=i.exec(o))!==null;){let s=a[1]==="user"?Do:Vg,u=a[2].trim(),l=u.split(`
`),c=u,d="Unknown time",f=l.length-1;if(f>0&&l[f].startsWith("[Timestamp: ")){let h=l[f].match(/\[Timestamp: (.*?)\]/);h&&(d=h[1],c=l.slice(0,f).join(`
`).trim())}let p;if(d!=="Unknown time"){let h=new Date(d);isNaN(h.getTime())||(p=h.getTime())}r.push({message:c,sender:s,isVisible:!0,timestamp:p?{epoch:p,display:d,fileName:""}:null})}return r}async findFileByEpoch(e){let r=await this.getChatHistoryFiles();for(let n of r)if(this.app.metadataCache.getFileCache(n)?.frontmatter?.epoch===e)return n;return null}async generateAITopic(e){if(this.chainManager)try{let r=this.chainManager.chatModelManager.getChatModel();if(!r)return;let n=6,o=200,a=`Generate a concise title (max 5 words) for this conversation based on its content. Return only the title without any explanation or quotes.
Conversation:
${e.reduce((l,c,d)=>d>=n?l:l+(l?`
`:"")+`${c.sender}: ${c.message.slice(0,o)}`,"")}`;return(await r.invoke(a)).content.toString().trim().replace(/^["']|["']$/g,"").replace(/[\\/:*?"<>|]/g,"").slice(0,50)||void 0}catch(r){ie("[ChatPersistenceManager] Error generating AI topic:",r);return}}generateFileName(e,r,n){let o=oe(),a=Qs(new Date(r)).fileName,s;if(n)s=n;else{let f=e.find(p=>p.sender===Do);s=f?f.message.split(/\s+/).slice(0,10).join(" ").replace(/[\\/:*?"<>|]/g,"").trim():"Untitled Chat"}let u=o.defaultConversationNoteName||"{$date}_{$time}__{$topic}";u=u.replace("{$topic}",s.slice(0,100).replace(/\s+/g,"_")).replace("{$date}",a.split("_")[0]).replace("{$time}",a.split("_")[1]);let l=u.replace(/[\\/:*?"<>|]/g,"_"),c=bu(),d=c?`${c.id}__`:"";return`${o.defaultSaveFolder}/${d}${l}.md`}generateNoteContent(e,r,n,o){let i=oe(),a=bu();return`---
epoch: ${r}
modelKey: ${n}
${o?`topic: "${o}"`:""}
${a?`projectId: ${a.id}`:""}
${a?`projectName: ${a.name}`:""}
tags:
- ${i.defaultConversationTag}
---
${e}`}};nr();var _ve=class{constructor(e,r,n,o){this.messageRepo=e;this.chainManager=r;this.fileParserManager=n;this.plugin=o;this.projectMessageRepos=new Map;this.defaultProjectKey="defaultProjectKey";this.lastKnownProjectId=null;this.contextManager=bve.getInstance(),this.projectMessageRepos.set(this.defaultProjectKey,e),this.persistenceManager=new $Y(o.app,e,r)}getCurrentMessageRepo(){let e=this.plugin.projectManager.getCurrentProjectId(),r=e??this.defaultProjectKey;if(this.lastKnownProjectId!==e&&(B(`[ChatManager] Project changed from ${this.lastKnownProjectId} to ${e}`),this.lastKnownProjectId=e),!this.projectMessageRepos.has(r)){B(`[ChatManager] Creating new message repository for project: ${r}`);let o=new LV;this.projectMessageRepos.set(r,o)}let n=this.projectMessageRepos.get(r);return this.persistenceManager=new $Y(this.plugin.app,n,this.chainManager),n}setOnMessageCreatedCallback(e){this.onMessageCreatedCallback=e}async sendMessage(e,r,n,o=!1,i){try{B(`[ChatManager] Sending message: "${e}"`);let a=this.plugin.app.workspace.getActiveFile(),s={...r};if(o&&a){let f=r.notes||[],p=f.some(h=>h.path===a.path);s.notes=p?f:[...f,a]}let u=this.getCurrentMessageRepo(),l=u.addMessage(e,e,Do,s,i);this.onMessageCreatedCallback&&this.onMessageCreatedCallback(l);let c=u.getMessage(l);if(!c)throw new Error(`Failed to retrieve message ${l}`);let d=await this.contextManager.processMessageContext(c,this.fileParserManager,this.plugin.app.vault,n,o,a);return u.updateProcessedText(l,d),B(`[ChatManager] Successfully sent message ${l}`),l}catch(a){throw B("[ChatManager] Error sending message:",a),a}}async editMessage(e,r,n,o=!1){try{B(`[ChatManager] Editing message ${e}: "${r}"`);let i=this.getCurrentMessageRepo();if(!i.editMessage(e,r))return!1;let s=this.plugin.app.workspace.getActiveFile();return await this.contextManager.reprocessMessageContext(e,i,this.fileParserManager,this.plugin.app.vault,n,o,s),await this.updateChainMemory(),B(`[ChatManager] Successfully edited message ${e}`),!0}catch(i){return B(`[ChatManager] Error editing message ${e}:`,i),!1}}async regenerateMessage(e,r,n,o){try{B(`[ChatManager] Regenerating message ${e}`);let i=this.getCurrentMessageRepo();if(!i.getMessage(e))return B(`[ChatManager] Message not found: ${e}`),!1;let s=i.getDisplayMessages(),u=s.findIndex(f=>f.id===e);if(u<=0)return B("[ChatManager] Cannot regenerate first message or no user message found"),!1;let l=s[u-1];if(l.sender!==Do)return B("[ChatManager] Previous message is not from user"),!1;if(i.truncateAfter(u-1),o&&o(),await this.updateChainMemory(),!l.id)return B("[ChatManager] User message has no ID for regeneration"),!1;let c=i.getLLMMessage(l.id);if(!c)return B("[ChatManager] LLM message not found for regeneration"),!1;let d=new AbortController;return await this.chainManager.runChain(c,d,r,n,{debug:oe().debug}),B(`[ChatManager] Successfully regenerated message ${e}`),!0}catch(i){return B(`[ChatManager] Error regenerating message ${e}:`,i),!1}}async deleteMessage(e){try{return B(`[ChatManager] Deleting message ${e}`),this.getCurrentMessageRepo().deleteMessage(e)?(await this.updateChainMemory(),B(`[ChatManager] Successfully deleted message ${e}`),!0):!1}catch(r){return B(`[ChatManager] Error deleting message ${e}:`,r),!1}}addDisplayMessage(e,r,n){return this.getCurrentMessageRepo().addDisplayOnlyMessage(e,r,n)}addFullMessage(e){return this.getCurrentMessageRepo().addFullMessage(e)}clearMessages(){this.getCurrentMessageRepo().clear(),this.chainManager.memoryManager.clearChatMemory(),B("[ChatManager] Cleared all messages")}async truncateAfterMessageId(e){this.getCurrentMessageRepo().truncateAfterMessageId(e),await this.updateChainMemory(),B(`[ChatManager] Truncated messages after ${e}`)}getDisplayMessages(){return this.getCurrentMessageRepo().getDisplayMessages()}getLLMMessages(){return this.getCurrentMessageRepo().getLLMMessages()}getMessage(e){return this.getCurrentMessageRepo().getMessage(e)}getLLMMessage(e){return this.getCurrentMessageRepo().getLLMMessage(e)}async updateChainMemory(){try{let r=this.getCurrentMessageRepo().getLLMMessages();await jor(r,this.chainManager.memoryManager),B(`[ChatManager] Updated chain memory with ${r.length} messages`)}catch(e){B("[ChatManager] Error updating chain memory:",e)}}async loadMessages(e){let r=this.getCurrentMessageRepo();r.clear(),e.forEach(n=>{r.addFullMessage(n)}),await this.updateChainMemory(),B(`[ChatManager] Loaded ${e.length} messages`)}async saveChat(e){await this.persistenceManager.saveChat(e)}getDebugInfo(){return{...this.getCurrentMessageRepo().getDebugInfo(),currentProject:this.plugin.projectManager.getCurrentProjectId(),totalProjects:this.projectMessageRepos.size}}async handleProjectSwitch(){let e=this.plugin.projectManager.getCurrentProjectId();B(`[ChatManager] Handling project switch to: ${e}`),this.lastKnownProjectId=null;let r=this.getCurrentMessageRepo();await this.updateChainMemory(),B(`[ChatManager] Project switch complete. Messages: ${r.getDisplayMessages().length}`)}};Aj();Kt();oy();Kc();nr();bt();var cX=require("obsidian"),LKe=j(X()),xyr=j(Lc());var vve=class extends Ec{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")}};vo();var BY=j(X());wn();var _hr=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>BY.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:me("tw-flex tw-flex-row tw-items-center","tw-h-8","tw-px-2 tw-py-1","tw-gap-1.5","tw-cursor-pointer","tw-overflow-hidden","tw-whitespace-nowrap","tw-text-sm","tw-border tw-border-solid tw-border-border","tw-rounded-b-[2px] tw-rounded-t-md","tw-bg-primary","tw-transition-all tw-duration-300 tw-ease-in-out","hover:tw-border-interactive-accent",e&&["!tw-bg-interactive-accent","tw-text-on-accent","!tw-px-3","!tw-max-w-full","tw-transition-all tw-duration-300 tw-ease-in-out","tw-delay-200"],"lg:tw-max-w-32","md:tw-max-w-32")},BY.default.createElement("div",{className:me("tw-flex tw-items-center tw-justify-center","tw-size-4","tw-transition-transform tw-duration-200 tw-ease-in-out",e?"tw-max-w-[16px] tw-translate-x-0 tw-opacity-100":"tw-max-w-0 tw--translate-x-4 tw-opacity-0")},t.icon),BY.default.createElement("span",{className:me("tw-text-sm","tw-font-medium","tw-transition-all tw-duration-200 tw-ease-in-out","tw-overflow-hidden tw-whitespace-nowrap","tw-max-w-[100px] tw-translate-x-0 tw-opacity-100")},t.label)),vhr=({id:t,children:e,isSelected:r})=>r?BY.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:me("tw-pt-4","tw-transition-all tw-duration-200 tw-ease-in-out",r?"tw-translate-y-0 tw-opacity-100":"tw-translate-y-2 tw-opacity-0")},e):null;var Pg=j(X()),whr=(0,Pg.createContext)(void 0),xhr=({children:t})=>{let[e,r]=(0,Pg.useState)("basic"),[n,o]=(0,Pg.useState)(null),i=(0,Pg.useRef)(!1);return(0,Pg.useEffect)(()=>{if(!i.current){let a=document.querySelector(".modal-container");o(a),i.current=!0}},[]),Pg.default.createElement(whr.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},FV=()=>{let t=(0,Pg.useContext)(whr);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};bt();var Lt=j(X());vo();fn();var Ac=j(X());wn();var zY=Ac.forwardRef(({className:t,...e},r)=>Ac.createElement("div",{className:"tw-relative tw-w-full tw-overflow-auto"},Ac.createElement("table",{ref:r,className:me("tw-w-full tw-caption-bottom tw-border-collapse tw-text-sm",t),...e})));zY.displayName="Table";var UY=Ac.forwardRef(({className:t,...e},r)=>Ac.createElement("thead",{ref:r,className:me("[&_tr]:tw-border-b",t),...e}));UY.displayName="TableHeader";var qY=Ac.forwardRef(({className:t,...e},r)=>Ac.createElement("tbody",{ref:r,className:t,...e}));qY.displayName="TableBody";var m9n=Ac.forwardRef(({className:t,...e},r)=>Ac.createElement("tfoot",{ref:r,className:me("tw-border-t tw-font-medium tw-bg-primary-alt/50",t),...e}));m9n.displayName="TableFooter";var EN=Ac.forwardRef(({className:t,...e},r)=>Ac.createElement("tr",{ref:r,className:me("tw-border-b tw-transition-colors hover:tw-bg-primary-alt/50 data-[state=selected]:tw-bg-primary-alt",t),...e}));EN.displayName="TableRow";var im=Ac.forwardRef(({className:t,...e},r)=>Ac.createElement("th",{ref:r,className:me("tw-h-10 tw-px-2 tw-text-left tw-align-middle tw-font-medium tw-text-muted [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));im.displayName="TableHead";var dp=Ac.forwardRef(({className:t,...e},r)=>Ac.createElement("td",{ref:r,className:me("tw-p-2 tw-align-middle [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));dp.displayName="TableCell";var h9n=Ac.forwardRef(({className:t,...e},r)=>Ac.createElement("caption",{ref:r,className:me("tw-mt-4 tw-text-sm tw-text-muted",t),...e}));h9n.displayName="TableCaption";var Re=j(X()),W$=j(Ba());var cu=j(X());function Chr(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,cu.useMemo)(()=>n=>{e.forEach(o=>o(n))},e)}var HY=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function B$(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function wve(t){return"nodeType"in t}function am(t){var e,r;return t?B$(t)?t:wve(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function xve(t){let{Document:e}=am(t);return t instanceof e}function kV(t){return B$(t)?!1:t instanceof am(t).HTMLElement}function iKe(t){return t instanceof am(t).SVGElement}function z$(t){return t?B$(t)?t.document:wve(t)?xve(t)?t:kV(t)||iKe(t)?t.ownerDocument:document:document:document}var yb=HY?cu.useLayoutEffect:cu.useEffect;function Sve(t){let e=(0,cu.useRef)(t);return yb(()=>{e.current=t}),(0,cu.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 Ohr(){let t=(0,cu.useRef)(null),e=(0,cu.useCallback)((n,o)=>{t.current=setInterval(n,o)},[]),r=(0,cu.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function $V(t,e){e===void 0&&(e=[t]);let r=(0,cu.useRef)(t);return yb(()=>{r.current!==t&&(r.current=t)},e),r}function BV(t,e){let r=(0,cu.useRef)();return(0,cu.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function VY(t){let e=Sve(t),r=(0,cu.useRef)(null),n=(0,cu.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function Cve(t){let e=(0,cu.useRef)();return(0,cu.useEffect)(()=>{e.current=t},[t]),e.current}var oKe={};function U$(t,e){return(0,cu.useMemo)(()=>{if(e)return e;let r=oKe[t]==null?0:oKe[t]+1;return oKe[t]=r,t+"-"+r},[t,e])}function Ehr(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 q$=Ehr(1),H$=Ehr(-1);function g9n(t){return"clientX"in t&&"clientY"in t}function WY(t){if(!t)return!1;let{KeyboardEvent:e}=am(t.target);return e&&t instanceof e}function y9n(t){if(!t)return!1;let{TouchEvent:e}=am(t.target);return e&&t instanceof e}function Ove(t){if(y9n(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 g9n(t)?{x:t.clientX,y:t.clientY}:null}var uv=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[uv.Translate.toString(t),uv.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),Shr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Phr(t){return t.matches(Shr)?t:t.querySelector(Shr)}var V$=j(X()),b9n={display:"none"};function Thr(t){let{id:e,value:r}=t;return V$.default.createElement("div",{id:e,style:b9n},r)}function Ahr(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 V$.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function Ihr(){let[t,e]=(0,V$.useState)("");return{announce:(0,V$.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var qhr=(0,Re.createContext)(null);function _9n(t){let e=(0,Re.useContext)(qhr);(0,Re.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function v9n(){let[t]=(0,Re.useState)(()=>new Set),e=(0,Re.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,Re.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 w9n={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.
`},x9n={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 S9n(t){let{announcements:e=x9n,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=w9n}=t,{announce:i,announcement:a}=Ihr(),s=U$("DndLiveRegion"),[u,l]=(0,Re.useState)(!1);if((0,Re.useEffect)(()=>{l(!0)},[]),_9n((0,Re.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=Re.default.createElement(Re.default.Fragment,null,Re.default.createElement(Thr,{id:n,value:o.draggable}),Re.default.createElement(Ahr,{id:s,announcement:a}));return r?(0,W$.createPortal)(c,r):c}var Ic;(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"})(Ic||(Ic={}));function Pve(){}function zV(t,e){return(0,Re.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function Ave(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,Re.useMemo)(()=>[...e].filter(n=>n!=null),[...e])}var lv=Object.freeze({x:0,y:0});function Hhr(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Vhr(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function C9n(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function Mhr(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 mKe(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function Rhr(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 YY=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=Rhr(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=Hhr(Rhr(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(Vhr)},Whr=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=Mhr(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=Mhr(u),c=o.reduce((f,p,h)=>f+Hhr(l[h],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(Vhr)};function O9n(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 E9n=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=O9n(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(C9n)};function P9n(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function Khr(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:lv}function T9n(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 A9n=T9n(1);function I9n(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 M9n(t,e,r){let n=I9n(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 R9n={ignoreTransform:!1};function J$(t,e){e===void 0&&(e=R9n);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=am(t).getComputedStyle(t);l&&(r=M9n(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 Nhr(t){return J$(t,{ignoreTransform:!0})}function N9n(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function j9n(t,e){return e===void 0&&(e=am(t).getComputedStyle(t)),e.position==="fixed"}function D9n(t,e){e===void 0&&(e=am(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 XY(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(xve(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!kV(o)||iKe(o)||r.includes(o))return r;let i=am(t).getComputedStyle(o);return o!==t&&D9n(o,i)&&r.push(o),j9n(o,i)?r:n(o.parentNode)}return t?n(t):r}function Ghr(t){let[e]=XY(t,1);return e??null}function aKe(t){return!HY||!t?null:B$(t)?t:wve(t)?xve(t)||t===z$(t).scrollingElement?window:kV(t)?t:null:null}function Jhr(t){return B$(t)?t.scrollX:t.scrollLeft}function Zhr(t){return B$(t)?t.scrollY:t.scrollTop}function lKe(t){return{x:Jhr(t),y:Zhr(t)}}var pd;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(pd||(pd={}));function Yhr(t){return!HY||!t?!1:t===document.scrollingElement}function Xhr(t){let e={x:0,y:0},r=Yhr(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 L9n={x:.2,y:.2};function F9n(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=L9n);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=Xhr(t),p={x:0,y:0},h={x:0,y:0},m={height:e.height*o.y,width:e.width*o.x};return!l&&i<=e.top+m.height?(p.y=pd.Backward,h.y=n*Math.abs((e.top+m.height-i)/m.height)):!c&&u>=e.bottom-m.height&&(p.y=pd.Forward,h.y=n*Math.abs((e.bottom-m.height-u)/m.height)),!f&&s>=e.right-m.width?(p.x=pd.Forward,h.x=n*Math.abs((e.right-m.width-s)/m.width)):!d&&a<=e.left+m.width&&(p.x=pd.Backward,h.x=n*Math.abs((e.left+m.width-a)/m.width)),{direction:p,speed:h}}function k9n(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 Qhr(t){return t.reduce((e,r)=>q$(e,lKe(r)),lv)}function $9n(t){return t.reduce((e,r)=>e+Jhr(r),0)}function B9n(t){return t.reduce((e,r)=>e+Zhr(r),0)}function z9n(t,e){if(e===void 0&&(e=J$),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);Ghr(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var U9n=[["x",["left","right"],$9n],["y",["top","bottom"],B9n]],GY=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=XY(r),o=Qhr(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of U9n)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})}},K$=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 q9n(t){let{EventTarget:e}=am(t);return t instanceof e?t:z$(t)}function sKe(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 bb;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(bb||(bb={}));function jhr(t){t.preventDefault()}function H9n(t){t.stopPropagation()}var io;(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"})(io||(io={}));var egr={start:[io.Space,io.Enter],cancel:[io.Esc],end:[io.Space,io.Enter,io.Tab]},V9n=(t,e)=>{let{currentCoordinates:r}=e;switch(t.code){case io.Right:return{...r,x:r.x+25};case io.Left:return{...r,x:r.x-25};case io.Down:return{...r,y:r.y+25};case io.Up:return{...r,y:r.y-25}}},TN=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 K$(z$(r)),this.windowListeners=new K$(am(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(bb.Resize,this.handleCancel),this.windowListeners.add(bb.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(bb.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,n=e.node.current;n&&z9n(n),r(lv)}handleKeyDown(e){if(WY(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=egr,coordinateGetter:a=V9n,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}:lv;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(e,{active:r,context:n.current,currentCoordinates:c});if(d){let f=H$(d,c),p={x:0,y:0},{scrollableAncestors:h}=n.current;for(let m of h){let g=e.code,{isTop:y,isRight:_,isLeft:w,isBottom:S,maxScroll:C,minScroll:E}=Xhr(m),P=k9n(m),T={x:Math.min(g===io.Right?P.right-P.width/2:P.right,Math.max(g===io.Right?P.left:P.left+P.width/2,d.x)),y:Math.min(g===io.Down?P.bottom-P.height/2:P.bottom,Math.max(g===io.Down?P.top:P.top+P.height/2,d.y))},I=g===io.Right&&!_||g===io.Left&&!w,N=g===io.Down&&!S||g===io.Up&&!y;if(I&&T.x!==d.x){let M=m.scrollLeft+f.x,D=g===io.Right&&M<=C.x||g===io.Left&&M>=E.x;if(D&&!f.y){m.scrollTo({left:M,behavior:s});return}D?p.x=m.scrollLeft-M:p.x=g===io.Right?m.scrollLeft-C.x:m.scrollLeft-E.x,p.x&&m.scrollBy({left:-p.x,behavior:s});break}else if(N&&T.y!==d.y){let M=m.scrollTop+f.y,D=g===io.Down&&M<=C.y||g===io.Up&&M>=E.y;if(D&&!f.x){m.scrollTo({top:M,behavior:s});return}D?p.y=m.scrollTop-M:p.y=g===io.Down?m.scrollTop-C.y:m.scrollTop-E.y,p.y&&m.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,q$(H$(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()}};TN.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=egr,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 Dhr(t){return!!(t&&"distance"in t)}function Lhr(t){return!!(t&&"delay"in t)}var JY=class{constructor(e,r,n){var o;n===void 0&&(n=q9n(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=z$(a),this.documentListeners=new K$(this.document),this.listeners=new K$(n),this.windowListeners=new K$(am(a)),this.initialCoordinates=(o=Ove(i))!=null?o:lv,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(bb.Resize,this.handleCancel),this.windowListeners.add(bb.DragStart,jhr),this.windowListeners.add(bb.VisibilityChange,this.handleCancel),this.windowListeners.add(bb.ContextMenu,jhr),this.documentListeners.add(bb.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Lhr(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Dhr(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(bb.Click,H9n,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(bb.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=Ove(e))!=null?r:lv,l=H$(o,u);if(!n&&s){if(Dhr(s)){if(s.tolerance!=null&&sKe(l,s.tolerance))return this.handleCancel();if(sKe(l,s.distance))return this.handleStart()}if(Lhr(s)&&sKe(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===io.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},W9n={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},AN=class extends JY{constructor(e){let{event:r}=e,n=z$(r.target);super(e,W9n,n)}};AN.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 K9n={move:{name:"mousemove"},end:{name:"mouseup"}},cKe;(function(t){t[t.RightClick=2]="RightClick"})(cKe||(cKe={}));var dKe=class extends JY{constructor(e){super(e,K9n,z$(e.event.target))}};dKe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===cKe.RightClick?!1:(n?.({event:r}),!0)}}];var uKe={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},fKe=class extends JY{constructor(e){super(e,uKe)}static setup(){return window.addEventListener(uKe.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(uKe.move.name,e)};function e(){}}};fKe.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 KY;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(KY||(KY={}));var Tve;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Tve||(Tve={}));function G9n(t){let{acceleration:e,activator:r=KY.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=Tve.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=Z9n({delta:d,disabled:!i}),[h,m]=Ohr(),g=(0,Re.useRef)({x:0,y:0}),y=(0,Re.useRef)({x:0,y:0}),_=(0,Re.useMemo)(()=>{switch(r){case KY.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case KY.DraggableRect:return o}},[r,o,u]),w=(0,Re.useRef)(null),S=(0,Re.useCallback)(()=>{let E=w.current;if(!E)return;let P=g.current.x*y.current.x,T=g.current.y*y.current.y;E.scrollBy(P,T)},[]),C=(0,Re.useMemo)(()=>s===Tve.TreeOrder?[...l].reverse():l,[s,l]);(0,Re.useEffect)(()=>{if(!i||!l.length||!_){m();return}for(let E of C){if(n?.(E)===!1)continue;let P=l.indexOf(E),T=c[P];if(!T)continue;let{direction:I,speed:N}=F9n(E,T,_,e,f);for(let M of["x","y"])p[M][I[M]]||(N[M]=0,I[M]=0);if(N.x>0||N.y>0){m(),w.current=E,h(S,a),g.current=N,y.current=I;return}}g.current={x:0,y:0},y.current={x:0,y:0},m()},[e,S,n,m,i,a,JSON.stringify(_),JSON.stringify(p),h,l,C,c,JSON.stringify(f)])}var J9n={x:{[pd.Backward]:!1,[pd.Forward]:!1},y:{[pd.Backward]:!1,[pd.Forward]:!1}};function Z9n(t){let{delta:e,disabled:r}=t,n=Cve(e);return BV(o=>{if(r||!n||!o)return J9n;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[pd.Backward]:o.x[pd.Backward]||i.x===-1,[pd.Forward]:o.x[pd.Forward]||i.x===1},y:{[pd.Backward]:o.y[pd.Backward]||i.y===-1,[pd.Forward]:o.y[pd.Forward]||i.y===1}}},[r,e,n])}function Y9n(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return BV(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function X9n(t,e){return(0,Re.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 ZY;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ZY||(ZY={}));var pKe;(function(t){t.Optimized="optimized"})(pKe||(pKe={}));var Fhr=new Map;function Q9n(t,e){let{dragging:r,dependencies:n,config:o}=e,[i,a]=(0,Re.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,Re.useRef)(t),d=g(),f=$V(d),p=(0,Re.useCallback)(function(y){y===void 0&&(y=[]),!f.current&&a(_=>_===null?y:_.concat(y.filter(w=>!_.includes(w))))},[f]),h=(0,Re.useRef)(null),m=BV(y=>{if(d&&!r)return Fhr;if(!y||y===Fhr||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 S=w.node.current,C=S?new GY(u(S),S):null;w.rect.current=C,C&&_.set(w.id,C)}return _}return y},[t,i,r,d,u]);return(0,Re.useEffect)(()=>{c.current=t},[t]),(0,Re.useEffect)(()=>{d||p()},[r,d]),(0,Re.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,Re.useEffect)(()=>{d||typeof s!="number"||h.current!==null||(h.current=setTimeout(()=>{p(),h.current=null},s))},[s,d,p,...n]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:i!=null};function g(){switch(l){case ZY.Always:return!1;case ZY.BeforeDragging:return r;default:return!r}}}function tgr(t,e){return BV(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function eKn(t,e){return tgr(t,e)}function tKn(t){let{callback:e,disabled:r}=t,n=Sve(e),o=(0,Re.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,Re.useEffect)(()=>()=>o?.disconnect(),[o]),o}function Ive(t){let{callback:e,disabled:r}=t,n=Sve(e),o=(0,Re.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,Re.useEffect)(()=>()=>o?.disconnect(),[o]),o}function rKn(t){return new GY(J$(t),t)}function khr(t,e,r){e===void 0&&(e=rKn);let[n,o]=(0,Re.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=tKn({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=Ive({callback:i});return yb(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function nKn(t){let e=tgr(t);return Khr(t,e)}var $hr=[];function oKn(t){let e=(0,Re.useRef)(t),r=BV(n=>t?n&&n!==$hr&&t&&e.current&&t.parentNode===e.current.parentNode?n:XY(t):$hr,[t]);return(0,Re.useEffect)(()=>{e.current=t},[t]),r}function iKn(t){let[e,r]=(0,Re.useState)(null),n=(0,Re.useRef)(t),o=(0,Re.useCallback)(i=>{let a=aKe(i.target);a&&r(s=>s?(s.set(a,lKe(a)),new Map(s)):null)},[]);return(0,Re.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(u=>{let l=aKe(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,lKe(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=aKe(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,Re.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>q$(i,a),lv):Qhr(t):lv,[t,e])}function Bhr(t,e){e===void 0&&(e=[]);let r=(0,Re.useRef)(null);return(0,Re.useEffect)(()=>{r.current=null},e),(0,Re.useEffect)(()=>{let n=t!==lv;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?H$(t,r.current):lv}function aKn(t){(0,Re.useEffect)(()=>{if(!HY)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 sKn(t,e){return(0,Re.useMemo)(()=>t.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,e)},r},{}),[t,e])}function rgr(t){return(0,Re.useMemo)(()=>t?N9n(t):null,[t])}var zhr=[];function uKn(t,e){e===void 0&&(e=J$);let[r]=t,n=rgr(r?am(r):null),[o,i]=(0,Re.useState)(zhr);function a(){i(()=>t.length?t.map(u=>Yhr(u)?n:new GY(e(u),u)):zhr)}let s=Ive({callback:a});return yb(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function lKn(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return kV(e)?e:t}function cKn(t){let{measure:e}=t,[r,n]=(0,Re.useState)(null),o=(0,Re.useCallback)(l=>{for(let{target:c}of l)if(kV(c)){n(d=>{let f=e(c);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=Ive({callback:o}),a=(0,Re.useCallback)(l=>{let c=lKn(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=VY(a);return(0,Re.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var dKn=[{sensor:AN,options:{}},{sensor:TN,options:{}}],fKn={current:{}},Eve={draggable:{measure:Nhr},droppable:{measure:Nhr,strategy:ZY.WhileDragging,frequency:pKe.Optimized},dragOverlay:{measure:J$}},G$=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}},pKn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new G$,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Pve},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Eve,measureDroppableContainers:Pve,windowRect:null,measuringScheduled:!1},mKn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Pve,draggableNodes:new Map,over:null,measureDroppableContainers:Pve},Mve=(0,Re.createContext)(mKn),ngr=(0,Re.createContext)(pKn);function hKn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new G$}}}function gKn(t,e){switch(e.type){case Ic.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Ic.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 Ic.DragEnd:case Ic.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ic.RegisterDroppable:{let{element:r}=e,{id:n}=r,o=new G$(t.droppable.containers);return o.set(n,r),{...t,droppable:{...t.droppable,containers:o}}}case Ic.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 G$(t.droppable.containers);return a.set(r,{...i,disabled:o}),{...t,droppable:{...t.droppable,containers:a}}}case Ic.UnregisterDroppable:{let{id:r,key:n}=e,o=t.droppable.containers.get(r);if(!o||n!==o.key)return t;let i=new G$(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function yKn(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,Re.useContext)(Mve),i=Cve(n),a=Cve(r?.id);return(0,Re.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!WY(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=Phr(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function bKn(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function _Kn(t){return(0,Re.useMemo)(()=>({draggable:{...Eve.draggable,...t?.draggable},droppable:{...Eve.droppable,...t?.droppable},dragOverlay:{...Eve.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function vKn(t){let{activeNode:e,measure:r,initialRect:n,config:o=!0}=t,i=(0,Re.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;yb(()=>{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=Khr(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=Ghr(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var ogr=(0,Re.createContext)({...lv,scaleX:1,scaleY:1}),PN;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(PN||(PN={}));var QY=(0,Re.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=dKn,collisionDetection:d=E9n,measuring:f,modifiers:p,...h}=e,m=(0,Re.useReducer)(gKn,void 0,hKn),[g,y]=m,[_,w]=v9n(),[S,C]=(0,Re.useState)(PN.Uninitialized),E=S===PN.Initialized,{draggable:{active:P,nodes:T,translate:I},droppable:{containers:N}}=g,M=P!=null?T.get(P):null,D=(0,Re.useRef)({initial:null,translated:null}),k=(0,Re.useMemo)(()=>{var Ts;return P!=null?{id:P,data:(Ts=M?.data)!=null?Ts:fKn,rect:D}:null},[P,M]),F=(0,Re.useRef)(null),[K,U]=(0,Re.useState)(null),[Y,ee]=(0,Re.useState)(null),L=$V(h,Object.values(h)),Q=U$("DndDescribedBy",a),z=(0,Re.useMemo)(()=>N.getEnabled(),[N]),W=_Kn(f),{droppableRects:V,measureDroppableContainers:q,measuringScheduled:H}=Q9n(z,{dragging:E,dependencies:[I.x,I.y],config:W.droppable}),G=Y9n(T,P),Z=(0,Re.useMemo)(()=>Y?Ove(Y):null,[Y]),de=xA(),pe=eKn(G,W.draggable.measure);vKn({activeNode:P!=null?T.get(P):null,config:de.layoutShiftCompensation,initialRect:pe,measure:W.draggable.measure});let ae=khr(G,W.draggable.measure,pe),Te=khr(G?G.parentElement:null),Ae=(0,Re.useRef)({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:V,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ke=N.getNodeFor((r=Ae.current.over)==null?void 0:r.id),St=cKn({measure:W.dragOverlay.measure}),Nr=(n=St.nodeRef.current)!=null?n:G,Ir=E?(o=St.rect)!=null?o:ae:null,Hn=!!(St.nodeRef.current&&St.rect),Yr=nKn(Hn?null:ae),Sr=rgr(Nr?am(Nr):null),Me=oKn(E?ke??G:null),Ge=uKn(Me),je=bKn(p,{transform:{x:I.x-Yr.x,y:I.y-Yr.y,scaleX:1,scaleY:1},activatorEvent:Y,active:k,activeNodeRect:ae,containerNodeRect:Te,draggingNodeRect:Ir,over:Ae.current.over,overlayNodeRect:St.rect,scrollableAncestors:Me,scrollableAncestorRects:Ge,windowRect:Sr}),le=Z?q$(Z,I):null,ne=iKn(Me),fe=Bhr(ne),be=Bhr(ne,[ae]),ye=q$(je,fe),ze=Ir?A9n(Ir,je):null,mr=k&&ze?d({active:k,collisionRect:ze,droppableRects:V,droppableContainers:z,pointerCoordinates:le}):null,Ti=mKe(mr,"id"),[yi,yf]=(0,Re.useState)(null),fp=Hn?je:q$(je,be),qi=P9n(fp,(i=yi?.rect)!=null?i:null,ae),md=(0,Re.useRef)(null),hd=(0,Re.useCallback)((Ts,pu)=>{let{sensor:rs,options:pp}=pu;if(F.current==null)return;let _f=T.get(F.current);if(!_f)return;let Ws=Ts.nativeEvent,um=new rs({active:F.current,activeNode:_f,event:Ws,options:pp,context:Ae,onAbort(Zn){if(!T.get(Zn))return;let{onDragAbort:hp}=L.current,xh={id:Zn};hp?.(xh),_({type:"onDragAbort",event:xh})},onPending(Zn,Qe,hp,xh){if(!T.get(Zn))return;let{onDragPending:JO}=L.current,Wn={id:Zn,constraint:Qe,initialCoordinates:hp,offset:xh};JO?.(Wn),_({type:"onDragPending",event:Wn})},onStart(Zn){let Qe=F.current;if(Qe==null)return;let hp=T.get(Qe);if(!hp)return;let{onDragStart:xh}=L.current,Xl={activatorEvent:Ws,active:{id:Qe,data:hp.data,rect:D}};(0,W$.unstable_batchedUpdates)(()=>{xh?.(Xl),C(PN.Initializing),y({type:Ic.DragStart,initialCoordinates:Zn,active:Qe}),_({type:"onDragStart",event:Xl}),U(md.current),ee(Ws)})},onMove(Zn){y({type:Ic.DragMove,coordinates:Zn})},onEnd:mp(Ic.DragEnd),onCancel:mp(Ic.DragCancel)});md.current=um;function mp(Zn){return async function(){let{active:hp,collisions:xh,over:Xl,scrollAdjustedTranslate:JO}=Ae.current,Wn=null;if(hp&&JO){let{cancelDrop:wb}=L.current;Wn={activatorEvent:Ws,active:hp,collisions:xh,delta:JO,over:Xl},Zn===Ic.DragEnd&&typeof wb=="function"&&await Promise.resolve(wb(Wn))&&(Zn=Ic.DragCancel)}F.current=null,(0,W$.unstable_batchedUpdates)(()=>{y({type:Zn}),C(PN.Uninitialized),yf(null),U(null),ee(null),md.current=null;let wb=Zn===Ic.DragEnd?"onDragEnd":"onDragCancel";if(Wn){let HV=L.current[wb];HV?.(Wn),_({type:wb,event:Wn})}})}}},[T]),bf=(0,Re.useCallback)((Ts,pu)=>(rs,pp)=>{let _f=rs.nativeEvent,Ws=T.get(pp);if(F.current!==null||!Ws||_f.dndKit||_f.defaultPrevented)return;let um={active:Ws};Ts(rs,pu.options,um)===!0&&(_f.dndKit={capturedBy:pu.sensor},F.current=pp,hd(rs,pu))},[T,hd]),Vn=X9n(c,bf);aKn(c),yb(()=>{ae&&S===PN.Initializing&&C(PN.Initialized)},[ae,S]),(0,Re.useEffect)(()=>{let{onDragMove:Ts}=L.current,{active:pu,activatorEvent:rs,collisions:pp,over:_f}=Ae.current;if(!pu||!rs)return;let Ws={active:pu,activatorEvent:rs,collisions:pp,delta:{x:ye.x,y:ye.y},over:_f};(0,W$.unstable_batchedUpdates)(()=>{Ts?.(Ws),_({type:"onDragMove",event:Ws})})},[ye.x,ye.y]),(0,Re.useEffect)(()=>{let{active:Ts,activatorEvent:pu,collisions:rs,droppableContainers:pp,scrollAdjustedTranslate:_f}=Ae.current;if(!Ts||F.current==null||!pu||!_f)return;let{onDragOver:Ws}=L.current,um=pp.get(Ti),mp=um&&um.rect.current?{id:um.id,rect:um.rect.current,data:um.data,disabled:um.disabled}:null,Zn={active:Ts,activatorEvent:pu,collisions:rs,delta:{x:_f.x,y:_f.y},over:mp};(0,W$.unstable_batchedUpdates)(()=>{yf(mp),Ws?.(Zn),_({type:"onDragOver",event:Zn})})},[Ti]),yb(()=>{Ae.current={activatorEvent:Y,active:k,activeNode:G,collisionRect:ze,collisions:mr,droppableRects:V,draggableNodes:T,draggingNode:Nr,draggingNodeRect:Ir,droppableContainers:N,over:yi,scrollableAncestors:Me,scrollAdjustedTranslate:ye},D.current={initial:Ir,translated:ze}},[k,G,mr,ze,T,Nr,Ir,V,N,yi,Me,ye]),G9n({...de,delta:I,draggingRect:ze,pointerCoordinates:le,scrollableAncestors:Me,scrollableAncestorRects:Ge});let wA=(0,Re.useMemo)(()=>({active:k,activeNode:G,activeNodeRect:ae,activatorEvent:Y,collisions:mr,containerNodeRect:Te,dragOverlay:St,draggableNodes:T,droppableContainers:N,droppableRects:V,over:yi,measureDroppableContainers:q,scrollableAncestors:Me,scrollableAncestorRects:Ge,measuringConfiguration:W,measuringScheduled:H,windowRect:Sr}),[k,G,ae,Y,mr,Te,St,T,N,V,yi,q,Me,Ge,W,H,Sr]),RN=(0,Re.useMemo)(()=>({activatorEvent:Y,activators:Vn,active:k,activeNodeRect:ae,ariaDescribedById:{draggable:Q},dispatch:y,draggableNodes:T,over:yi,measureDroppableContainers:q}),[Y,Vn,k,ae,y,Q,T,yi,q]);return Re.default.createElement(qhr.Provider,{value:w},Re.default.createElement(Mve.Provider,{value:RN},Re.default.createElement(ngr.Provider,{value:wA},Re.default.createElement(ogr.Provider,{value:qi},l)),Re.default.createElement(yKn,{disabled:s?.restoreFocus===!1})),Re.default.createElement(S9n,{...s,hiddenTextDescribedById:Q}));function xA(){let Ts=K?.autoScrollEnabled===!1,pu=typeof u=="object"?u.enabled===!1:u===!1,rs=E&&!Ts&&!pu;return typeof u=="object"?{...u,enabled:rs}:{enabled:rs}}}),wKn=(0,Re.createContext)(null),Uhr="button",xKn="Draggable";function igr(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=U$(xKn),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,Re.useContext)(Mve),{role:p=Uhr,roleDescription:h="draggable",tabIndex:m=0}=o??{},g=u?.id===e,y=(0,Re.useContext)(g?ogr:wKn),[_,w]=VY(),[S,C]=VY(),E=sKn(a,e),P=$V(r);yb(()=>(d.set(e,{id:e,key:i,node:_,activatorNode:S,data:P}),()=>{let I=d.get(e);I&&I.key===i&&d.delete(e)}),[d,e]);let T=(0,Re.useMemo)(()=>({role:p,tabIndex:m,"aria-disabled":n,"aria-pressed":g&&p===Uhr?!0:void 0,"aria-roledescription":h,"aria-describedby":c.draggable}),[n,p,m,g,h,c.draggable]);return{active:u,activatorEvent:s,activeNodeRect:l,attributes:T,isDragging:g,listeners:n?void 0:E,node:_,over:f,setNodeRef:w,setActivatorNodeRef:C,transform:y}}function agr(){return(0,Re.useContext)(ngr)}var SKn="Droppable",CKn={timeout:25};function sgr(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=U$(SKn),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,Re.useContext)(Mve),c=(0,Re.useRef)({disabled:r}),d=(0,Re.useRef)(!1),f=(0,Re.useRef)(null),p=(0,Re.useRef)(null),{disabled:h,updateMeasurementsFor:m,timeout:g}={...CKn,...o},y=$V(m??n),_=(0,Re.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(y.current)?y.current:[y.current]),p.current=null},g)},[g]),w=Ive({callback:_,disabled:h||!a}),S=(0,Re.useCallback)((T,I)=>{w&&(I&&(w.unobserve(I),d.current=!1),T&&w.observe(T))},[w]),[C,E]=VY(S),P=$V(e);return(0,Re.useEffect)(()=>{!w||!C.current||(w.disconnect(),d.current=!1,w.observe(C.current))},[C,w]),(0,Re.useEffect)(()=>(s({type:Ic.RegisterDroppable,element:{id:n,key:i,disabled:r,node:C,rect:f,data:P}}),()=>s({type:Ic.UnregisterDroppable,key:i,id:n})),[n]),(0,Re.useEffect)(()=>{r!==c.current.disabled&&(s({type:Ic.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:E}}var du=j(X());function Dve(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function OKn(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function Rve(t){return t!==null&&t>=0}function EKn(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 PKn(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}var ugr=t=>{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=Dve(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 Nve={scaleX:1,scaleY:1},eX=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,...Nve}:null}let u=TKn(i,o,r);return o>r&&o<=a?{x:0,y:-s.height-u,...Nve}:o<r&&o>=a?{x:0,y:s.height+u,...Nve}:{x:0,y:0,...Nve}};function TKn(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 lgr="Sortable",cgr=du.default.createContext({activeIndex:-1,containerId:lgr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ugr,disabled:{draggable:!1,droppable:!1}});function tX(t){let{children:e,id:r,items:n,strategy:o=ugr,disabled:i=!1}=t,{active:a,dragOverlay:s,droppableRects:u,over:l,measureDroppableContainers:c}=agr(),d=U$(lgr,r),f=s.rect!==null,p=(0,du.useMemo)(()=>n.map(E=>typeof E=="object"&&"id"in E?E.id:E),[n]),h=a!=null,m=a?p.indexOf(a.id):-1,g=l?p.indexOf(l.id):-1,y=(0,du.useRef)(p),_=!EKn(p,y.current),w=g!==-1&&m===-1||_,S=PKn(i);yb(()=>{_&&h&&c(p)},[_,p,h,c]),(0,du.useEffect)(()=>{y.current=p},[p]);let C=(0,du.useMemo)(()=>({activeIndex:m,containerId:d,disabled:S,disableTransforms:w,items:p,overIndex:g,useDragOverlay:f,sortedRects:OKn(p,u),strategy:o}),[m,d,S.draggable,S.droppable,w,p,g,u,f,o]);return du.default.createElement(cgr.Provider,{value:C},e)}var AKn=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return Dve(r,n,o).indexOf(e)},IKn=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},MKn={duration:200,easing:"ease"},dgr="transform",RKn=uv.Transition.toString({property:dgr,duration:0,easing:"linear"}),NKn={roleDescription:"sortable"};function jKn(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,du.useState)(null),s=(0,du.useRef)(r);return yb(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=J$(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,du.useEffect)(()=>{i&&a(null)},[i]),i}function rX(t){let{animateLayoutChanges:e=IKn,attributes:r,disabled:n,data:o,getNewIndex:i=AKn,id:a,strategy:s,resizeObserverConfig:u,transition:l=MKn}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:h,sortedRects:m,overIndex:g,useDragOverlay:y,strategy:_}=(0,du.useContext)(cgr),w=DKn(n,p),S=c.indexOf(a),C=(0,du.useMemo)(()=>({sortable:{containerId:d,index:S,items:c},...o}),[d,o,S,c]),E=(0,du.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:P,node:T,isOver:I,setNodeRef:N}=sgr({id:a,data:C,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...u}}),{active:M,activatorEvent:D,activeNodeRect:k,attributes:F,setNodeRef:K,listeners:U,isDragging:Y,over:ee,setActivatorNodeRef:L,transform:Q}=igr({id:a,data:C,attributes:{...NKn,...r},disabled:w.draggable}),z=Chr(N,K),W=!!M,V=W&&!h&&Rve(f)&&Rve(g),q=!y&&Y,H=q&&V?Q:null,Z=V?H??(s??_)({rects:m,activeNodeRect:k,activeIndex:f,overIndex:g,index:S}):null,de=Rve(f)&&Rve(g)?i({id:a,items:c,activeIndex:f,overIndex:g}):S,pe=M?.id,ae=(0,du.useRef)({activeId:pe,items:c,newIndex:de,containerId:d}),Te=c!==ae.current.items,Ae=e({active:M,containerId:d,isDragging:Y,isSorting:W,id:a,index:S,items:c,newIndex:ae.current.newIndex,previousItems:ae.current.items,previousContainerId:ae.current.containerId,transition:l,wasDragging:ae.current.activeId!=null}),ke=jKn({disabled:!Ae,index:S,node:T,rect:P});return(0,du.useEffect)(()=>{W&&ae.current.newIndex!==de&&(ae.current.newIndex=de),d!==ae.current.containerId&&(ae.current.containerId=d),c!==ae.current.items&&(ae.current.items=c)},[W,de,d,c]),(0,du.useEffect)(()=>{if(pe===ae.current.activeId)return;if(pe!=null&&ae.current.activeId==null){ae.current.activeId=pe;return}let Nr=setTimeout(()=>{ae.current.activeId=pe},50);return()=>clearTimeout(Nr)},[pe]),{active:M,activeIndex:f,attributes:F,data:C,rect:P,index:S,newIndex:de,items:c,isOver:I,isSorting:W,isDragging:Y,listeners:U,node:T,overIndex:g,over:ee,setNodeRef:z,setActivatorNodeRef:L,setDroppableNodeRef:N,setDraggableNodeRef:K,transform:ke??Z,transition:St()};function St(){if(ke||Te&&ae.current.newIndex===S)return RKn;if(!(q&&!WY(D)||!l)&&(W||Ae))return uv.Transition.toString({...l,property:dgr})}}function DKn(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 jve(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 LKn=[io.Down,io.Right,io.Up,io.Left],Lve=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(LKn.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 io.Down:n.top<f.top&&u.push(d);break;case io.Up:n.top>f.top&&u.push(d);break;case io.Left:n.left>f.left&&u.push(d);break;case io.Right:n.left<f.left&&u.push(d);break}});let l=Whr({active:r,collisionRect:n,droppableRects:o,droppableContainers:u,pointerCoordinates:null}),c=mKe(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,h=f?.node.current;if(h&&p&&d&&f){let g=XY(h).some((E,P)=>s[P]!==E),y=fgr(d,f),_=FKn(d,f),w=g||!y?{x:0,y:0}:{x:_?n.width-p.width:0,y:_?n.height-p.height:0},S={x:p.left,y:p.top};return w.x&&w.y?S:H$(S,w)}}}};function fgr(t,e){return!jve(t)||!jve(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function FKn(t,e){return!jve(t)||!jve(e)||!fgr(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}wn();bt();bt();u8();var Bve=require("obsidian");var La=j(X());wn();var Tg=j(X());wn();fn();Aj();Kt();fr();function KO({value:t,onChange:e,placeholder:r,disabled:n,className:o}){let[i,a]=(0,Tg.useState)(!1),s=(0,Tg.useRef)(null),u=(0,Tg.useRef)(!0);return(0,Tg.useEffect)(()=>{(async()=>{if(u.current&&t&&s.current){try{s.current.value=await _o(t)}catch(c){ie("Failed to decrypt value:"+Xn(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),Tg.default.createElement("div",{className:me("tw-relative",o)},Tg.default.createElement(mi,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:me("tw-w-full !tw-pr-7")}),Tg.default.createElement("div",{onClick:()=>!n&&a(!i),className:me("tw-absolute tw-inset-y-0 tw-right-2 tw-flex tw-items-center tw-justify-center","tw-cursor-pointer",n&&"tw-cursor-not-allowed tw-opacity-50"),role:"button","aria-label":i?"Hide password":"Show password"},i?Tg.default.createElement(y5,{className:me("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")}):Tg.default.createElement($E,{className:me("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")})))}fn();var gf=j(X());var ga=j(X(),1);function GO(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var mgr=j(X(),1);function pgr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function hKe(...t){return e=>{let r=!1,n=t.map(o=>{let i=pgr(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():pgr(t[o],null)}}}}function _A(...t){return mgr.useCallback(hKe(...t),t)}var Ps=j(X(),1);var hgr=j(X(),1),ggr=j(Ba(),1);var hf=j(X(),1);var UV=j(ut(),1),nX=hf.forwardRef((t,e)=>{let{children:r,...n}=t,o=hf.Children.toArray(r),i=o.find($Kn);if(i){let a=i.props.children,s=o.map(u=>u===i?hf.Children.count(a)>1?hf.Children.only(null):hf.isValidElement(a)?a.props.children:null:u);return(0,UV.jsx)(gKe,{...n,ref:e,children:hf.isValidElement(a)?hf.cloneElement(a,void 0,s):null})}return(0,UV.jsx)(gKe,{...n,ref:e,children:r})});nX.displayName="Slot";var gKe=hf.forwardRef((t,e)=>{let{children:r,...n}=t;if(hf.isValidElement(r)){let o=zKn(r);return hf.cloneElement(r,{...BKn(n,r.props),ref:e?hKe(e,o):o})}return hf.Children.count(r)>1?hf.Children.only(null):null});gKe.displayName="SlotClone";var kKn=({children:t})=>(0,UV.jsx)(UV.Fragment,{children:t});function $Kn(t){return hf.isValidElement(t)&&t.type===kKn}function BKn(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 zKn(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 ygr=j(ut(),1),UKn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ag=UKn.reduce((t,e)=>{let r=hgr.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?nX:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,ygr.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function bgr(t,e){t&&ggr.flushSync(()=>t.dispatchEvent(e))}var bKe=j(ut(),1),qKn="DismissableLayer",yKe="dismissableLayer.update",HKn="dismissableLayer.pointerDownOutside",VKn="dismissableLayer.focusOutside",_gr,wgr=Ps.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_Ke=Ps.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ps.useContext(wgr),[c,d]=Ps.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ps.useState({}),h=_A(e,P=>d(P)),m=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),_=c?m.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=y,C=GKn(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=JKn(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return q1(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Ps.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(_gr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),vgr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=_gr)}},[c,f,r,l]),Ps.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),vgr())},[c,l]),Ps.useEffect(()=>{let P=()=>p({});return document.addEventListener(yKe,P),()=>document.removeEventListener(yKe,P)},[]),(0,bKe.jsx)(Ag.div,{...u,ref:h,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:GO(t.onFocusCapture,E.onFocusCapture),onBlurCapture:GO(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:GO(t.onPointerDownCapture,C.onPointerDownCapture)})});_Ke.displayName=qKn;var WKn="DismissableLayerBranch",KKn=Ps.forwardRef((t,e)=>{let r=Ps.useContext(wgr),n=Ps.useRef(null),o=_A(e,n);return Ps.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,bKe.jsx)(Ag.div,{...t,ref:o})});KKn.displayName=WKn;function GKn(t,e=globalThis?.document){let r=un(t),n=Ps.useRef(!1),o=Ps.useRef(()=>{});return Ps.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){xgr(HKn,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 JKn(t,e=globalThis?.document){let r=un(t),n=Ps.useRef(!1);return Ps.useEffect(()=>{let o=i=>{i.target&&!n.current&&xgr(VKn,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 vgr(){let t=new CustomEvent(yKe);document.dispatchEvent(t)}function xgr(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?bgr(o,i):o.dispatchEvent(i)}var _b=j(X(),1);var Pgr=j(ut(),1),vKe="focusScope.autoFocusOnMount",wKe="focusScope.autoFocusOnUnmount",Sgr={bubbles:!1,cancelable:!0},ZKn="FocusScope",xKe=_b.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=_b.useState(null),l=un(o),c=un(i),d=_b.useRef(null),f=_A(e,m=>u(m)),p=_b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_b.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:IN(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||IN(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let T of E)T.removedNodes.length>0&&IN(s)};var m=_,g=w,y=S;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(S);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),_b.useEffect(()=>{if(s){Ogr.add(p);let m=document.activeElement;if(!s.contains(m)){let y=new CustomEvent(vKe,Sgr);s.addEventListener(vKe,l),s.dispatchEvent(y),y.defaultPrevented||(YKn(rGn(Tgr(s)),{select:!0}),document.activeElement===m&&IN(s))}return()=>{s.removeEventListener(vKe,l),setTimeout(()=>{let y=new CustomEvent(wKe,Sgr);s.addEventListener(wKe,c),s.dispatchEvent(y),y.defaultPrevented||IN(m??document.body,{select:!0}),s.removeEventListener(wKe,c),Ogr.remove(p)},0)}}},[s,l,c,p]);let h=_b.useCallback(m=>{if(!r&&!n||p.paused)return;let g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){let _=m.currentTarget,[w,S]=XKn(_);w&&S?!m.shiftKey&&y===S?(m.preventDefault(),r&&IN(w,{select:!0})):m.shiftKey&&y===w&&(m.preventDefault(),r&&IN(S,{select:!0})):y===_&&m.preventDefault()}},[r,n,p.paused]);return(0,Pgr.jsx)(Ag.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});xKe.displayName=ZKn;function YKn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(IN(n,{select:e}),document.activeElement!==r)return}function XKn(t){let e=Tgr(t),r=Cgr(e,t),n=Cgr(e.reverse(),t);return[r,n]}function Tgr(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 Cgr(t,e){for(let r of t)if(!QKn(r,{upTo:e}))return r}function QKn(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 eGn(t){return t instanceof HTMLInputElement&&"select"in t}function IN(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&eGn(t)&&e&&t.select()}}var Ogr=tGn();function tGn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=Egr(t,e),t.unshift(e)},remove(e){t=Egr(t,e),t[0]?.resume()}}}function Egr(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function rGn(t){return t.filter(e=>e.tagName!=="A")}var Fve=j(X(),1),Agr=j(Ba(),1);var Igr=j(ut(),1),nGn="Portal",SKe=Fve.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Fve.useState(!1);yo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Agr.default.createPortal((0,Igr.jsx)(Ag.div,{...n,ref:e}),a):null});SKe.displayName=nGn;var ra=j(ut(),1),CKe="Dialog",[Mgr,CXi]=Xa(CKe),[oGn,cv]=Mgr(CKe),Rgr=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=ga.useRef(null),u=ga.useRef(null),[l=!1,c]=Qp({prop:n,defaultProp:o,onChange:i});return(0,ra.jsx)(oGn,{scope:e,triggerRef:s,contentRef:u,contentId:Wl(),titleId:Wl(),descriptionId:Wl(),open:l,onOpenChange:c,onOpenToggle:ga.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};Rgr.displayName=CKe;var Ngr="DialogTrigger",jgr=ga.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=cv(Ngr,r),i=_A(e,o.triggerRef);return(0,ra.jsx)(Ag.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":PKe(o.open),...n,ref:i,onClick:GO(t.onClick,o.onOpenToggle)})});jgr.displayName=Ngr;var OKe="DialogPortal",[iGn,Dgr]=Mgr(OKe,{forceMount:void 0}),Lgr=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=cv(OKe,e);return(0,ra.jsx)(iGn,{scope:e,forceMount:r,children:ga.Children.map(n,a=>(0,ra.jsx)(rf,{present:r||i.open,children:(0,ra.jsx)(SKe,{asChild:!0,container:o,children:a})}))})};Lgr.displayName=OKe;var kve="DialogOverlay",Fgr=ga.forwardRef((t,e)=>{let r=Dgr(kve,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=cv(kve,t.__scopeDialog);return i.modal?(0,ra.jsx)(rf,{present:n||i.open,children:(0,ra.jsx)(aGn,{...o,ref:e})}):null});Fgr.displayName=kve;var aGn=ga.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=cv(kve,r);return(0,ra.jsx)(jY,{as:nX,allowPinchZoom:!0,shards:[o.contentRef],children:(0,ra.jsx)(Ag.div,{"data-state":PKe(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),Z$="DialogContent",kgr=ga.forwardRef((t,e)=>{let r=Dgr(Z$,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=cv(Z$,t.__scopeDialog);return(0,ra.jsx)(rf,{present:n||i.open,children:i.modal?(0,ra.jsx)(sGn,{...o,ref:e}):(0,ra.jsx)(uGn,{...o,ref:e})})});kgr.displayName=Z$;var sGn=ga.forwardRef((t,e)=>{let r=cv(Z$,t.__scopeDialog),n=ga.useRef(null),o=_A(e,r.contentRef,n);return ga.useEffect(()=>{let i=n.current;if(i)return nN(i)},[]),(0,ra.jsx)($gr,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:GO(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:GO(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:GO(t.onFocusOutside,i=>i.preventDefault())})}),uGn=ga.forwardRef((t,e)=>{let r=cv(Z$,t.__scopeDialog),n=ga.useRef(!1),o=ga.useRef(!1);return(0,ra.jsx)($gr,{...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()}})}),$gr=ga.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=cv(Z$,r),u=ga.useRef(null),l=_A(e,u);return H1(),(0,ra.jsxs)(ra.Fragment,{children:[(0,ra.jsx)(xKe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,ra.jsx)(_Ke,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":PKe(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,ra.jsxs)(ra.Fragment,{children:[(0,ra.jsx)(lGn,{titleId:s.titleId}),(0,ra.jsx)(dGn,{contentRef:u,descriptionId:s.descriptionId})]})]})}),EKe="DialogTitle",Bgr=ga.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=cv(EKe,r);return(0,ra.jsx)(Ag.h2,{id:o.titleId,...n,ref:e})});Bgr.displayName=EKe;var zgr="DialogDescription",Ugr=ga.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=cv(zgr,r);return(0,ra.jsx)(Ag.p,{id:o.descriptionId,...n,ref:e})});Ugr.displayName=zgr;var qgr="DialogClose",Hgr=ga.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=cv(qgr,r);return(0,ra.jsx)(Ag.button,{type:"button",...n,ref:e,onClick:GO(t.onClick,()=>o.onOpenChange(!1))})});Hgr.displayName=qgr;function PKe(t){return t?"open":"closed"}var Vgr="DialogTitleWarning",[OXi,Wgr]=Wor(Vgr,{contentName:Z$,titleName:EKe,docsSlug:"dialog"}),lGn=({titleId:t})=>{let e=Wgr(Vgr),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 ga.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},cGn="DialogDescriptionWarning",dGn=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Wgr(cGn).contentName}}.`;return ga.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},Kgr=Rgr,Ggr=jgr,Jgr=Lgr,TKe=Fgr,AKe=kgr,IKe=Bgr,MKe=Ugr,Zgr=Hgr;fn();wn();var $ve=Kgr,Ygr=Ggr,pGn=Jgr;var Xgr=gf.forwardRef(({className:t,...e},r)=>gf.createElement(TKe,{ref:r,className:me("tw-fixed tw-inset-0 tw-z-modal data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0","tw-bg-overlay/50",t),...e}));Xgr.displayName=TKe.displayName;var oX=gf.forwardRef(({className:t,children:e,container:r,...n},o)=>gf.createElement(pGn,{container:r},gf.createElement(Xgr,null),gf.createElement(AKe,{ref:o,className:me("tw-fixed tw-left-1/2 tw-top-1/2 tw-z-modal tw-grid tw-w-full tw-max-w-lg -tw-translate-x-1/2 -tw-translate-y-1/2 tw-gap-4 tw-border tw-bg-primary tw-p-6 tw-shadow-lg tw-duration-200 data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[state=closed]:tw-slide-out-to-left-1/2 data-[state=closed]:tw-slide-out-to-top-[48%] data-[state=open]:tw-slide-in-from-left-1/2 data-[state=open]:tw-slide-in-from-top-[48%] sm:tw-rounded-lg",t),...n},e,gf.createElement(Zgr,{className:"clickable-icon tw-absolute tw-right-4 tw-top-4 tw-border-none tw-bg-transparent tw-text-faint tw-outline-none hover:tw-bg-transparent hover:tw-bg-opacity-100 hover:tw-text-normal focus-visible:tw-text-normal focus-visible:tw-outline-none focus-visible:tw-ring-0"},gf.createElement(bi,{className:"tw-size-4"}),gf.createElement("span",{className:"tw-sr-only"},"Close")))));oX.displayName=AKe.displayName;var iX=({className:t,...e})=>gf.createElement("div",{className:me("tw-flex tw-flex-col tw-space-y-0.5 tw-text-center sm:tw-text-left",t),...e});iX.displayName="DialogHeader";var mGn=({className:t,...e})=>gf.createElement("div",{className:me("tw-flex tw-flex-col-reverse sm:tw-flex-row sm:tw-justify-end sm:tw-space-x-2",t),...e});mGn.displayName="DialogFooter";var aX=gf.forwardRef(({className:t,...e},r)=>gf.createElement(IKe,{ref:r,className:me("tw-mt-0 tw-text-lg tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));aX.displayName=IKe.displayName;var sX=gf.forwardRef(({className:t,...e},r)=>gf.createElement(MKe,{ref:r,className:me("tw-text-sm tw-text-muted",t),...e}));sX.displayName=MKe.displayName;fr();function Ur(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=FV(),a="onChange"in t?t.onChange:void 0,s=(0,La.useMemo)(()=>{if(a)return vee(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return La.default.createElement(mi,{type:t.type,defaultValue:t.value,onChange:l=>{s?.(l.target.value)},placeholder:t.placeholder,disabled:o,className:"tw-w-full sm:tw-w-[200px]"});case"password":return La.default.createElement(KO,{value:t.value!==void 0?String(t.value):void 0,onChange:l=>{s?.(l)},placeholder:t.placeholder,disabled:o,className:"tw-w-full sm:tw-w-[200px]"});case"textarea":return La.default.createElement(W_,{defaultValue:t.value,onChange:l=>{s?.(l.target.value)},placeholder:t.placeholder,rows:t.rows||3,disabled:o,className:"tw-min-h-[80px] tw-w-full sm:tw-w-[300px]"});case"switch":return La.default.createElement(iV,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return La.default.createElement("div",{className:"tw-group tw-relative tw-w-full sm:tw-w-[200px]"},La.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:me("tw-w-full tw-appearance-none","tw-flex tw-h-9 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-dropdown tw-px-3 tw-py-1 tw-pr-8","tw-text-sm !tw-shadow tw-transition-colors","focus:tw-outline-none focus:tw-ring-1 focus:tw-ring-ring","disabled:tw-cursor-not-allowed disabled:tw-opacity-50","hover:tw-bg-interactive-hover hover:tw-text-normal")},t.placeholder&&La.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>La.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),La.default.createElement("div",{className:me("tw-pointer-events-none tw-absolute tw-inset-y-0 tw-right-0 tw-flex tw-items-center tw-pr-2","tw-transition-colors group-hover:[&>svg]:tw-text-normal",o&&"tw-opacity-50")},La.default.createElement(Li,{className:"tw-size-4"})));case"slider":return La.default.createElement(IY,{value:t.value||0,onChange:t.onChange,min:t.min,max:t.max,step:t.step,suffix:t.suffix,disabled:o,className:"tw-w-full sm:tw-w-[300px]"});case"dialog":return La.default.createElement($ve,null,La.default.createElement(Ygr,{asChild:!0},t.trigger),La.default.createElement(oX,{container:i},(t.dialogTitle||t.dialogDescription)&&La.default.createElement(iX,null,t.dialogTitle&&La.default.createElement(aX,null,t.dialogTitle),t.dialogDescription&&La.default.createElement(sX,null,t.dialogDescription)),t.children));case"custom":return t.children}};return La.default.createElement("div",{className:me("tw-flex tw-flex-col tw-items-start tw-justify-between tw-gap-4 tw-py-4 sm:tw-flex-row sm:tw-items-center","tw-w-full",n)},La.default.createElement("div",{className:"tw-w-full tw-space-y-1.5 sm:tw-w-[300px]"},La.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-leading-none"},e),r&&La.default.createElement("div",{className:"tw-text-xs tw-text-muted"},r)),La.default.createElement("div",{className:"tw-w-full tw-flex-1 sm:tw-flex sm:tw-justify-end"},u()))}var hGn=({command:t,commands:e,onUpdate:r,onRemove:n,onCopy:o})=>{let{attributes:i,listeners:a,setNodeRef:s,transform:u,transition:l,isDragging:c}=rX({id:t.title}),d={transform:uv.Transform.toString(u),transition:l},f=()=>{n(t)};return Lt.default.createElement(EN,{ref:s,style:d,className:me("tw-transition-colors",c&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50")},Lt.default.createElement(dp,{className:"tw-w-10"},Lt.default.createElement("div",{...i,...a,className:"tw-flex tw-cursor-grab tw-items-center tw-justify-center"},Lt.default.createElement(Bv,{className:"tw-size-4"}))),Lt.default.createElement(dp,null,t.title),Lt.default.createElement(dp,{className:"tw-text-center"},Lt.default.createElement(Cc,{checked:t.showInContextMenu,onCheckedChange:p=>{r({...t,showInContextMenu:p===!0},t.title)},className:"tw-mx-auto"})),Lt.default.createElement(dp,{className:"tw-text-center"},Lt.default.createElement(Cc,{checked:t.showInSlashMenu,onCheckedChange:p=>r({...t,showInSlashMenu:p===!0},t.title),className:"tw-mx-auto"})),Lt.default.createElement(dp,{className:"tw-text-center"},Lt.default.createElement("div",{className:"tw-flex tw-justify-center tw-space-x-1"},Lt.default.createElement(he,{variant:"ghost",size:"icon",onClick:()=>{new o$(app,e,t,async h=>{await r(h,t.title)}).open()}},Lt.default.createElement(Uv,{className:"tw-size-4"})),Lt.default.createElement(he,{variant:"ghost",size:"icon",onClick:()=>o(t),title:"Copy command"},Lt.default.createElement($h,{className:"tw-size-4"})),Lt.default.createElement(he,{variant:"ghost",size:"icon",onClick:()=>{new Ec(app,f,`Are you sure you want to delete the command "${t.title}"? This will permanently remove the command file and cannot be undone.`,"Delete Command","Delete","Cancel").open()}},Lt.default.createElement(zh,{className:"tw-size-4"})))))},Qgr=()=>{let t=uir(),e=(0,Lt.useMemo)(()=>zZ([...t]),[t]),r=_n(),n=Ave(zV(AN,{activationConstraint:{distance:8}}),zV(TN,{coordinateGetter:Lve})),o=async(l,c)=>{await Oc.getInstance().updateCommand(l,c)},i=async l=>{await Oc.getInstance().createCommand(l)},a=async l=>{try{await Oc.getInstance().deleteCommand(l),new Bve.Notice(`Command "${l.title}" deleted successfully!`)}catch(c){throw console.error("Failed to delete command:",c),new Bve.Notice("Failed to delete command. Please try again."),c}},s=async l=>{try{let c=cir(l.title,e),d={...l,title:c};await Oc.getInstance().createCommand(d,{autoOrder:!1})}catch(c){console.error("Failed to copy command:",c),new Bve.Notice("Failed to copy command. Please try again.")}},u=async l=>{let{active:c,over:d}=l;if(!d||c.id===d.id)return;let f=e.findIndex(g=>g.title===c.id),p=e.findIndex(g=>g.title===d.id);if(f===-1||p===-1)return;let h=[...e],[m]=h.splice(f,1);h.splice(p,0,m),await Oc.getInstance().reorderCommands(h)};return Lt.default.createElement("div",{className:"tw-space-y-4"},Lt.default.createElement("section",null,Lt.default.createElement("div",{className:"tw-mb-4 tw-flex tw-flex-col tw-gap-2"},Lt.default.createElement("div",{className:"tw-text-xl tw-font-bold"},"Custom Commands"),Lt.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Custom commands are preset prompts that you can trigger in the editor by right-clicking and selecting them from the context menu or by using a ",Lt.default.createElement("code",null,"/")," command in the chat to load them into your chat input.")),Lt.default.createElement(Ur,{type:"text",title:"Custom Prompts Folder Name",description:"Folder where custom prompts are stored",value:r.customPromptsFolder,onChange:l=>{ot("customPromptsFolder",l),bbe()},placeholder:"copilot-custom-prompts"}),Lt.default.createElement(Ur,{type:"switch",title:"Custom Prompt Templating",description:"Process variables like {activenote}, {foldername}, or {#tag} in prompts. Disable for raw prompts.",checked:r.enableCustomPromptTemplating,onCheckedChange:l=>{ot("enableCustomPromptTemplating",l)}}),Lt.default.createElement(Ur,{type:"select",title:"Custom Prompts Sort Strategy",description:"Sort order for slash command menu prompts",value:r.promptSortStrategy,onChange:l=>ot("promptSortStrategy",l),options:[{label:"Recency",value:"timestamp"},{label:"Alphabetical",value:"alphabetical"},{label:"Manual",value:"manual"}]}),Lt.default.createElement("div",{className:"tw-mb-4 tw-flex tw-items-start tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-4 tw-text-muted"},Lt.default.createElement(zE,{className:"tw-size-5"})," ",Lt.default.createElement("div",null,"Commands are automatically loaded from .md files in your custom prompts folder"," ",Lt.default.createElement("strong",null,r.customPromptsFolder),". Modifying the files will also update the command settings.")),Lt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Lt.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-between"},Lt.default.createElement("div",null,Lt.default.createElement(he,{variant:"secondary",onClick:()=>new Ec(app,nKe,"This will add default commands to your custom prompts folder. Do you want to continue?","Generate Default Commands").open()},"Generate Default Commands")),Lt.default.createElement(he,{variant:"default",className:"tw-gap-2",onClick:()=>{let l={...kO};new o$(app,e,l,async d=>{await i(d)}).open()}},Lt.default.createElement(Bh,{className:"tw-size-4"}),"Add Command")),Lt.default.createElement(QY,{sensors:n,collisionDetection:YY,onDragEnd:u},Lt.default.createElement(zY,null,Lt.default.createElement(UY,null,Lt.default.createElement(EN,null,Lt.default.createElement(im,{className:"tw-w-10"}),Lt.default.createElement(im,null,"Name"),Lt.default.createElement(im,{className:"tw-w-24 tw-text-center"},Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"In Menu",Lt.default.createElement(No,null,Lt.default.createElement(Ot,null,Lt.default.createElement(Et,{asChild:!0},Lt.default.createElement(zv,{className:"tw-size-4"})),Lt.default.createElement(xt,{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available in the context menu when you right-click in the editor."))))),Lt.default.createElement(im,{className:"tw-w-28 tw-text-center"},Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"Slash Cmd",Lt.default.createElement(No,null,Lt.default.createElement(Ot,null,Lt.default.createElement(Et,{asChild:!0},Lt.default.createElement(zv,{className:"tw-size-4"})),Lt.default.createElement(xt,{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available as a slash command in the chat."))))),Lt.default.createElement(im,{className:"tw-w-32 tw-text-center"},"Actions"))),Lt.default.createElement(tX,{items:e.map(l=>l.title),strategy:eX},Lt.default.createElement(qY,null,e.length===0?Lt.default.createElement(EN,null,Lt.default.createElement(dp,{colSpan:5,className:"tw-py-8 tw-text-center tw-text-muted"},"No custom prompt files found.")):e.map(l=>Lt.default.createElement(hGn,{key:l.title,command:l,commands:e,onUpdate:o,onRemove:a,onCopy:s})))))))))};fn();var ao=j(X());bt();var Y$=j(X()),eyr=()=>{let t=_n();return Y$.default.createElement("div",{className:"tw-space-y-4"},Y$.default.createElement("section",null,Y$.default.createElement(Ur,{type:"textarea",title:"User System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!",value:t.userSystemPrompt,onChange:e=>ot("userSystemPrompt",e),placeholder:"Enter your system prompt here..."}),Y$.default.createElement("div",{className:"tw-space-y-4"},Y$.default.createElement(Ur,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:e=>{ot("enableEncryption",e)}}),Y$.default.createElement(Ur,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:e=>{ot("debug",e)}}))))};oc();vo();nr();wn();oy();bt();var Yl=j(X()),tyr=require("obsidian"),ryr=j(Lc());vo();oy();bt();fn();function gGn({onConfirm:t,onCancel:e}){let r=oe();return Yl.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Yl.default.createElement("div",null,Yl.default.createElement("p",null,"Thanks for purchasing ",Yl.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!"),Yl.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),Yl.default.createElement("ul",{className:"tw-pl-4"},Yl.default.createElement("li",null,"Default mode: ",Yl.default.createElement("b",{className:"tw-text-accent"},"Copilot Plus")),Yl.default.createElement("li",null,"Chat model: ",Yl.default.createElement("b",{className:"tw-text-accent"},oze)),Yl.default.createElement("li",null,Yl.default.createElement("div",null,"Embedding model:"," ",Yl.default.createElement("b",{className:"tw-text-accent"},ize)),r.embeddingModelKey!==aze&&Yl.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-warning"},Yl.default.createElement(jp,{className:"tw-size-4"})," It will rebuild your embeddings for the entire vault")))),Yl.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},Yl.default.createElement(he,{variant:"ghost",onClick:e},"Apply Later"),Yl.default.createElement(he,{variant:"default",onClick:t},"Apply Now")))}var zve=class extends tyr.Modal{constructor(e){super(e),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:e}=this;this.root=(0,ryr.createRoot)(e);let r=()=>{z3t(),this.close()},n=()=>{this.close()};this.root.render(Yl.default.createElement(gGn,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};vo();nr();oy();bt();fn();var fu=j(X());function nyr(){let t=_n(),[e,r]=(0,fu.useState)(null),[n,o]=(0,fu.useState)(!1),i=l4(),[a,s]=(0,fu.useState)(t.plusLicenseKey);return(0,fu.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),fu.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4 tw-rounded-lg tw-bg-secondary tw-p-4"},fu.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-text-xl tw-font-bold"},fu.default.createElement("span",null,"Copilot Plus"),i&&fu.default.createElement(up,{variant:"outline",className:"tw-text-success"},"Active")),fu.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-text-sm tw-text-muted"},fu.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."),fu.default.createElement("div",null,"Copilot Plus is evolving fast, with new features and improvements rolling out regularly. Join now to secure the lowest price and get early access!")),fu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},fu.default.createElement(KO,{className:"tw-w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),fu.default.createElement(he,{disabled:n,onClick:async()=>{ot("plusLicenseKey",a),o(!0);let u=await sO();o(!1),u?(r(null),new zve(app).open()):r("Invalid license key")},className:"tw-min-w-20"},n?fu.default.createElement(tu,{className:"tw-size-4 tw-animate-spin"}):"Apply"),fu.default.createElement(he,{variant:"secondary",onClick:()=>tD(CE.SETTINGS)},"Join Now ",fu.default.createElement(Yj,{className:"tw-size-4"}))),fu.default.createElement("div",{className:"tw-text-error"},e))}fr();fn();var qV=require("obsidian"),st=j(X());vo();nr();Aj();lR();Kt();bt();nr();var yGn={openai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"openai"}))||[],google:t=>t.models?.map(e=>{let r=e.name.split("models/")?.[1];return{id:r,name:r,provider:"google"}})||[],anthropic:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"anthropic"}))||[],mistralai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"mistralai"}))||[],cohereai:t=>t.models?.map(e=>({id:e.name,name:e.name,provider:"cohereai"}))||[],deepseek:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"deepseek"}))||[],groq:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"groq"}))||[],xai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"xai"}))||[],openrouterai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"openrouterai"}))||[]},bGn=t=>e=>e.data&&Array.isArray(e.data)?e.data.map(r=>({id:r.id||r.name||String(Math.random()),name:r.name||r.id||r.display_name||"Unknown Model",provider:t})):e.models&&Array.isArray(e.models)?e.models.map(r=>({id:r.id||r.name||String(Math.random()),name:r.name||r.displayName||r.id||"Unknown Model",provider:t})):Array.isArray(e)?e.map(r=>({id:r.id||r.name||String(Math.random()),name:r.name||r.id||"Unknown Model",provider:t})):[],_Gn=t=>yGn[t]||bGn(t),oyr=(t,e)=>{let r=_Gn(t);try{return r(e)}catch(n){return console.error(`Error parsing ${t} model data:`,n),[]}};fr();fn();var MN=require("obsidian"),Rr=j(X()),iyr=j(Lc());function vGn({onClose:t}){let e=_n(),[r,n]=(0,Rr.useState)(null),[o,i]=(0,Rr.useState)({}),[a,s]=(0,Rr.useState)(null),[u,l]=(0,Rr.useState)(null),[c,d]=(0,Rr.useState)(null),[f,p]=(0,Rr.useState)(!1);(0,Rr.useEffect)(()=>{n(null),d(null)},[]);let h=w=>{let S=SE[w];return e[S]??""},m=XSe().map(w=>{let S=w,C=h(S);return{provider:S,apiKey:C}}),g=(w,S)=>{h(w)!==S&&(ot(SE[w],S),i(E=>({...E,[w]:void 0})),l(E=>E===w?null:E))},y=async(w,S)=>{s(w),l(null);try{S=await _o(S);let C=wE(w).listModelURL,E={Authorization:`Bearer ${S}`};w==="google"?(C+=`?key=${S}`,E={}):w==="anthropic"&&(E={"x-api-key":S,"anthropic-version":"2023-06-01"});let P=async M=>{let D=new AbortController,k=setTimeout(()=>D.abort(),3e3);try{let F=await(M?yu:fetch)(C,{headers:E,signal:D.signal,method:"GET"});if(!F.ok){let K=Xn(await F.json());throw ie(K),new Error(`Failed to fetch models: ${F.statusText}
detail: `+K)}return F}finally{clearTimeout(k)}},T;try{T=await P(!1)}catch(M){console.log("First fetch attempt failed, trying with safeFetch...");try{T=await P(!0)}catch(D){let k=`
without CORS Error: `+Xn(M)+`
with CORS Error: `+Xn(D);throw new Error(k)}}let I=await T.json(),N=oyr(w,I);i(M=>({...M,[w]:N})),s(null)}catch(C){console.error(`Error fetching models for ${w}:`,C),l(w),s(null),new MN.Notice(`Failed to load models for ${Ap(w)}: ${Xn(C)}`,5e3)}},_=async()=>{if(!c){new MN.Notice("Please select a model first");return}p(!0);try{let w=h(c.provider),S={name:c.name,provider:c.provider,apiKey:w,enabled:!0};if(await Hd.instance.getCurrentChainManager().chatModelManager.ping(S),e.activeModels.find(E=>E.name===c.name&&E.provider===c.provider))new MN.Notice(`Model ${c.name} verified successfully! It already exists in your models list.`);else{let E=[...e.activeModels,S];ot("activeModels",E),new MN.Notice(`Model ${c.name} verified successfully and added to your models list!`)}}catch(w){console.error("Model verification failed:",w),new MN.Notice("Model verification failed: "+Xn(w),1e4)}finally{p(!1)}};return Rr.default.createElement("div",{className:"tw-max-h-[600px] tw-overflow-y-auto tw-p-4 sm:tw-max-w-[500px]"},Rr.default.createElement("div",{className:"tw-mb-4"},Rr.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"AI Provider Settings"),Rr.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Configure your AI providers by adding their API keys.")),Rr.default.createElement("div",{className:"tw-space-y-6 tw-py-4"},Rr.default.createElement("div",{className:"tw-space-y-4"},m.map(w=>Rr.default.createElement(Rr.default.Fragment,{key:w.provider},Rr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Rr.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},Rr.default.createElement("div",{className:"tw-truncate"},Ap(w.provider))),Rr.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},Rr.default.createElement("div",{className:"tw-flex-1"},Rr.default.createElement(KO,{className:"tw-max-w-full",value:w.apiKey,onChange:S=>g(w.provider,S)})),Rr.default.createElement("div",{className:""},Rr.default.createElement(he,{onClick:()=>{let S=r===w.provider?null:w.provider;n(S),S&&w.apiKey&&o[w.provider]===void 0&&a!==w.provider&&u!==w.provider&&y(w.provider,w.apiKey)},disabled:!w.apiKey,variant:"secondary",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-2 tw-whitespace-nowrap tw-px-4 tw-py-2"},"Add Model",r===w.provider?Rr.default.createElement(zb,{className:"tw-ml-1 tw-size-4"}):Rr.default.createElement(Li,{className:"tw-ml-1 tw-size-4"})))),Rr.default.createElement("div",null,wE(w.provider).keyManagementURL&&Rr.default.createElement("a",{href:wE(w.provider).keyManagementURL,target:"_blank",rel:"noopener noreferrer",className:"tw-text-[10px] tw-text-accent hover:tw-text-accent-hover sm:tw-text-xs"},"Get ",Ap(w.provider)," Key"))),Rr.default.createElement(nv,{open:r===w.provider,className:"tw-mt-2"},Rr.default.createElement(ov,{className:"tw-rounded-md tw-p-3"},Rr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Rr.default.createElement(Jn,{label:"Model",description:"Add the currently selected model to model List. After adding, please check the Model Tab."},Rr.default.createElement("div",null,Rr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Rr.default.createElement("div",{className:"tw-flex-1"},Rr.default.createElement(Z_e,{options:o[w.provider]?.sort((S,C)=>S.name.localeCompare(C.name)).map(S=>({label:S.name,value:S.id}))||[],onChange:S=>{let C=S.target.value,E=o[w.provider]?.find(P=>P.id===C);E&&d({id:E.id,name:E.name,provider:w.provider})},onClick:()=>{w.apiKey&&o[w.provider]===void 0&&a!==w.provider&&u!==w.provider&&y(w.provider,w.apiKey)},value:c?.provider===w.provider?c.id:"",placeholder:"Select Model",disabled:!w.apiKey||a===w.provider||u===w.provider&&o[w.provider]!==null})),Rr.default.createElement("div",{className:"tw-w-[72px]"},Rr.default.createElement(he,{onClick:_,disabled:!c||c.provider!==w.provider||f,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},f?Rr.default.createElement(tu,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Add"))),Rr.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},a===w.provider&&Rr.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),u===w.provider&&Rr.default.createElement("div",{className:"tw-p-1 tw-text-error"},"Failed to load models.",o[w.provider]===null&&" Check API Key or network."),o[w.provider]&&o[w.provider].length===0&&Rr.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"No models available for this provider."),o[w.provider]===void 0&&u!==w.provider&&a!==w.provider&&Rr.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Click to load models or expand to try again if API key was changed."))))))))))),Rr.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end"},Rr.default.createElement(he,{onClick:t},"Close")))}var Uve=class extends MN.Modal{constructor(e){super(e)}onOpen(){let{contentEl:e}=this;this.root=(0,iyr.createRoot)(e),this.root.render(Rr.default.createElement(vGn,{onClose:()=>this.close()}))}onClose(){this.root.unmount()}};var xGn={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus",project:"Projects (alpha)"},ayr=()=>{let t=_n(),[e,r]=(0,st.useState)(!1),[n,o]=(0,st.useState)(t.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),i=()=>{r(!0);try{let u=n||"{$date}_{$time}__{$topic}",c=["{$date}","{$time}","{$topic}"].filter(g=>!u.includes(g));if(c.length>0){new qV.Notice(`Error: Missing required variables: ${c.join(", ")}`,4e3);return}let d=/[\\/:*?"<>|]/,f=u.replace(/\{\$date}/g,"").replace(/\{\$time}/g,"").replace(/\{\$topic}/g,"");if(d.test(f)){new qV.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:p}=Qs(new Date),m=u.replace("{$topic}","test topic name".slice(0,100).replace(/\s+/g,"_")).replace("{$date}",p.split("_")[0]).replace("{$time}",p.split("_")[1]);ot("defaultConversationNoteName",u),o(u),new qV.Notice(`Format applied successfully! Example: ${m}`,4e3)}catch(u){new qV.Notice(`Error applying format: ${u.message}`,4e3)}finally{r(!1)}},a=!!t.activeModels.find(u=>u.enabled&&en(u)===t.defaultModelKey),s=t.activeModels.filter(u=>u.enabled).map(u=>({label:BH(u),value:en(u)}));return st.default.createElement("div",{className:"tw-space-y-4"},st.default.createElement(nyr,null),st.default.createElement("section",null,st.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"General"),st.default.createElement("div",{className:"tw-space-y-4"},st.default.createElement("div",{className:"tw-space-y-4"},st.default.createElement(Ur,{type:"custom",title:"API Keys",description:st.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},st.default.createElement("span",{className:"tw-leading-none"},"Configure API keys for different AI providers"),st.default.createElement(No,{delayDuration:0},st.default.createElement(Ot,null,st.default.createElement(Et,{asChild:!0},st.default.createElement(Fi,{className:"tw-size-4"})),st.default.createElement(xt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},st.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"API key required for chat and QA features"),st.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"To enable chat and QA functionality, please provide an API key from your selected provider.")))))},st.default.createElement(he,{onClick:()=>{new Uve(app).open()},variant:"secondary",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-2 sm:tw-w-auto sm:tw-justify-start"},"Set Keys",st.default.createElement(E5,{className:"tw-size-4"})))),st.default.createElement(Ur,{type:"select",title:"Default Chat Model",description:st.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},st.default.createElement("span",{className:"tw-leading-none"},"Select the Chat model to use"),st.default.createElement(No,{delayDuration:0},st.default.createElement(Ot,null,st.default.createElement(Et,{asChild:!0},st.default.createElement(Fi,{className:"tw-size-4"})),st.default.createElement(xt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},st.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Default model is OpenRouter Gemini 2.5 Flash"),st.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"Set your OpenRouter API key in 'API keys' to use this model, or select a different model from another provider."))))),value:a?t.defaultModelKey:"Select Model",onChange:u=>{let l=t.activeModels.find(f=>f.enabled&&en(f)===u);if(!l)return;let{hasApiKey:c,errorNotice:d}=QB(l,t);if(!c&&d){new qV.Notice(d);return}ot("defaultModelKey",u)},options:a?s:[{label:"Select Model",value:"Select Model"},...s],placeholder:"Model"}),st.default.createElement(Ur,{type:"select",title:"Default Mode",description:st.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},st.default.createElement("span",{className:"tw-leading-none"},"Select the default chat mode"),st.default.createElement(No,{delayDuration:0},st.default.createElement(Ot,null,st.default.createElement(Et,{asChild:!0},st.default.createElement(Fi,{className:"tw-size-4"})),st.default.createElement(xt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},st.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},st.default.createElement("li",null,st.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",st.default.createElement("i",null,"Free to use with your own API key.")),st.default.createElement("li",null,st.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",st.default.createElement("i",null,"Free to use with your own API key.")),st.default.createElement("li",null,st.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"," ",st.default.createElement("a",{href:sze(CE.MODE_SELECT_TOOLTIP),target:"_blank",rel:"noopener noreferrer",className:"tw-text-accent hover:tw-text-accent-hover"},"obsidiancopilot.com")," ","for more details.")))))),value:t.defaultChainType,onChange:u=>ot("defaultChainType",u),options:Object.entries(xGn).map(([u,l])=>({label:l,value:u}))}),st.default.createElement(Ur,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:t.defaultOpenArea,onChange:u=>ot("defaultOpenArea",u),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),st.default.createElement(Ur,{type:"text",title:"Default Conversation Folder Name",description:"The default folder name where chat conversations will be saved. Default is 'copilot-conversations'",value:t.defaultSaveFolder,onChange:u=>ot("defaultSaveFolder",u),placeholder:"copilot-conversations"}),st.default.createElement(Ur,{type:"text",title:"Default Conversation Tag",description:"The default tag to be used when saving a conversation. Default is 'ai-conversations'",value:t.defaultConversationTag,onChange:u=>ot("defaultConversationTag",u),placeholder:"ai-conversations"}),st.default.createElement(Ur,{type:"custom",title:"Conversation Filename Template",description:st.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-1.5 "},st.default.createElement("span",{className:"tw-leading-none"},"Customize the format of saved conversation note names."),st.default.createElement(No,{delayDuration:0},st.default.createElement(Ot,null,st.default.createElement(Et,{asChild:!0},st.default.createElement(Fi,{className:"tw-size-4"})),st.default.createElement(xt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},st.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Note: All the following variables must be included in the template."),st.default.createElement("div",null,st.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-muted"},"Available variables:"),st.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},st.default.createElement("li",null,st.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),st.default.createElement("li",null,st.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),st.default.createElement("li",null,st.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),st.default.createElement("i",{className:"tw-mt-2 tw-text-sm tw-text-muted"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]"))))))},st.default.createElement("div",{className:"tw-flex tw-w-[320px] tw-items-center tw-gap-1.5"},st.default.createElement(mi,{type:"text",className:me("tw-min-w-[80px] tw-grow tw-transition-all tw-duration-200",e?"tw-w-[80px]":"tw-w-[120px]"),placeholder:"{$date}_{$time}__{$topic}",value:n,onChange:u=>o(u.target.value),disabled:e}),st.default.createElement(he,{onClick:()=>i(),disabled:e,variant:"secondary"},e?st.default.createElement(st.default.Fragment,null,st.default.createElement(tu,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Apply"):"Apply"))),st.default.createElement(Ur,{type:"switch",title:"Autosave Chat",description:"Automatically saves the chat after every user message and AI response.",checked:t.autosaveChat,onCheckedChange:u=>ot("autosaveChat",u)}),st.default.createElement(Ur,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:t.showSuggestedPrompts,onCheckedChange:u=>ot("showSuggestedPrompts",u)}),st.default.createElement(Ur,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:t.showRelevantNotes,onCheckedChange:u=>ot("showRelevantNotes",u)}))))};vo();var dv=j(X());Gye();bt();var syr=()=>{let t=_n(),e=DO.getInstance(),r=new Set(t.autonomousAgentEnabledToolIds||[]),n=e.getToolsByCategory(),o=e.getConfigurableTools(),i=(s,u)=>{let l=new Set(r);u?l.add(s):l.delete(s),ot("autonomousAgentEnabledToolIds",Array.from(l))},a=()=>Array.from(n.entries()).filter(([u,l])=>l.some(c=>o.includes(c))).map(([u,l])=>{let c=l.filter(d=>o.includes(d));return c.length===0?null:dv.default.createElement(dv.default.Fragment,{key:u},c.map(({metadata:d})=>dv.default.createElement(Ur,{key:d.id,type:"switch",title:d.displayName,description:d.description,checked:r.has(d.id),onCheckedChange:f=>i(d.id,f)})))});return dv.default.createElement(dv.default.Fragment,null,dv.default.createElement(Ur,{type:"slider",title:"Max Iterations",description:"Maximum number of reasoning iterations the autonomous agent can perform. Higher values allow for more complex reasoning but may take longer.",value:t.autonomousAgentMaxIterations??4,onChange:s=>{ot("autonomousAgentMaxIterations",s)},min:4,max:8,step:1}),dv.default.createElement("div",{className:"tw-mt-4 tw-rounded-lg tw-bg-secondary tw-p-4"},dv.default.createElement("div",{className:"tw-mb-2 tw-text-sm tw-font-medium"},"Agent Accessible Tools"),dv.default.createElement("div",{className:"tw-mb-4 tw-text-xs tw-text-muted"},"Toggle which tools the autonomous agent can use"),dv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},a())))};nr();wn();bt();fn();var X$=require("obsidian"),Ln=j(X()),uyr=()=>{let t=_n(),e=t.autocompleteAcceptKey||Wg.KEYBIND,[r,n]=(0,Ln.useState)(!1),o=[{value:"Tab",label:"Tab"},{value:"Space",label:"Space"},{value:"ArrowRight",label:"Right Arrow"}],i=u=>{ot("autocompleteAcceptKey",u),new X$.Notice(`Autocomplete accept key set to: ${u}`)},a=()=>{ot("autocompleteAcceptKey",Wg.KEYBIND),new X$.Notice(`Autocomplete accept key reset to: ${Wg.KEYBIND}`)},s=async()=>{if(!r){n(!0),new X$.Notice("Rebuilding word index...");try{let l=await Yk.getInstance(app.vault).rescan(c=>{c.processedFiles===c.totalFiles&&new X$.Notice(`Word index complete! Found ${c.foundWords} words from ${c.processedFiles} files.`)});new X$.Notice(`Word index rebuilt successfully! ${l.wordCount} unique words indexed.`)}catch(u){console.error("Failed to refresh word index:",u),new X$.Notice("Failed to refresh word index. Check console for details.")}finally{n(!1)}}};return Ln.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Ln.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4"},Ln.default.createElement("div",{className:"tw-flex tw-items-center tw-py-4"},Ln.default.createElement(up,{variant:"secondary",className:"tw-text-accent"},"Plus Required")),Ln.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Ln.default.createElement(Ur,{type:"switch",title:"Include Current Note in Context Menu",description:"Automatically include the current note in the chat context menu by default when sending messages to the AI.",checked:t.includeActiveNoteAsContext,onCheckedChange:u=>{ot("includeActiveNoteAsContext",u)}}),Ln.default.createElement(Ur,{type:"switch",title:"Images in Markdown",description:"Pass embedded images in markdown to the AI along with the text. Only works with multimodal models.",checked:t.passMarkdownImages,onCheckedChange:u=>{ot("passMarkdownImages",u)}}),Ln.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autonomous Agent"),Ln.default.createElement(Ur,{type:"switch",title:"Enable Autonomous Agent",description:"Enable autonomous agent mode in Plus chat. The AI will reason step-by-step and decide which tools to use automatically, improving response quality for complex queries.",checked:t.enableAutonomousAgent,onCheckedChange:u=>{ot("enableAutonomousAgent",u)}}),t.enableAutonomousAgent&&Ln.default.createElement(Ln.default.Fragment,null,Ln.default.createElement(syr,null)),Ln.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autocomplete"),Ln.default.createElement(Ur,{type:"switch",title:"Sentence Autocomplete",description:Ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ln.default.createElement("span",{className:"tw-leading-none"},"Enable AI-powered sentence autocomplete suggestions while typing")),checked:t.enableAutocomplete,onCheckedChange:u=>ot("enableAutocomplete",u)}),Ln.default.createElement(Ur,{type:"switch",title:"Word Completion",description:"Suggest completions for partially typed words based on your vault's content. Requires at least 3 characters to trigger.",checked:t.enableWordCompletion,onCheckedChange:u=>{ot("enableWordCompletion",u)}}),Ln.default.createElement(Ur,{type:"custom",title:"Word Index Management",description:"Rebuild the word index to include new words from your vault. The index is automatically built when the plugin loads."},Ln.default.createElement(he,{onClick:s,disabled:r,className:"tw-flex tw-items-center tw-gap-2"},Ln.default.createElement(qv,{className:me("tw-size-4",r&&"tw-animate-spin")}),r?"Rebuilding...":"Refresh Word Index")),Ln.default.createElement(Ur,{type:"custom",title:"Autocomplete Accept Suggestion Key",description:Ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ln.default.createElement("span",{className:"tw-leading-none"},"The key used to accept autocomplete suggestions"),Ln.default.createElement(No,{delayDuration:0},Ln.default.createElement(Ot,null,Ln.default.createElement(Et,{asChild:!0},Ln.default.createElement(Fi,{className:"tw-size-4"})),Ln.default.createElement(xt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Ln.default.createElement("div",{className:"tw-text-sm tw-text-muted"},'Select the key you want to use for accepting suggestions. Default is "Tab".')))))},Ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ln.default.createElement(xN,{value:e,onValueChange:i},Ln.default.createElement(hA,{className:"tw-w-[180px]"},Ln.default.createElement(SN,{placeholder:"Select key"})),Ln.default.createElement(gA,null,o.map(u=>Ln.default.createElement(yA,{key:u.value,value:u.value},u.label)))),e&&e!==Wg.KEYBIND&&Ln.default.createElement(he,{variant:"ghost",onClick:a,className:"tw-h-8 tw-text-xs"},"Reset to Default"))),Ln.default.createElement(Ur,{type:"switch",title:"Allow Additional Context",description:"Allow the AI to access relevant notes to provide more relevant suggestions. When off, the AI can only see the current note context.",checked:t.allowAdditionalContext,onCheckedChange:u=>{ot("allowAdditionalContext",u)}}))))};nr();tF();lR();Kt();bt();var Be=j(X());bt();nr();fr();var uX=require("obsidian");vo();fn();var RKe=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=FV(),a=oe(),s=o?"openai":"openai",[u,l]=(0,Be.useState)(null),[c,d]=(0,Be.useState)(!1),[f,p]=(0,Be.useState)(!1),[h,m]=(0,Be.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1}),g=(L,Q)=>{m(z=>({...z,[L]:Q}))},y=()=>{m({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1})},_=()=>{let L=!0,Q={...h};return Q.name=!C.name,C.name||(L=!1),C.provider==="azure openai"&&(Q.instanceName=!C.azureOpenAIApiInstanceName,Q.apiVersion=!C.azureOpenAIApiVersion,o?(Q.embeddingDeploymentName=!C.azureOpenAIApiEmbeddingDeploymentName,C.azureOpenAIApiEmbeddingDeploymentName||(L=!1)):(Q.deploymentName=!C.azureOpenAIApiDeploymentName,C.azureOpenAIApiDeploymentName||(L=!1)),(!C.azureOpenAIApiInstanceName||!C.azureOpenAIApiVersion)&&(L=!1)),m(Q),L},w=L=>a[SE[L]]||"",S=(L=s)=>{let Q={name:"",provider:L,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:w(L),isEmbeddingModel:o,capabilities:[]};return o?Q:{...Q,stream:!0}},[C,E]=(0,Be.useState)(S()),P=L=>({...L,name:L.name?.trim(),baseUrl:L.baseUrl?.trim(),apiKey:L.apiKey?.trim(),openAIOrgId:L.openAIOrgId?.trim(),azureOpenAIApiInstanceName:L.azureOpenAIApiInstanceName?.trim(),azureOpenAIApiDeploymentName:L.azureOpenAIApiDeploymentName?.trim(),azureOpenAIApiEmbeddingDeploymentName:L.azureOpenAIApiEmbeddingDeploymentName?.trim(),azureOpenAIApiVersion:L.azureOpenAIApiVersion?.trim()}),[T,I]=(0,Be.useState)(wE(s)),N=()=>!!(C.name&&C.provider),M=()=>f||!N(),D=()=>{if(!_()){new uX.Notice("Please fill in all required fields");return}let L=P(C);r(L),e(!1),E(S()),y()},k=L=>{I(wE(L)),E({...C,provider:L,apiKey:w(L),...L==="openai"?{openAIOrgId:a.openAIOrgId}:{},...L==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{}})},F=L=>{L||(E(S()),y(),d(!1)),e(L)},K=async()=>{if(!_()){new uX.Notice("Please fill in all required fields");return}p(!0);try{let L=P(C);await n(L),new uX.Notice("Model verification successful!")}catch(L){console.error(L);let Q=Xn(L);new uX.Notice("Model verification failed: "+Q)}finally{p(!1)}},U=()=>{let Q=(()=>{switch(C.provider){case"openai":return Be.default.createElement(Jn,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},Be.default.createElement(mi,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:C.openAIOrgId||"",onChange:z=>E({...C,openAIOrgId:z.target.value})}));case"azure openai":return Be.default.createElement(Be.default.Fragment,null,Be.default.createElement(Jn,{label:"Instance Name",required:!0,error:h.instanceName,errorMessage:"Instance name is required"},Be.default.createElement(mi,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:C.azureOpenAIApiInstanceName||"",onChange:z=>{E({...C,azureOpenAIApiInstanceName:z.target.value}),g("instanceName",!1)}})),o?Be.default.createElement(Jn,{label:"Embedding Deployment Name",required:!0,error:h.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},Be.default.createElement(mi,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:C.azureOpenAIApiEmbeddingDeploymentName||"",onChange:z=>{E({...C,azureOpenAIApiEmbeddingDeploymentName:z.target.value}),g("embeddingDeploymentName",!1)}})):Be.default.createElement(Jn,{label:"Deployment Name",required:!0,error:h.deploymentName,errorMessage:"Deployment name is required",description:"This is your actual model, no need to pass a model name separately."},Be.default.createElement(mi,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:C.azureOpenAIApiDeploymentName||"",onChange:z=>{E({...C,azureOpenAIApiDeploymentName:z.target.value}),g("deploymentName",!1)}})),Be.default.createElement(Jn,{label:"API Version",required:!0,error:h.apiVersion,errorMessage:"API version is required"},Be.default.createElement(mi,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:C.azureOpenAIApiVersion||"",onChange:z=>{E({...C,azureOpenAIApiVersion:z.target.value}),g("apiVersion",!1)}})));default:return null}})();return Q?Be.default.createElement(nv,{open:c,onOpenChange:d,className:"tw-space-y-2 tw-rounded-lg tw-border tw-pt-4"},Be.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},Be.default.createElement(Xp,null,"Additional ",Ap(C.provider)," Settings"),Be.default.createElement(sA,{asChild:!0},Be.default.createElement(he,{variant:"ghost",size:"sm",className:"tw-w-9 tw-p-0"},Be.default.createElement(Li,{className:"tw-size-4"}),Be.default.createElement("span",{className:"tw-sr-only"},"Toggle")))),Be.default.createElement(ov,{className:"tw-max-h-[200px] tw-space-y-4 tw-overflow-y-auto tw-pb-0.5 tw-pl-0.5 tw-pr-2"},Q)):null},Y=()=>{if(C.provider!=="azure openai")return T.host;let L=C.azureOpenAIApiInstanceName||"[instance]",Q=o?C.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":C.azureOpenAIApiDeploymentName||"[deployment]",z=C.azureOpenAIApiVersion||"[api-version]";return`https://${L}.openai.azure.com/openai/deployments/${Q}/${o?"embeddings":"chat/completions"}?api-version=${z}`},ee=Object.entries(YA).map(([L,Q])=>({id:L,label:L.charAt(0).toUpperCase()+L.slice(1),description:Q}));return Be.default.createElement($ve,{open:t,onOpenChange:F},Be.default.createElement(oX,{className:"sm:tw-max-w-[425px]",container:i,ref:L=>l(L)},Be.default.createElement(iX,null,Be.default.createElement(aX,null,"Add Custom ",o?"Embedding":"Chat"," Model"),Be.default.createElement(sX,null,"Add a new model to your collection.")),Be.default.createElement("div",{className:"tw-space-y-3"},Be.default.createElement(Jn,{label:"Model Name",required:!0,error:h.name,errorMessage:"Model name is required"},Be.default.createElement(mi,{type:"text",placeholder:`Enter model name (e.g. ${o?"text-embedding-3-small":"gpt-4"})`,value:C.name,onChange:L=>{E({...C,name:L.target.value}),g("name",!1)}})),Be.default.createElement(Jn,{label:Be.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Be.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Be.default.createElement(No,{delayDuration:0},Be.default.createElement(Ot,null,Be.default.createElement(Et,{asChild:!0},Be.default.createElement(Fi,{className:"tw-size-4"})),Be.default.createElement(xt,{align:"start",className:"tw-max-w-96",side:"bottom"},Be.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Be.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Be.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Be.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Be.default.createElement("li",null,"Direct-Paid:Ds-r1"),Be.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Be.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Be.default.createElement(mi,{type:"text",placeholder:"Custom display name (optional)",value:C.displayName||"",onChange:L=>{E({...C,displayName:L.target.value})}})),Be.default.createElement(Jn,{label:"Provider"},Be.default.createElement(xN,{value:C.provider,onValueChange:k},Be.default.createElement(hA,null,Be.default.createElement(SN,{placeholder:"Select provider"})),Be.default.createElement(gA,{container:u},Object.values(o?o8(GA,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):o8(xE,["COPILOT_PLUS"])).map(L=>Be.default.createElement(yA,{key:L,value:L},Ap(L)))))),Be.default.createElement(Jn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Be.default.createElement(mi,{type:"text",placeholder:Y()||"https://api.example.com/v1",value:C.baseUrl||"",onChange:L=>E({...C,baseUrl:L.target.value})})),Be.default.createElement(Jn,{label:"API Key"},Be.default.createElement(KO,{placeholder:`Enter ${T.label} API Key`,value:C.apiKey||"",onChange:L=>E({...C,apiKey:L})}),T.keyManagementURL&&Be.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Be.default.createElement("a",{href:T.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",T.label," API Key"))),Be.default.createElement(Jn,{label:Be.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Be.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Be.default.createElement(No,{delayDuration:0},Be.default.createElement(Ot,null,Be.default.createElement(Et,{asChild:!0},Be.default.createElement(Fi,{className:"tw-size-4"})),Be.default.createElement(xt,{align:"start",className:"tw-max-w-96",side:"bottom"},Be.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},Be.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},ee.map(({id:L,label:Q,description:z})=>Be.default.createElement("div",{key:L,className:"tw-flex tw-items-center tw-gap-2"},Be.default.createElement(Cc,{id:L,checked:C.capabilities?.includes(L),onCheckedChange:W=>{let V=C.capabilities||[];E({...C,capabilities:W?[...V,L]:V.filter(q=>q!==L)})}}),Be.default.createElement(Xp,{htmlFor:L,className:"tw-text-sm"},Be.default.createElement(No,{delayDuration:0},Be.default.createElement(Ot,null,Be.default.createElement(Et,{asChild:!0},Be.default.createElement("span",null,Q)),Be.default.createElement(xt,{side:"bottom"},z)))))))),U()),Be.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-gap-4"},Be.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Be.default.createElement(Cc,{id:"enable-cors",checked:C.enableCors||!1,onCheckedChange:L=>E({...C,enableCors:L})}),Be.default.createElement(Xp,{htmlFor:"enable-cors",className:"tw-text-sm"},Be.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Be.default.createElement("span",null,"Enable CORS"),Be.default.createElement(No,{delayDuration:0},Be.default.createElement(Ot,null,Be.default.createElement(Et,{asChild:!0},Be.default.createElement(Fi,{className:"tw-size-4"})),Be.default.createElement(xt,{align:"start",className:"tw-max-w-96",side:"bottom"},Be.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only check this option when prompted that CORS is needed"))))))),Be.default.createElement("div",{className:"tw-flex tw-gap-2"},Be.default.createElement(he,{variant:"secondary",onClick:D,disabled:M()},"Add Model"),Be.default.createElement(he,{variant:"secondary",onClick:K,disabled:M()},f?Be.default.createElement(Be.default.Fragment,null,Be.default.createElement(tu,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Verify"):"Verify")))))};nr();bt();fr();fn();var lyr=require("obsidian"),Fe=j(X()),cyr=j(Lc());var gi=j(X());vo();fn();function Q$(t){let{label:e,helpText:r,disableFn:n,optional:o=!0}=t,i=t.type,a=o?t.value!==void 0:!0,[s,u]=(0,gi.useState)(a),l=()=>{o&&(u(!s),s?n?.():i==="slider"?t.onChange(t.value??t.defaultValue??0):t.onChange(t.value??t.defaultValue??t.options[0]?.value??""))},c=f=>{s&&i==="slider"&&t.onChange(f[0])},d=f=>{s&&i==="select"&&t.onChange(f)};return gi.default.createElement("div",{className:"tw-space-y-3"},gi.default.createElement(No,{delayDuration:0},gi.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},gi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},gi.default.createElement("span",{className:`tw-font-medium ${s?"tw-text-normal":"tw-text-muted"}`},e),r&&gi.default.createElement(Ot,null,gi.default.createElement(Et,{asChild:!0},gi.default.createElement(Fi,{className:"tw-size-4 tw-text-muted"})),gi.default.createElement(xt,{side:"bottom"},gi.default.createElement("div",{className:"tw-max-w-[300px]"},r)))),gi.default.createElement("div",{className:`tw-flex tw-items-center ${o?"tw-gap-3":"tw-gap-0"}`},gi.default.createElement("span",{className:`tw-min-w-8 tw-text-right tw-font-mono tw-text-sm ${s?"tw-text-normal":"tw-text-muted"}`},s?t.value??t.defaultValue:"\u2014"),o&&gi.default.createElement(Ot,null,gi.default.createElement(Et,{asChild:!0},gi.default.createElement(he,{variant:"ghost2",size:"sm",onClick:l,className:`tw-size-8 tw-p-0 ${s?"tw-text-accent/80 hover:tw-text-accent":"tw-text-muted hover:tw-text-normal"}`},s?gi.default.createElement(j5,{className:"tw-size-4"}):gi.default.createElement(N5,{className:"tw-size-4"}))),gi.default.createElement(xt,{side:"bottom"},gi.default.createElement("span",null,s?"Disable parameters":"Enable parameters")))))),gi.default.createElement("div",{className:"tw-relative"},i==="slider"?gi.default.createElement(gi.default.Fragment,null,gi.default.createElement(AY,{value:[s?t.value??t.defaultValue??0:t.min??0],onValueChange:c,min:t.min??0,max:t.max??1,step:t.step,disabled:!s,className:`tw-w-full ${s?"":"tw-opacity-40"}`}),!s&&o&&gi.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-cursor-not-allowed tw-rounded"})):gi.default.createElement(xN,{value:s?t.value??t.defaultValue??t.options[0]?.value:void 0,onValueChange:d,disabled:!s},gi.default.createElement(hA,{className:`tw-w-full ${s?"":"tw-opacity-40"}`},gi.default.createElement(SN,{placeholder:"Select an option"})),gi.default.createElement(gA,null,t.options.map(f=>gi.default.createElement(yA,{key:f.value,value:f.value},f.label))))))}var SGn=({model:t,onUpdate:e,onCancel:r,isEmbeddingModel:n})=>{let[o,i]=(0,Fe.useState)(t),[a,s]=(0,Fe.useState)(t),[u,l]=(0,Fe.useState)({}),c=oe(),d=w=>c[SE[w]]||"";(0,Fe.useEffect)(()=>{i(t),s(t),t.provider&&l(wE(t.provider))},[t]);let f=(0,Fe.useMemo)(()=>vee((w,S)=>{e(n,w,S)},500),[n,e]),p=(0,Fe.useCallback)((w,S)=>{i(C=>{let E={...C,[w]:S};return f(a,E),E})},[a,f]),h=(0,Fe.useCallback)(w=>{i(S=>{let C={...S};return delete C[w],f(a,C),C})},[f,a]);if(!o)return null;let m=()=>{if(!o||!o.provider||o.provider!=="azure-openai")return u.host||"https://api.example.com/v1";let w=o.azureOpenAIApiInstanceName||"[instance]",S=o.isEmbeddingModel?o.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":o.azureOpenAIApiDeploymentName||"[deployment]",C=o.azureOpenAIApiVersion||"[api-version]",E=o.isEmbeddingModel?"embeddings":"chat/completions";return`https://${w}.openai.azure.com/openai/deployments/${S}/${E}?api-version=${C}`},g=Object.entries(YA).map(([w,S])=>({id:w,label:w.charAt(0).toUpperCase()+w.slice(1),description:S})),y=o.apiKey||d(o.provider),_=!n&&o.provider!=="copilot-plus-jina";return Fe.default.createElement("div",{className:"tw-space-y-3 tw-p-4"},Fe.default.createElement("div",{className:"tw-mb-4"},Fe.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"Model Settings - ",o.name),Fe.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Customize model parameters")),Fe.default.createElement("div",{className:"tw-space-y-3"},Fe.default.createElement(Jn,{label:"Model Name",required:!0},Fe.default.createElement(mi,{type:"text",disabled:o.core,value:o.name,onChange:w=>p("name",w.target.value),placeholder:"Enter model name"})),Fe.default.createElement(Jn,{label:Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Fe.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Fe.default.createElement(No,{delayDuration:0},Fe.default.createElement(Ot,null,Fe.default.createElement(Et,{asChild:!0},Fe.default.createElement(Fi,{className:"tw-size-4"})),Fe.default.createElement(xt,{align:"start",className:"tw-max-w-96",side:"bottom"},Fe.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Fe.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Fe.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Fe.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Fe.default.createElement("li",null,"Direct-Paid:Ds-r1"),Fe.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Fe.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Fe.default.createElement(mi,{type:"text",placeholder:"Custom display name (optional)",value:o.displayName||"",onChange:w=>p("displayName",w.target.value)})),Fe.default.createElement(Jn,{label:"Provider"},Fe.default.createElement(mi,{type:"text",value:Ap(o.provider),disabled:!0})),Fe.default.createElement(Jn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Fe.default.createElement(mi,{type:"text",placeholder:m(),value:o.baseUrl||"",onChange:w=>p("baseUrl",w.target.value)})),Fe.default.createElement(Jn,{label:"API Key"},Fe.default.createElement(KO,{placeholder:`Enter ${u.label||"Provider"} API Key`,value:y,onChange:w=>p("apiKey",w)}),u.keyManagementURL&&Fe.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Fe.default.createElement("a",{href:u.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",u.label," API Key"))),_&&Fe.default.createElement(Fe.default.Fragment,null,Fe.default.createElement(Jn,{label:Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Fe.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Fe.default.createElement(No,{delayDuration:0},Fe.default.createElement(Ot,null,Fe.default.createElement(Et,{asChild:!0},Fe.default.createElement(Fi,{className:"tw-size-4"})),Fe.default.createElement(xt,{align:"start",className:"tw-max-w-96",side:"bottom"},Fe.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},g.map(({id:w,label:S,description:C})=>Fe.default.createElement("div",{key:w,className:"tw-flex tw-items-center tw-gap-2"},Fe.default.createElement(Cc,{id:w,checked:o.capabilities?.includes(w),onCheckedChange:E=>{let P=o.capabilities||[],T=E?[...P,w]:P.filter(I=>I!==w);p("capabilities",T)}}),Fe.default.createElement(Xp,{htmlFor:w,className:"tw-text-sm"},Fe.default.createElement(No,{delayDuration:0},Fe.default.createElement(Ot,null,Fe.default.createElement(Et,{asChild:!0},Fe.default.createElement("span",null,S)),Fe.default.createElement(xt,{side:"bottom"},C)))))))),Fe.default.createElement(Jn,null,Fe.default.createElement(Q$,{type:"slider",optional:!1,label:"Token limit",value:o.maxTokens??c.maxTokens,onChange:w=>p("maxTokens",w),max:65e3,min:0,step:100,defaultValue:Mf.MAX_TOKENS,helpText:Fe.default.createElement(Fe.default.Fragment,null,Fe.default.createElement("p",null,"The maximum number of ",Fe.default.createElement("em",null,"output tokens")," to generate. Default is"," ",Mf.MAX_TOKENS,"."),Fe.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model."))})),Fe.default.createElement(Jn,null,Fe.default.createElement(Q$,{type:"slider",optional:!1,label:"Temperature",value:o.temperature??c.temperature,onChange:w=>p("temperature",w),max:2,min:0,step:.05,defaultValue:Mf.TEMPERATURE,helpText:`Default is ${Mf.TEMPERATURE}. Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.`})),Fe.default.createElement(Jn,null,Fe.default.createElement(Q$,{type:"slider",label:"Top-P",value:o.topP,onChange:w=>p("topP",w),disableFn:()=>h("topP"),max:1,min:0,step:.05,defaultValue:.9,helpText:"Default value is 0.9, the smaller the value, the less variety in the answers, the easier to understand, the larger the value, the larger the range of the AI's vocabulary, the more diverse"})),Fe.default.createElement(Jn,null,Fe.default.createElement(Q$,{type:"slider",label:"Frequency Penalty",value:o.frequencyPenalty,onChange:w=>p("frequencyPenalty",w),disableFn:()=>h("frequencyPenalty"),max:2,min:0,step:.05,defaultValue:0,helpText:Fe.default.createElement(Fe.default.Fragment,null,Fe.default.createElement("p",null,"The frequency penalty parameter tells the model not to repeat a word that has already been used multiple times in the conversation."),Fe.default.createElement("em",null,"The higher the value, the more the model is penalized for repeating words."))})),o.provider==="openai"&&(o.name.startsWith("gpt-5")||o.name.startsWith("o1")||o.name.startsWith("o3")||o.name.startsWith("o4"))&&Fe.default.createElement(Fe.default.Fragment,null,Fe.default.createElement(Jn,null,Fe.default.createElement(Q$,{type:"select",label:"Reasoning Effort",value:o.reasoningEffort,onChange:w=>p("reasoningEffort",w),disableFn:()=>h("reasoningEffort"),defaultValue:c.reasoningEffort??Mf.REASONING_EFFORT,options:[...o.name.startsWith("gpt-5")?[{value:"minimal",label:"Minimal"}]:[],{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],helpText:Fe.default.createElement(Fe.default.Fragment,null,Fe.default.createElement("p",null,"Controls the amount of reasoning effort the model uses. Higher effort provides more thorough reasoning but takes longer. Note: thinking tokens are not available yet!"),Fe.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},Fe.default.createElement("li",null,"Minimal: Fastest responses, minimal reasoning (GPT-5 only)"),Fe.default.createElement("li",null,"Low: Faster responses, basic reasoning (default)"),Fe.default.createElement("li",null,"Medium: Balanced performance"),Fe.default.createElement("li",null,"High: Thorough reasoning, slower responses")))})),o.name.startsWith("gpt-5")&&Fe.default.createElement(Jn,null,Fe.default.createElement(Q$,{type:"select",label:"Verbosity",value:o.verbosity,onChange:w=>p("verbosity",w),disableFn:()=>h("verbosity"),defaultValue:c.verbosity??Mf.VERBOSITY,options:[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],helpText:Fe.default.createElement(Fe.default.Fragment,null,Fe.default.createElement("p",null,"Controls the length and detail of the model responses."),Fe.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},Fe.default.createElement("li",null,"Low: Concise, brief responses"),Fe.default.createElement("li",null,"Medium: Balanced detail"),Fe.default.createElement("li",null,"High: Detailed, comprehensive responses")))}))))))},qve=class extends lyr.Modal{constructor(r,n,o,i){super(r);this.model=n;this.isEmbeddingModel=o;this.onUpdate=i}onOpen(){let{contentEl:r}=this;this.root=(0,cyr.createRoot)(r);let n=(i,a,s)=>{this.onUpdate(i,a,s)},o=()=>{this.close()};this.root.render(Fe.default.createElement(SGn,{model:this.model,isEmbeddingModel:this.isEmbeddingModel,onUpdate:n,onCancel:o}))}onClose(){this.root.unmount()}};vo();nr();wn();bt();fr();fn();var De=j(X());var Hve=j(X()),NKe=(0,Hve.createContext)(null),jKe=()=>(0,Hve.useContext)(NKe);var CGn={reasoning:{icon:zE,color:"tw-text-model-capabilities-blue",tooltip:YA.reasoning},vision:{icon:$E,color:"tw-text-model-capabilities-green",tooltip:YA.vision},websearch:{icon:BE,color:"tw-text-model-capabilities-blue",tooltip:YA.websearch}},OGn=["reasoning","vision","websearch"],EGn=t=>De.default.createElement(No,{delayDuration:0},De.default.createElement("div",{className:"tw-mx-auto tw-grid tw-w-16 tw-grid-cols-3 tw-gap-1"},OGn.map(e=>{let r=CGn[e];if(!r)return De.default.createElement("div",{key:e,className:"tw-w-4"});let n=r.icon;return t.capabilities?.includes(e)?De.default.createElement(Ot,{key:e},De.default.createElement(Et,{asChild:!0},De.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},De.default.createElement(n,{className:me("tw-size-4",r.color)}))),De.default.createElement(xt,{side:"bottom"},r.tooltip)):De.default.createElement("div",{key:e,className:"tw-flex tw-items-center tw-justify-center"},De.default.createElement("div",{className:"tw-size-4"}))}))),PGn=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,id:i})=>{let[a,s]=De.default.useState(!1),u=jKe(),{attributes:l,listeners:c,setNodeRef:d,transform:f,transition:p,isDragging:h}=rX({id:i,disabled:t.core}),m={transform:uv.Transform.toString(f),transition:p};return De.default.createElement(T$,{ref:d,style:m,className:me("tw-mb-2",h&&["tw-opacity-90","tw-shadow-lg","tw-border-accent/50","tw-relative","tw-z-[9999]","tw-bg-primary","tw-rounded-lg","tw-transform-gpu"],!t.core&&"tw-touch-none")},De.default.createElement(A$,{className:"tw-p-3"},De.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},!t.core&&De.default.createElement("div",{className:"tw-mr-2 tw-cursor-grab tw-touch-none active:tw-cursor-grabbing",...l,...c},De.default.createElement(Bv,{className:"tw-size-4"})),De.default.createElement("div",{className:"tw-flex-1 tw-cursor-pointer",onClick:()=>s(!a)},De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement("div",{className:"tw-flex tw-size-3 tw-items-center tw-justify-center"},a?De.default.createElement(Li,{className:"tw-size-3 tw-stroke-[7]"}):De.default.createElement(jm,{className:"tw-size-3 tw-stroke-[7]"})),De.default.createElement("div",null,De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},De.default.createElement("span",{className:"tw-font-medium"},t.displayName||t.name),t.capabilities&&t.capabilities.length>0&&De.default.createElement(h8e,{capabilities:t.capabilities,iconSize:14})),De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement("span",{className:"tw-bg-secondary tw-text-sm tw-text-muted"},Ap(t.provider,t)))))),De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},e&&De.default.createElement(he,{variant:"ghost",size:"icon",onClick:g=>{g.stopPropagation(),e(t)}},De.default.createElement(Vz,{className:"tw-size-4"})),De.default.createElement(_$,null,De.default.createElement(v$,{asChild:!0},De.default.createElement(he,{variant:"ghost",size:"icon"},De.default.createElement(kE,{className:"tw-size-4"}))),De.default.createElement(Q_,{align:"end",container:u},e&&De.default.createElement(Ui,{onClick:g=>{g.stopPropagation(),e(t)}},De.default.createElement(Hz,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&De.default.createElement(Ui,{onClick:g=>{g.stopPropagation(),r(t)}},De.default.createElement($h,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&De.default.createElement(Ui,{onClick:g=>{g.stopPropagation(),n(en(t))},className:"tw-text-error"},De.default.createElement(zh,{className:"tw-mr-2 tw-size-4"}),"Delete")))))),De.default.createElement("div",{className:me("tw-transition-all tw-duration-300 tw-ease-in-out",a?"tw-max-h-20 tw-opacity-100":"tw-max-h-0 tw-overflow-hidden tw-opacity-0")},De.default.createElement(I$,{className:"tw-p-3 tw-pt-0"},De.default.createElement("div",{className:"tw-flex tw-justify-around"},!t.isEmbeddingModel&&De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement("span",{className:"tw-text-sm"},"Enabled"),De.default.createElement(Cc,{checked:t.enabled,onCheckedChange:g=>o({...t,enabled:g})})),De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement("span",{className:"tw-text-sm"},"CORS"),De.default.createElement(Cc,{checked:t.enableCors,onCheckedChange:g=>o({...t,enableCors:g})}))))))},TGn=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,isEmbeddingModel:i})=>{let{attributes:a,listeners:s,setNodeRef:u,transform:l,transition:c,isDragging:d}=rX({id:en(t),disabled:t.core}),f=jKe(),p={transform:uv.Transform.toString(l),transition:c},h=e||!t.core||r&&!t.core;return De.default.createElement(EN,{ref:u,style:p,className:me("tw-transition-colors tw-duration-200 hover:tw-bg-interactive-accent/10",d&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50 tw-bg-primary/90")},De.default.createElement(dp,{className:"tw-w-6 tw-px-2"},!t.core&&De.default.createElement(he,{variant:"ghost",size:"icon",className:"tw-size-6 tw-cursor-grab tw-touch-none tw-p-0 hover:tw-cursor-grab active:tw-cursor-grabbing",...a,...s},De.default.createElement(Bv,{className:"tw-size-4 tw-transition-colors"}))),De.default.createElement(dp,{className:"tw-pl-0"},t.displayName||t.name),De.default.createElement(dp,null,Ap(t.provider,t)),De.default.createElement(dp,null,EGn(t)),!i&&De.default.createElement(dp,{className:"tw-text-center"},De.default.createElement(Cc,{id:`${en(t)}-enabled`,checked:t.enabled,onCheckedChange:m=>o({...t,enabled:m}),className:"tw-mx-auto"})),De.default.createElement(dp,{className:"tw-text-center"},De.default.createElement(Cc,{id:`${en(t)}-enableCors`,checked:t.enableCors,onCheckedChange:m=>o({...t,enableCors:m}),className:"tw-mx-auto"})),De.default.createElement(dp,{className:"tw-text-center"},De.default.createElement("div",{className:"tw-flex tw-justify-center tw-gap-2"},e&&De.default.createElement(he,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"tw-shadow-sm tw-transition-shadow hover:tw-shadow-md"},De.default.createElement(Vz,{className:"tw-size-4"})),h&&De.default.createElement(_$,null,De.default.createElement(v$,{asChild:!0},De.default.createElement(he,{variant:"ghost",size:"icon"},De.default.createElement(kE,{className:"tw-size-4"}))),De.default.createElement(Q_,{align:"end",container:f},e&&De.default.createElement(Ui,{onClick:()=>e(t)},De.default.createElement(Hz,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&De.default.createElement(Ui,{onClick:()=>r(t)},De.default.createElement($h,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&De.default.createElement(Ui,{onClick:()=>n(en(t)),className:"tw-text-error"},De.default.createElement(zh,{className:"tw-mr-2 tw-size-4"}),"Delete"))))))},DKe=({models:t,onEdit:e,onCopy:r,onDelete:n,onAdd:o,onUpdateModel:i,onReorderModels:a,onRefresh:s,title:u})=>{let l=!!(t.length>0&&t[0].isEmbeddingModel),c=Ave(zV(AN),zV(TN,{coordinateGetter:Lve})),d=t.findIndex(m=>!m.core),f=m=>g=>{let{transform:y,active:_,activeNodeRect:w,over:S}=g;if(!_||!w)return y;let C=t.findIndex(N=>en(N)===_.id),E=t.filter(N=>!N.core).length,P=w.height,T=(d-C)*P,I=(d+E-1-C)*P;if(m&&S){let N=t.findIndex(D=>en(D)===S.id);if(t[N].core||N<d)return{...y,x:0,y:C*P}}return{...y,x:0,y:Math.min(Math.max(T,y.y),I)}},p=m=>{let{active:g,over:y}=m;if(y&&g.id!==y.id){let _=t.findIndex(E=>en(E)===g.id),w=t.findIndex(E=>en(E)===y.id),S=t[w];if(w<d||S.core)return;let C=Dve(t,_,w);a?.(C)}},h=()=>De.default.createElement("div",{className:"tw-relative md:tw-hidden"},De.default.createElement(QY,{sensors:c,collisionDetection:YY,onDragEnd:p,modifiers:[f(!0)]},De.default.createElement(tX,{items:t.map(m=>en(m)),strategy:eX},De.default.createElement("div",{className:"tw-relative tw-space-y-2"},t.map(m=>De.default.createElement(PGn,{key:en(m),id:en(m),model:m,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i}))))));return De.default.createElement("div",{className:"tw-mb-4"},De.default.createElement("div",{className:"tw-hidden md:tw-block"},De.default.createElement(QY,{sensors:c,collisionDetection:YY,onDragEnd:p,modifiers:[f(!1)]},De.default.createElement("div",{className:"tw-relative tw-overflow-hidden"},De.default.createElement(zY,null,De.default.createElement(UY,null,De.default.createElement(EN,null,De.default.createElement(im,{className:"tw-w-6 tw-px-2"}),De.default.createElement(im,{className:"tw-pl-0"},"Model"),De.default.createElement(im,null,"Provider"),De.default.createElement(im,{className:"tw-text-center"},"Capabilities"),!l&&De.default.createElement(im,{className:"tw-text-center"},"Enable"),De.default.createElement(im,{className:"tw-text-center"},"CORS"),De.default.createElement(im,{className:"tw-w-[100px] tw-text-center"},"Actions"))),De.default.createElement(qY,{className:"tw-relative"},De.default.createElement(tX,{items:t.map(m=>en(m)),strategy:eX},t.map(m=>De.default.createElement(TGn,{key:en(m),model:m,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i,isEmbeddingModel:l})))))))),h(),De.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end tw-gap-2"},s&&De.default.createElement(he,{onClick:s,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement(qv,{className:"tw-size-4"}),"Refresh Built-in Models"),De.default.createElement(he,{onClick:o,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement(Bh,{className:"tw-size-4"}),"Add Custom Model")))};fr();var Vve=require("obsidian"),sm=j(X()),dyr=()=>{let t=_n(),[e,r]=(0,sm.useState)(!1),[n,o]=(0,sm.useState)(!1),i=(m,g=!1)=>{let y={...o8(m,["isBuiltIn","core","projectEnabled","plusExclusive","believerExclusive","capabilities","displayName","dimensions"]),name:`${m.name} (copy)`},_=g?"activeEmbeddingModels":"activeModels";ot(_,[...t[_],y])},a=(m,g=!1)=>{ot(g?"activeEmbeddingModels":"activeModels",m)},s=m=>{let[g,y]=m.split("|"),_=t.activeModels.filter(S=>!(S.name===g&&S.provider===y)),w=t.defaultModelKey;if(m===t.defaultModelKey){let S=_.find(C=>C.enabled);w=S?`${S.name}|${S.provider}`:""}_E({activeModels:_,defaultModelKey:w})},u=(m,g,y)=>{let _=m?"activeEmbeddingModels":"activeModels",w=t[_].findIndex(S=>S.name===g.name&&S.provider===g.provider);if(w!==-1){let S=[...t[_]];S[w]=y,ot(_,S)}else new Vve.Notice("Could not find model to update"),ie("Could not find model to update:",g)},l=m=>{let g=t.activeModels.map(y=>y.name===m.name&&y.provider===m.provider?m:y);ot("activeModels",g)},c=m=>{let[g,y]=m.split("|"),_=t.activeEmbeddingModels.filter(w=>!(w.name===g&&w.provider===y));ot("activeEmbeddingModels",_)},d=m=>{let g=t.activeEmbeddingModels.map(y=>y.name===m.name&&y.provider===m.provider?m:y);ot("activeEmbeddingModels",g)},f=()=>{let m=t.activeModels.filter(y=>!y.isBuiltIn),g=[...Pv,...m];ot("activeModels",g),new Vve.Notice("Chat models refreshed successfully")},p=()=>{let m=t.activeEmbeddingModels.filter(y=>!y.isBuiltIn),g=[...xj,...m];ot("activeEmbeddingModels",g),new Vve.Notice("Embedding models refreshed successfully")},h=(m,g=!1)=>{new qve(app,m,g,u).open()};return sm.default.createElement("div",{className:"tw-space-y-4"},sm.default.createElement("section",null,sm.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Chat Models"),sm.default.createElement(DKe,{models:t.activeModels,onEdit:m=>h(m),onCopy:m=>i(m),onDelete:s,onAdd:()=>r(!0),onUpdateModel:l,onReorderModels:m=>a(m),onRefresh:f,title:"Chat Model"}),sm.default.createElement(RKe,{open:e,onOpenChange:r,onAdd:m=>{let g=[...t.activeModels,m];ot("activeModels",g)},ping:m=>Hd.instance.getCurrentChainManager().chatModelManager.ping(m)}),sm.default.createElement("div",{className:"tw-space-y-4"},sm.default.createElement(Ur,{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=>ot("contextTurns",m),min:1,max:50,step:1}))),sm.default.createElement("section",null,sm.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Embedding Models"),sm.default.createElement(DKe,{models:t.activeEmbeddingModels,onEdit:m=>h(m,!0),onDelete:c,onCopy:m=>i(m,!0),onAdd:()=>o(!0),onUpdateModel:d,onReorderModels:m=>a(m,!0),onRefresh:p,title:"Embedding Model"}),sm.default.createElement(RKe,{open:n,onOpenChange:o,onAdd:m=>{let g=[...t.activeEmbeddingModels,m];ot("activeEmbeddingModels",g)},isEmbeddingModel:!0,ping:m=>Pu.getInstance().ping(m)})))};var gyr=require("obsidian");vo();var qn=j(X()),yyr=j(Lc());th();fn();var fyr=require("obsidian"),vb=j(X()),pyr=j(Lc());vo();function AGn({onConfirm:t,onCancel:e}){let[r,n]=(0,vb.useState)(""),[o,i]=(0,vb.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return vb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},vb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},vb.default.createElement(mi,{placeholder:"Enter the extension (e.g. txt, excalidraw.md)",value:r,onChange:u=>{n(u.target.value),i(null)},onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),u.stopPropagation(),a(r))}}),o&&vb.default.createElement("p",{className:"tw-text-sm tw-text-error"},o)),vb.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},vb.default.createElement(he,{variant:"secondary",onClick:e},"Cancel"),vb.default.createElement(he,{variant:"default",onClick:()=>a(r)},"Confirm")))}var Wve=class extends fyr.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,pyr.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(vb.default.createElement(AGn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var myr=require("obsidian"),fv=j(X()),hyr=j(Lc());vo();function IGn({onConfirm:t,onCancel:e}){let[r,n]=(0,fv.useState)("");return fv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},fv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},fv.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"),fv.default.createElement(mi,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),fv.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},fv.default.createElement(he,{variant:"secondary",onClick:e},"Cancel"),fv.default.createElement(he,{variant:"default",onClick:()=>t(r)},"Confirm")))}var Kve=class extends myr.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,hyr.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(fv.default.createElement(IGn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};function Gve({title:t,patterns:e,onRemove:r}){return qn.default.createElement("div",{className:"tw-grid tw-grid-cols-4 tw-gap-2"},qn.default.createElement("div",{className:"tw-font-bold"},t),qn.default.createElement("ul",{className:"tw-col-span-3 tw-m-0 tw-flex tw-list-inside tw-list-disc tw-flex-col tw-gap-1 tw-pl-0"},e.map(n=>qn.default.createElement("li",{key:n,className:"tw-flex tw-gap-2 tw-rounded-md tw-pl-2 tw-pr-1 hover:tw-bg-dropdown-hover"},qn.default.createElement(vh,{className:"tw-flex-1"},n),qn.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>r(n)},qn.default.createElement(bi,{className:"tw-size-4"}))))))}function MGn({value:t,onUpdate:e,container:r}){let[n,o]=(0,qn.useState)(t),i=eh(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=o4(i),c=f=>{let p=i4({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 qn.default.createElement("div",{className:"tw-mt-2 tw-flex tw-flex-col tw-gap-4"},qn.default.createElement("div",{className:"tw-flex tw-max-h-[400px] tw-flex-col tw-gap-2 tw-overflow-y-auto tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-4"},!d&&qn.default.createElement("div",{className:"tw-text-center tw-text-sm"},"No patterns specified"),a.length>0&&qn.default.createElement(Gve,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(h=>h!==f);c({tagPatterns:p})}}),s.length>0&&qn.default.createElement(Gve,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(h=>h!==f);c({extensionPatterns:p})}}),u.length>0&&qn.default.createElement(Gve,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(h=>h!==f);c({folderPatterns:p})}}),l.length>0&&qn.default.createElement(Gve,{title:"Notes",patterns:l,onRemove:f=>{let p=l.filter(h=>h!==f);c({notePatterns:p})}})),qn.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},qn.default.createElement(_$,null,qn.default.createElement(v$,{asChild:!0},qn.default.createElement(he,{variant:"secondary"},"Add...")),qn.default.createElement(Q_,{align:"start",container:r},qn.default.createElement(Ui,{onSelect:()=>{new yV(app,f=>{let p=YK(f);a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},qn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},qn.default.createElement(TI,{className:"tw-size-4"}),"Tag")),qn.default.createElement(Ui,{onSelect:()=>{new gV(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},qn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},qn.default.createElement(ny,{className:"tw-size-4"}),"Folder")),qn.default.createElement(Ui,{onSelect:()=>{new sN({app,onNoteSelect:f=>{let p=a4(f);l.includes(p)||c({notePatterns:[...l,p]})},excludeNotePaths:[],titleOnly:!0}).open()}},qn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},qn.default.createElement(Dm,{className:"tw-size-4"}),"Note")),qn.default.createElement(Ui,{onSelect:()=>{new Wve(app,f=>{let p=tze(f);s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},qn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},qn.default.createElement(S5,{className:"tw-size-4"}),"Extension")),qn.default.createElement(Ui,{onSelect:()=>{new Kve(app,f=>{let p=eh(f),{tagPatterns:h,extensionPatterns:m,folderPatterns:g,notePatterns:y}=o4(p);c({tagPatterns:[...a,...h],extensionPatterns:[...s,...m],folderPatterns:[...u,...g],notePatterns:[...l,...y]})}).open()}},qn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},qn.default.createElement(eD,{className:"tw-size-4"}),"Custom"))))))}var lX=class extends gyr.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,yyr.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(qn.default.createElement(MGn,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};var Jve=class extends Ec{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 Zve=class extends Ec{constructor(e,r,n){let o=n?`Semantic search requires building an embedding index for your vault.
Use 'Refresh Vault Index' or 'Force Reindex Vault' commands to build the index after enabling. Pick your embedding model below.`:`Disabling semantic search will fall back to index-free lexical search (less resource-intensive, could be less accurate).
Your existing index will be preserved but not used.`,i=n?"Enable Semantic Search":"Disable Semantic Search",a=n?"Enable":"Disable";super(e,r,o,i,a,"Cancel")}};vo();nr();bt();fn();var Vt=j(X()),byr=()=>{let t=_n(),e=async r=>{r!==t.embeddingModelKey&&new Jve(app,async()=>{ot("embeddingModelKey",r),await(await Promise.resolve().then(()=>(Kc(),Yf))).default.getInstance().indexVaultToVectorStore()}).open()};return Vt.default.createElement("div",{className:"tw-space-y-4"},Vt.default.createElement("section",null,Vt.default.createElement("div",{className:"tw-space-y-4"},Vt.default.createElement(Ur,{type:"switch",title:"Enable Semantic Search",description:"Enable semantic search for meaning-based document retrieval. When disabled, uses fast lexical search only. Use 'Refresh Vault Index' or 'Force Reindex Vault' to build the embedding index.",checked:t.enableSemanticSearchV3,onCheckedChange:r=>{new Zve(app,()=>ot("enableSemanticSearchV3",r),r).open()}}),t.enableSemanticSearchV3&&Vt.default.createElement(Ur,{type:"select",title:"Embedding Model",description:Vt.default.createElement("div",{className:"tw-space-y-2"},Vt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Vt.default.createElement("span",{className:"tw-font-medium tw-leading-none tw-text-accent"},"Powers Semantic Local Vault Search"),Vt.default.createElement(No,{delayDuration:0},Vt.default.createElement(Ot,null,Vt.default.createElement(Et,{asChild:!0},Vt.default.createElement(Fi,{className:"tw-size-4"})),Vt.default.createElement(xt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Vt.default.createElement("div",{className:"tw-pt-2 tw-text-sm tw-text-muted"},"This model converts text into vector representations, essential for semantic search and Question Answering (QA) functionality. Changing the embedding model will:"),Vt.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Vt.default.createElement("li",null,"Require rebuilding your vault's vector index"),Vt.default.createElement("li",null,"Affect semantic search quality"),Vt.default.createElement("li",null,"Impact Question Answering feature performance"))))))),value:t.embeddingModelKey,onChange:e,options:t.activeEmbeddingModels.map(r=>({label:BH(r),value:en(r)})),placeholder:"Model"}),Vt.default.createElement(Ur,{type:"select",title:"Auto-Index Strategy",description:Vt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Vt.default.createElement("span",{className:"tw-leading-none"},"Decide when you want the vault to be indexed."),Vt.default.createElement(No,{delayDuration:0},Vt.default.createElement(Ot,null,Vt.default.createElement(Et,{asChild:!0},Vt.default.createElement(Fi,{className:"tw-size-4"})),Vt.default.createElement(xt,null,Vt.default.createElement("div",{className:"tw-space-y-2 tw-py-2"},Vt.default.createElement("div",{className:"tw-space-y-1"},Vt.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Choose when to index your vault:"),Vt.default.createElement("ul",{className:"tw-list-disc tw-space-y-1 tw-pl-2 tw-text-sm"},Vt.default.createElement("li",null,Vt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Vt.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"NEVER:"),Vt.default.createElement("span",null,"Manual indexing via command or refresh only"))),Vt.default.createElement("li",null,Vt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Vt.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON STARTUP:"),Vt.default.createElement("span",null,"Index updates when plugin loads or reloads"))),Vt.default.createElement("li",null,Vt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Vt.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON MODE SWITCH:"),Vt.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),Vt.default.createElement("p",{className:"tw-text-sm tw-text-callout-warning"},"Warning: Cost implications for large vaults with paid models")))))),value:t.indexVaultToVectorStore,onChange:r=>{ot("indexVaultToVectorStore",r)},options:Bet.map(r=>({label:r,value:r})),placeholder:"Strategy"}),Vt.default.createElement(Ur,{type:"slider",title:"Max Sources",description:"Copilot goes through your vault to find relevant notes and passes the top N to the LLM. Default for N is 15. Increase if you want more notes included in the answer generation step.",min:1,max:128,step:1,value:t.maxSourceChunks,onChange:r=>ot("maxSourceChunks",r)}),t.enableSemanticSearchV3&&Vt.default.createElement(Vt.default.Fragment,null,Vt.default.createElement(Ur,{type:"slider",title:"Requests per Minute",description:"Default is 60. Decrease if you are rate limited by your embedding provider.",min:10,max:60,step:10,value:Math.min(t.embeddingRequestsPerMin,60),onChange:r=>ot("embeddingRequestsPerMin",r)}),Vt.default.createElement(Ur,{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=>ot("embeddingBatchSize",r)}),Vt.default.createElement(Ur,{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:String(t.numPartitions||1),onChange:r=>ot("numPartitions",Number(r)),options:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"4",value:"4"},{label:"8",value:"8"},{label:"16",value:"16"},{label:"32",value:"32"},{label:"40",value:"40"}],placeholder:"Select partitions"})),Vt.default.createElement(Ur,{type:"slider",title:"Lexical Search RAM Limit",description:"Maximum RAM usage for full-text search index. Lower values use less memory but may limit search performance on large vaults. Default is 100 MB.",min:20,max:1e3,step:20,value:t.lexicalSearchRamLimit||100,onChange:r=>ot("lexicalSearchRamLimit",r),suffix:" MB"}),Vt.default.createElement(Ur,{type:"switch",title:"Enable Folder and Graph Boosts",description:"Enable folder and graph-based relevance boosts for lexical search results. When disabled, provides pure keyword-based relevance scoring without folder or connection-based adjustments.",checked:t.enableLexicalBoosts,onCheckedChange:r=>ot("enableLexicalBoosts",r)}),Vt.default.createElement(Ur,{type:"custom",title:"Exclusions",description:Vt.default.createElement(Vt.default.Fragment,null,Vt.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."))},Vt.default.createElement(he,{variant:"secondary",onClick:()=>new lX(app,r=>ot("qaExclusions",r),t.qaExclusions,"Manage Exclusions").open()},"Manage")),Vt.default.createElement(Ur,{type:"custom",title:"Inclusions",description:Vt.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.")},Vt.default.createElement(he,{variant:"secondary",onClick:()=>new lX(app,r=>ot("qaInclusions",r),t.qaInclusions,"Manage Inclusions").open()},"Manage")),Vt.default.createElement(Ur,{type:"switch",title:"Enable Obsidian Sync for Copilot index",description:"If enabled, store the semantic index in .obsidian so it syncs with Obsidian Sync. If disabled, store it under .copilot/ at the vault root.",checked:t.enableIndexSync,onCheckedChange:r=>ot("enableIndexSync",r)}),Vt.default.createElement(Ur,{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=>ot("disableIndexOnMobile",r)}))))};var vyr=["basic","model","QA","command","plus","advanced"],RGn={basic:ao.default.createElement(m5,{className:"tw-size-5"}),model:ao.default.createElement(h5,{className:"tw-size-5"}),QA:ao.default.createElement(Zj,{className:"tw-size-5"}),command:ao.default.createElement(EI,{className:"tw-size-5"}),plus:ao.default.createElement(Lm,{className:"tw-size-5"}),advanced:ao.default.createElement(eD,{className:"tw-size-5"})},NGn={basic:()=>ao.default.createElement(ayr,null),model:()=>ao.default.createElement(dyr,null),QA:()=>ao.default.createElement(byr,null),command:()=>ao.default.createElement(Qgr,null),plus:()=>ao.default.createElement(uyr,null),advanced:()=>ao.default.createElement(eyr,null)},_yr=vyr.map(t=>({id:t,icon:RGn[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),jGn=()=>{let{selectedTab:t,setSelectedTab:e}=FV();return ao.default.createElement("div",{className:"tw-flex tw-flex-col"},ao.default.createElement("div",{className:"tw-inline-flex tw-rounded-lg"},_yr.map((r,n)=>ao.default.createElement(_hr,{key:r.id,tab:r,isSelected:t===r.id,onClick:()=>e(r.id),isFirst:n===0,isLast:n===_yr.length-1}))),ao.default.createElement("div",{className:"tw-w-full tw-border tw-border-solid"}),ao.default.createElement("div",null,vyr.map(r=>{let n=NGn[r];return ao.default.createElement(vhr,{key:r,id:r,isSelected:t===r},ao.default.createElement(n,null))})))},DGn=({plugin:t})=>{let[e,r]=ao.default.useState(0),{latestVersion:n,hasUpdate:o}=A_e(t.manifest.version),i=async()=>{new vve(app,async()=>{BSe(),r(s=>s+1)}).open()};return ao.default.createElement(xhr,null,ao.default.createElement("div",null,ao.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},ao.default.createElement("h1",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},ao.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ao.default.createElement("span",null,"Copilot Settings"),ao.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},ao.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"v",t.manifest.version),n&&ao.default.createElement(ao.default.Fragment,null,o?ao.default.createElement("a",{href:"obsidian://show-plugin?id=copilot",target:"_blank",rel:"noopener noreferrer",className:"tw-text-xs tw-text-accent hover:tw-underline"},"(Update to v",n,")"):ao.default.createElement("span",{className:"tw-text-xs tw-text-normal"}," (up to date)")))),ao.default.createElement("div",{className:"tw-self-end sm:tw-self-auto"},ao.default.createElement(he,{variant:"secondary",size:"sm",onClick:i},"Reset Settings")))),ao.default.createElement(jGn,{key:e})))},wyr=DGn;var Yve=class extends cX.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}async reloadPlugin(){try{this.app.workspace.getLeavesOfType(Ms)[0]?.view&&oe().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 cX.Notice("Plugin reloaded successfully.")}catch(e){new cX.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,xyr.createRoot)(r).render(LKe.default.createElement(NKe.Provider,{value:e},LKe.default.createElement(wyr,{plugin:this.plugin})))}};bt();Kt();var Xve=class{constructor(e){this.chatManager=e;this.listeners=new Set;this.chatManager.setOnMessageCreatedCallback(()=>{this.notifyListeners()})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notifyListeners(){this.listeners.forEach(e=>{try{e()}catch(r){B("[ChatUIState] Error in listener:",r)}})}async sendMessage(e,r,n,o=!1,i){let a=await this.chatManager.sendMessage(e,r,n,o,i);return this.notifyListeners(),a}async editMessage(e,r,n,o=!1){let i=await this.chatManager.editMessage(e,r,n,o);return i&&this.notifyListeners(),i}async regenerateMessage(e,r,n){let o=await this.chatManager.regenerateMessage(e,r,i=>{n(i),this.notifyListeners()},()=>{this.notifyListeners()});return o&&this.notifyListeners(),o}async deleteMessage(e){let r=await this.chatManager.deleteMessage(e);return r&&this.notifyListeners(),r}addDisplayMessage(e,r,n){let o=this.chatManager.addDisplayMessage(e,r,n);return this.notifyListeners(),o}addFullMessage(e){let r=this.chatManager.addFullMessage(e);return this.notifyListeners(),r}clearMessages(){this.chatManager.clearMessages(),this.notifyListeners()}async truncateAfterMessageId(e){await this.chatManager.truncateAfterMessageId(e),this.notifyListeners()}getMessages(){return this.chatManager.getDisplayMessages()}getMessage(e){return this.chatManager.getMessage(e)}getLLMMessage(e){return this.chatManager.getLLMMessage(e)}getLLMMessages(){return this.chatManager.getLLMMessages()}get chatHistory(){return this.getMessages()}addMessage(e){e.isVisible?e.sources||e.content?this.addFullMessage(e):this.addDisplayMessage(e.message,e.sender,e.id):this.addFullMessage(e)}clearChatHistory(){this.clearMessages()}replaceMessages(e){this.chatManager.loadMessages(e),this.notifyListeners()}getDebugInfo(){return this.chatManager.getDebugInfo()}async loadMessages(e){await this.chatManager.loadMessages(e),this.notifyListeners()}async handleProjectSwitch(){await this.chatManager.handleProjectSwitch(),this.notifyListeners()}async saveChat(e){await this.chatManager.saveChat(e)}};jde();N6e();var vA=require("obsidian");qye();var Qve=class extends vA.Plugin{constructor(){super(...arguments);this.userMessageHistory=[]}async onload(){await this.loadSettings(),this.settingsUnsubscriber=va(async(i,a)=>{a.enableEncryption?await this.saveData(await utt(a)):await this.saveData(a),x8e(this,i,a)}),this.addSettingTab(new Yve(this.app,this)),Jye(this.app.vault),this.brevilabsClient=Gi.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),sO(),this.projectManager=Hd.getInstance(this.app,this),this.vectorStoreManager=kP.getInstance(),this.fileParserManager=new uR(this.brevilabsClient,this.app.vault);let r=new LV,n=this.projectManager.getCurrentChainManager(),o=new _ve(r,n,this.fileParserManager,this);this.chatUIState=new Xve(o),this.registerView(Ms,i=>new ON(i,this)),this.registerView(a7,i=>new oye(i)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",i=>{this.activateView()}),x8e(this,void 0,oe()),this.registerMarkdownCodeBlockProcessor(zH,(i,a)=>{bhr({plugin:this,element:a}),a.parentElement&&(a.parentElement.className="")}),Wk.initTools(this.app.vault),this.registerEvent(this.app.workspace.on("editor-menu",i=>phr(i))),this.registerEvent(this.app.workspace.on("active-leaf-change",i=>{if(i&&i.view instanceof vA.MarkdownView&&i.view.file){let s=this.app.workspace.getLeavesOfType(Ms).find(u=>u.view instanceof ON)?.view;if(s){let u=new CustomEvent(Kg.ACTIVE_LEAF_CHANGE);s.eventTarget.dispatchEvent(u)}}})),this.autocompleteService=lbe.getInstance(this),this.customCommandRegister=new yve(this,this.app.vault),this.app.workspace.onLayoutReady(()=>{this.customCommandRegister.initialize().then(hhr).then(ghr)})}async onunload(){this.projectManager&&this.projectManager.onunload(),this.customCommandRegister.cleanup(),this.settingsUnsubscriber?.(),this.autocompleteService?.destroy(),B("Copilot plugin unloaded")}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(oe().autosaveChat){let r=this.app.workspace.getLeavesOfType(Ms)[0]?.view;r&&await r.saveChat()}}async processText(r,n,o,i=!0){let a=await r.getSelection();this.app.workspace.getLeavesOfType(Ms).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(Ms).find(l=>l.view instanceof ON)?.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(Ms).find(n=>n.view instanceof ON)?.view;if(r){let n=new CustomEvent(Kg.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===Ms&&this.emitChatIsVisible()}))}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(vA.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(Ms).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(Ms);r.length===0?oe().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:Ms,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:Ms,active:!0}):this.app.workspace.revealLeaf(r[0]),this.emitChatIsVisible()}async deactivateView(){this.app.workspace.detachLeavesOfType(Ms)}async loadSettings(){let r=await this.loadData(),n=zSe(r);_E(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=en(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 vA.Notice("No chat history found.");return}new gve(this.app,r,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=this.app.vault.getAbstractFileByPath(oe().defaultSaveFolder);if(!(r instanceof vA.TFolder))return[];let o=(await this.app.vault.getMarkdownFiles()).filter(s=>s.path.startsWith(r.path)),a=bu()?.id;if(a){let s=`${a}__`;return o.filter(u=>u.basename.startsWith(s))}else return o.filter(s=>!s.basename.match(/^[a-zA-Z0-9-]+__/))}async loadChatHistory(r){await this.autosaveCurrentChat();let n=await this.app.vault.read(r),o=Nor(n),i=this.app.workspace.getLeavesOfType(Ms)[0];i||this.activateView(),await this.chatUIState.loadMessages(o);let a=(i||this.app.workspace.getLeavesOfType(Ms)[0])?.view;a&&a.updateView()}async handleNewChat(){await this.autosaveCurrentChat();let r=this.app.workspace.getLeavesOfType(Ms)[0];if(r){let n=r.view,o=new CustomEvent(Kg.ABORT_STREAM,{detail:{reason:"new-chat"}});n.eventTarget.dispatchEvent(o)}this.chatUIState.clearMessages(),r?r.view.updateView():await this.activateView()}async newChat(){await this.handleNewChat()}async customSearchDB(r,n,o){return(await(oe().enableSemanticSearchV3?new(await Promise.resolve().then(()=>(uG(),Fde))).HybridRetriever({minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o}):new(await Promise.resolve().then(()=>(e7(),Qge))).TieredLexicalRetriever(this.app,{minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o,timeRange:void 0,returnAll:!1,useRerankerThreshold:void 0})).getRelevantDocuments(r)).map(u=>({content:u.pageContent,metadata:u.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.
*)
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/brain.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-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/circle-check-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/circle-dashed.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-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/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-audio.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-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/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-video.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/history.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/message-square.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/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/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-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/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/search.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/icons/zap-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/zap.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.
*)
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
*)
@langchain/core/dist/utils/js-sha256/hash.js:
(**
* [js-sha256]{@link https://github.com/emn178/js-sha256}
*
* @version 0.11.1
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2025
* @license MIT
*)
@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.
*)
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
*)
*/
/* nosourcemap */